http://stackoverflow.com/a/25715043
has body: Here is a link to a question just like this with a great answer: I want to open a text file and edit a specific line in java Basically, you can't just edit that line, unless it'll be the exact same length. Instead, you'll want to copy over every line, and then when you reach the line number of the line you want to change, instead of copying over the old line, just put in your new line. The link I gave you has a great example on how to do this. I hope this helps...if not, let me know, and I'll elaborate further on the post. Good luck :)
score: 1
answers question: http://stackoverflow.com/q/25714779
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/a/25841247
answers question: http://stackoverflow.com/q/25840661
has comment: http://stackoverflow.com/comment/40431297
has body: If you are using the Xalan processor, you can take advantage of the EXSLT str:align() function, for example: XSLT 1.0 &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" extension-element-prefixes="str"&gt; &lt;xsl:output method="text" encoding="UTF-8"/&gt; &lt;xsl:template match="/transcript"&gt; &lt;!-- STUDENT --&gt; &lt;xsl:text&gt; Student Transcript&amp;#10; Name: &lt;/xsl:text&gt; &lt;xsl:value-of select="student/@name" /&gt; &lt;xsl:text&gt;&amp;#10; ID: &lt;/xsl:text&gt; &lt;xsl:value-of select="student/@id" /&gt; &lt;!-- COURSES --&gt; &lt;xsl:text&gt;&amp;#10;&amp;#10;Course Name | Grade | Credits&amp;#10;&lt;/xsl:text&gt; &lt;xsl:for-each select="term/course"&gt; &lt;xsl:value-of select="str:align(course-name, ' | ', 'left')" /&gt; &lt;xsl:value-of select="str:align(grade, ' | ', 'left')" /&gt; &lt;xsl:value-of select="credits" /&gt; &lt;xsl:if test="position()!=last()"&gt; &lt;xsl:text&gt;&amp;#10;&lt;/xsl:text&gt; &lt;/xsl:if&gt; &lt;/xsl:for-each&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; Applied to your example input, this will return: Student Transcript Name: name 1 ID: STU12345 Course Name | Grade | Credits course 1 | A- | 4 course 2 | B+ | 3 See a working example here: http://xsltransform.net/bdxtpM Note: you need a non-buggy version of Xalan for this to work correctly. Otherwise you will have to write a recursive named template to do the padding, or use the substring() function to "cut" a matching piece out of a string of spaces.
has comment: http://stackoverflow.com/comment/40431395
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40431475
accepted answer of: http://stackoverflow.com/q/25840661
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40431507
downvote count: 0
type: Answer

http://stackoverflow.com/q/25751709
favorite count: 0
type: Question
tagged with: exception
score: 5
has answer: http://stackoverflow.com/a/25751765
possible better answer: http://stackoverflow.com/a/25751797
has body: Suppose we have following method (a very simplified version): void doSomething() { try { throw new Exception("A"); } finally { throw new Exception("B"); } } Exception with message "B" is caught in the caller method. Basically, is there any way of knowing which exception was thrown in try block if finally block also throws some exception? Suppose method doSomething() cannot be modified.
has title: Java lost exception
has answer: http://stackoverflow.com/a/25751797
accepted answer: http://stackoverflow.com/a/25751765
answer count: 3
tagged with: try-catch
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25751841
type: AnsweredQuestion
downvote count: 0
tagged with: finally

http://stackoverflow.com/comment/40212690
type: Comment
type: QuestionComment
has text: How would you store a `byte[]` in a database _without_ using a BLOB (Binary Large OBject)?
comment on: http://stackoverflow.com/q/25722611
score: 0

http://stackoverflow.com/comment/40275392
has text: Are you outputting `temp`? Are you sure?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25755971

http://stackoverflow.com/a/25734068
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25734047
has body: This code would just cause NullPointerException, since it's trying to access the null reference returned by getArray(). If, on the other hand, the getArray() method would return a non-null array, this expression would set the index variable to 3 and then increment the value of the 4th element in the array (assuming the array has a least 4 elements - otherwise it would throw an exception) by one. It would make more sense, though, to store the array returned by getArray() in a variable (in order to keep a reference to it). Otherwise, there is no point to manipulating this array, since you would have no way to access it at the end of the getArray()[ index = 3]++; statement.
score: 4
type: Answer

http://stackoverflow.com/comment/40262639
comment on: http://stackoverflow.com/a/25749160
score: 0
type: Comment
type: AnswerComment
has text: @auselen _I didn't get that._ as in you didn't understand what I wrote or that's not the behavior you are seeing?

http://stackoverflow.com/a/25775878
has comment: http://stackoverflow.com/comment/40315051
has comment: http://stackoverflow.com/comment/40314749
type: Answer
accepted answer of: http://stackoverflow.com/q/25773777
has comment: http://stackoverflow.com/comment/40359987
score: 0
has body: If your application is Servlet 3.0 version you should use request.logout() in your logout servlet. It should properly invalidate session and remove user credentials see javadoc request.logout. If Tomcat doesn't implement it correctly you should call session.invalidate()
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25773777

java
tags question: http://stackoverflow.com/q/25755162
tags question: http://stackoverflow.com/q/25741636
tags question: http://stackoverflow.com/q/25727879
tags question: http://stackoverflow.com/q/25779370
tags question: http://stackoverflow.com/q/25777055
tags question: http://stackoverflow.com/q/25805029
tags question: http://stackoverflow.com/q/25722453
tags question: http://stackoverflow.com/q/25777722
tags question: http://stackoverflow.com/q/25743102
tags question: http://stackoverflow.com/q/25728876
tags question: http://stackoverflow.com/q/25842228
tags question: http://stackoverflow.com/q/25858770
tags question: http://stackoverflow.com/q/25738472
tags question: http://stackoverflow.com/q/25797650
tags question: http://stackoverflow.com/q/25797866
tags question: http://stackoverflow.com/q/25863000
tags question: http://stackoverflow.com/q/25724175
tags question: http://stackoverflow.com/q/25810607
tags question: http://stackoverflow.com/q/25832004
tags question: http://stackoverflow.com/q/25817458
tags question: http://stackoverflow.com/q/25718799
tags question: http://stackoverflow.com/q/25745542
tags question: http://stackoverflow.com/q/25743233
tags question: http://stackoverflow.com/q/25728743
tags question: http://stackoverflow.com/q/25872395
tags question: http://stackoverflow.com/q/25849166
tags question: http://stackoverflow.com/q/25866974
tags question: http://stackoverflow.com/q/25871816
tags question: http://stackoverflow.com/q/25744771
tags question: http://stackoverflow.com/q/25779212
tags question: http://stackoverflow.com/q/25722945
tags question: http://stackoverflow.com/q/25715154
tags question: http://stackoverflow.com/q/25767169
tags question: http://stackoverflow.com/q/25841793
tags question: http://stackoverflow.com/q/25759594
tags question: http://stackoverflow.com/q/25745025
tags question: http://stackoverflow.com/q/25828732
tags question: http://stackoverflow.com/q/25809581
tags question: http://stackoverflow.com/q/25791978
tags question: http://stackoverflow.com/q/25759738
tags question: http://stackoverflow.com/q/25865156
tags question: http://stackoverflow.com/q/25788709
tags question: http://stackoverflow.com/q/25758959
tags question: http://stackoverflow.com/q/25771438
tags question: http://stackoverflow.com/q/25778347
tags question: http://stackoverflow.com/q/25865637
tags question: http://stackoverflow.com/q/25867548
tags question: http://stackoverflow.com/q/25718315
tags question: http://stackoverflow.com/q/25714919
tags question: http://stackoverflow.com/q/25831776
tags question: http://stackoverflow.com/q/25806576
tags question: http://stackoverflow.com/q/25866279
tags question: http://stackoverflow.com/q/25730749
tags question: http://stackoverflow.com/q/25824411
tags question: http://stackoverflow.com/q/25782118
tags question: http://stackoverflow.com/q/25770684
tags question: http://stackoverflow.com/q/25736900
tags question: http://stackoverflow.com/q/25788992
tags question: http://stackoverflow.com/q/25771892
tags question: http://stackoverflow.com/q/25760989
tags question: http://stackoverflow.com/q/25869771
tags question: http://stackoverflow.com/q/25837132
tags question: http://stackoverflow.com/q/25865079
tags question: http://stackoverflow.com/q/25857320
tags question: http://stackoverflow.com/q/25717692
tags question: http://stackoverflow.com/q/25782687
tags question: http://stackoverflow.com/q/25802691
tags question: http://stackoverflow.com/q/25791343
tags question: http://stackoverflow.com/q/25753271
tags question: http://stackoverflow.com/q/25810077
tags question: http://stackoverflow.com/q/25716485
tags question: http://stackoverflow.com/q/25841391
tags question: http://stackoverflow.com/q/25826298
tags question: http://stackoverflow.com/q/25825780
tags question: http://stackoverflow.com/q/25803917
tags question: http://stackoverflow.com/q/25865919
tags question: http://stackoverflow.com/q/25762772
tags question: http://stackoverflow.com/q/25835727
tags question: http://stackoverflow.com/q/25746026
tags question: http://stackoverflow.com/q/25837213

validation
tags question: http://stackoverflow.com/q/25793549
tags question: http://stackoverflow.com/q/25763935
tags question: http://stackoverflow.com/q/25732049
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/25872109
tags question: http://stackoverflow.com/q/25756659
tags question: http://stackoverflow.com/q/25796449
tags question: http://stackoverflow.com/q/25805949
tags question: http://stackoverflow.com/q/25724736
tags question: http://stackoverflow.com/q/25721732
tags question: http://stackoverflow.com/q/25728347
tags question: http://stackoverflow.com/q/25863782
tags question: http://stackoverflow.com/q/25808796
tags question: http://stackoverflow.com/q/25737951
tags question: http://stackoverflow.com/q/25862444

http://stackoverflow.com/comment/40270219
comment on: http://stackoverflow.com/q/25753082
score: 0
has text: @MadProgrammer Then the same problem applies to the web service as the DB
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40297485
comment on: http://stackoverflow.com/q/25767422
has text: Your result can not be achieve by using attribute level.like this : @Query("select t from #{#entityName} t where t.attribute = ?1") List<T> findAllByAttribute(String attribute);[@Query](http://docs.spring.io/spring-data/jpa/docs/1.6.4.RELEASE/reference/html/jpa.repositories.html)
score: 0
type: Comment
type: QuestionComment

eclipse
tags question: http://stackoverflow.com/q/25862084
tags question: http://stackoverflow.com/q/25854096
tags question: http://stackoverflow.com/q/25735788
tags question: http://stackoverflow.com/q/25868493
tags question: http://stackoverflow.com/q/25751701
tags question: http://stackoverflow.com/q/25776768
tags question: http://stackoverflow.com/q/25810791
tags question: http://stackoverflow.com/q/25832501
tags question: http://stackoverflow.com/q/25816675
tags question: http://stackoverflow.com/q/25717928
tags question: http://stackoverflow.com/q/25803092
tags question: http://stackoverflow.com/q/25758687
tags question: http://stackoverflow.com/q/25867580
tags question: http://stackoverflow.com/q/25793526
tag name: eclipse
tags question: http://stackoverflow.com/q/25856735
tags question: http://stackoverflow.com/q/25836602
tags question: http://stackoverflow.com/q/25805204
tags question: http://stackoverflow.com/q/25853529
tags question: http://stackoverflow.com/q/25843096
tags question: http://stackoverflow.com/q/25859293
tags question: http://stackoverflow.com/q/25727601
tags question: http://stackoverflow.com/q/25789137
tags question: http://stackoverflow.com/q/25769454
tags question: http://stackoverflow.com/q/25787197
tags question: http://stackoverflow.com/q/25808705
tags question: http://stackoverflow.com/q/25843319
tags question: http://stackoverflow.com/q/25865469
tags question: http://stackoverflow.com/q/25777253
tags question: http://stackoverflow.com/q/25780189
tags question: http://stackoverflow.com/q/25840529
tags question: http://stackoverflow.com/q/25867773
tags question: http://stackoverflow.com/q/25776116
tags question: http://stackoverflow.com/q/25764282
tags question: http://stackoverflow.com/q/25866762
tags question: http://stackoverflow.com/q/25734921
tags question: http://stackoverflow.com/q/25868938
tags question: http://stackoverflow.com/q/25762915
tags question: http://stackoverflow.com/q/25836272
tags question: http://stackoverflow.com/q/25761607
tags question: http://stackoverflow.com/q/25847779
tags question: http://stackoverflow.com/q/25761231
tags question: http://stackoverflow.com/q/25806885
tags question: http://stackoverflow.com/q/25873310
tags question: http://stackoverflow.com/q/25822008
tags question: http://stackoverflow.com/q/25807327
tags question: http://stackoverflow.com/q/25856684
tags question: http://stackoverflow.com/q/25784063
tags question: http://stackoverflow.com/q/25763112
tags question: http://stackoverflow.com/q/25749648
tags question: http://stackoverflow.com/q/25760736
tags question: http://stackoverflow.com/q/25740171
tags question: http://stackoverflow.com/q/25788832
tags question: http://stackoverflow.com/q/25736392
tags question: http://stackoverflow.com/q/25750139
tags question: http://stackoverflow.com/q/25718066
tags question: http://stackoverflow.com/q/25813283
tags question: http://stackoverflow.com/q/25853905
tags question: http://stackoverflow.com/q/25725675
tags question: http://stackoverflow.com/q/25857164
tags question: http://stackoverflow.com/q/25840589
tags question: http://stackoverflow.com/q/25737871
tags question: http://stackoverflow.com/q/25842014
tags question: http://stackoverflow.com/q/25729954
tags question: http://stackoverflow.com/q/25785026
tags question: http://stackoverflow.com/q/25738939
tags question: http://stackoverflow.com/q/25869266
tags question: http://stackoverflow.com/q/25826778
tags question: http://stackoverflow.com/q/25766852
tags question: http://stackoverflow.com/q/25777805
tags question: http://stackoverflow.com/q/25780011
tags question: http://stackoverflow.com/q/25809069
tags question: http://stackoverflow.com/q/25839564
tags question: http://stackoverflow.com/q/25728094
tags question: http://stackoverflow.com/q/25817757
tags question: http://stackoverflow.com/q/25864543
tags question: http://stackoverflow.com/q/25714288
tags question: http://stackoverflow.com/q/25840315
tags question: http://stackoverflow.com/q/25753835
tags question: http://stackoverflow.com/q/25821403

android
tags question: http://stackoverflow.com/q/25743711
tags question: http://stackoverflow.com/q/25853671
tags question: http://stackoverflow.com/q/25736410
tags question: http://stackoverflow.com/q/25859228
tags question: http://stackoverflow.com/q/25832864
tags question: http://stackoverflow.com/q/25739967
tags question: http://stackoverflow.com/q/25830585
tags question: http://stackoverflow.com/q/25752393
tags question: http://stackoverflow.com/q/25730340
tags question: http://stackoverflow.com/q/25752624
tags question: http://stackoverflow.com/q/25751712
tags question: http://stackoverflow.com/q/25842175
tags question: http://stackoverflow.com/q/25814818
tags question: http://stackoverflow.com/q/25742976
tags question: http://stackoverflow.com/q/25851853
tags question: http://stackoverflow.com/q/25754007
tags question: http://stackoverflow.com/q/25762200
tags question: http://stackoverflow.com/q/25830552
tags question: http://stackoverflow.com/q/25738652
tags question: http://stackoverflow.com/q/25781314
tags question: http://stackoverflow.com/q/25819907
tags question: http://stackoverflow.com/q/25870733
tags question: http://stackoverflow.com/q/25842116
tags question: http://stackoverflow.com/q/25738644
tags question: http://stackoverflow.com/q/25835439
tags question: http://stackoverflow.com/q/25780239
tags question: http://stackoverflow.com/q/25761729
tags question: http://stackoverflow.com/q/25763486
tags question: http://stackoverflow.com/q/25744681
tags question: http://stackoverflow.com/q/25817329
tags question: http://stackoverflow.com/q/25751707
tags question: http://stackoverflow.com/q/25732072
tags question: http://stackoverflow.com/q/25840595
tags question: http://stackoverflow.com/q/25777733
tags question: http://stackoverflow.com/q/25843096
tags question: http://stackoverflow.com/q/25783882
tags question: http://stackoverflow.com/q/25721703
tags question: http://stackoverflow.com/q/25784926
tags question: http://stackoverflow.com/q/25847903
tags question: http://stackoverflow.com/q/25781603
tags question: http://stackoverflow.com/q/25788166
tags question: http://stackoverflow.com/q/25784549
tags question: http://stackoverflow.com/q/25763323
tags question: http://stackoverflow.com/q/25793564
tags question: http://stackoverflow.com/q/25760650
tags question: http://stackoverflow.com/q/25784891
tags question: http://stackoverflow.com/q/25729021
tags question: http://stackoverflow.com/q/25823571
tags question: http://stackoverflow.com/q/25811700
tags question: http://stackoverflow.com/q/25758106
tags question: http://stackoverflow.com/q/25823546
tags question: http://stackoverflow.com/q/25832423
tags question: http://stackoverflow.com/q/25719144
tags question: http://stackoverflow.com/q/25815222
tags question: http://stackoverflow.com/q/25780604
tags question: http://stackoverflow.com/q/25814958
tags question: http://stackoverflow.com/q/25821741
tags question: http://stackoverflow.com/q/25716087
tags question: http://stackoverflow.com/q/25786202
tags question: http://stackoverflow.com/q/25864320
tags question: http://stackoverflow.com/q/25721994
tags question: http://stackoverflow.com/q/25836860
tags question: http://stackoverflow.com/q/25740236
tags question: http://stackoverflow.com/q/25722546
tags question: http://stackoverflow.com/q/25804073
tags question: http://stackoverflow.com/q/25761433
tags question: http://stackoverflow.com/q/25773815
tags question: http://stackoverflow.com/q/25805507
tags question: http://stackoverflow.com/q/25804550
tags question: http://stackoverflow.com/q/25872769
tags question: http://stackoverflow.com/q/25744236
tags question: http://stackoverflow.com/q/25864376
tags question: http://stackoverflow.com/q/25766987
tags question: http://stackoverflow.com/q/25830230
tags question: http://stackoverflow.com/q/25872832
tags question: http://stackoverflow.com/q/25826292
tags question: http://stackoverflow.com/q/25757027
tags question: http://stackoverflow.com/q/25821663
tags question: http://stackoverflow.com/q/25772071
tags question: http://stackoverflow.com/q/25860543

http://stackoverflow.com/q/25795145
has answer: http://stackoverflow.com/a/25860258
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25795224
has title: Server to Client communication methods
tagged with: retrofit
has answer: http://stackoverflow.com/a/25795224
tagged with: android
tagged with: spring
has body: I don't think my question is original and maybe I already have my answer but I feel a bit lost. I have an android box (the client) that exists and retrieves information from the server and then displays that information. The client is making a call to the server once ever second to check to see if there is a change in the information. This is ok right now however when we have 500 clients hitting the server once every second this is going to start getting heavy. QUESTION: Is there a way for the communication to occur the opposite way. I would like the server to tell the client when it has updates rather than client to server. We are currently using Retrofit by KDubb and the communication is working great but I don't think it will accomplish what we are looking for, or will it? I know you can do Asynchronous communication but I don't know the clients address because it is sitting on a local network somewhere (a home or business) and I don't want the customer to worry about firewall or router issues. Would Long Polling accomplish what I have described? Is there another technology that would work better than long polling or will retrofit do what I want it to do? I am using a Spring platform and we are communicating with Android.
accepted answer: http://stackoverflow.com/a/25860258
has answer: http://stackoverflow.com/a/25795595
type: AnsweredQuestion
upvote count: 1
tagged with: long-polling
type: Question
score: 1
tagged with: java
answer count: 3

http://stackoverflow.com/q/25843385
has comment: http://stackoverflow.com/comment/40434929
has title: Android Switch Issue
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/40434939
score: 0
tagged with: java
has body: I am currently using a switch in my Android application as sort of options in my settings class. However, when I change the state of the switch, from say false to true, and go back to the menu, and then go back to the settings activity, the state of the switch goes back to the default value. Is there a key line that basically saves the switch's state so that when a user returns to it, the state is the same? I don't think this question requires code, but if you think it's helpful, please let me know and I'll attach it. Thanks! here is my activity code: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.speedytext.Options" &gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;Switch android:id="@+id/switch1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/textView1" android:layout_marginLeft="46dp" android:layout_marginTop="48dp" android:layout_toRightOf="@+id/textView1" android:text="Switch" /&gt; &lt;Switch android:id="@+id/switch2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@+id/switch1" android:layout_below="@+id/switch1" android:layout_marginTop="66dp" android:text="Switch" /&gt; &lt;/RelativeLayout&gt; here is my java code: import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.Switch; public class …
answer count: 2
has answer: http://stackoverflow.com/a/25843540
has comment: http://stackoverflow.com/comment/40434816
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25843684

http://stackoverflow.com/a/25870530
score: 0
type: Answer
has body: Use QR Code WordPress plugin to insert a QR code in your blog. The qr code contains the current URL or any other text you like. Download it from here How to use it: Use the shortcode [qrcode] within your site to generate a QR Code including the URL of the current site Use the fullowing short code to generate a indivdual qr code with any text content: [qrcode content="CONTENT" size="80" alt="ALT_TEXT" class="CLASS_NAME"] Possible parameters are: alt, size, class, credit, shadow If you don`t give any parameter like 'alt' or 'size', the standard parameters are: alt = "Scan the QR Code" size = 120 class="" credit = true shadow = true How to install the plugin: Download the file qrcode-wprhe.zip Do not rename the file !important Go to your Wordpress administrator panel at /wp-admin Got to /wp-admin/plugin-install.php and upload the downloaded zip file Activate the plugin through the 'Plugins' menu in WordPress Use the shortcode [qrcode] within your desired posts. DONE
answers question: http://stackoverflow.com/q/25842135

http://stackoverflow.com/comment/40282757
score: 0
type: Comment
type: QuestionComment
has text: Whoops, I read your comment wrong. I tought you asked them to change the API for the method to receive a parameter, sorry (_It is NOT with me_. I missed that _not_ somehow). My previous comment still makes sense tough.
comment on: http://stackoverflow.com/q/25759473

http://stackoverflow.com/comment/76619439
has text: So when you set up the H2 Driver, till the time red driver icon gets green, when you restart the Squirrel. Then, set up yet your Alias: The connection string. Note, that whatever checkbox you set (i.e. auto logon), cannot be changed then, sadly. (you will have to set up the Alias again, with your desired difference.)
type: Comment
comment on: http://stackoverflow.com/a/25879922
score: 0
type: AnswerComment

http://stackoverflow.com/a/25726844
answers question: http://stackoverflow.com/q/25726803
has body: Don't return anything. In java References to objects are passed by value. The changes made to array here will be reflected in other methods.
score: 0
type: Answer

http://stackoverflow.com/a/25815616
answers question: http://stackoverflow.com/q/25815318
has body: This "cheats" (is weaker than it could be), but it meets the usual requirements (or can be modified to meet them): import java.util.Random; public class Password { private static final String UPPER = "ABCDEFGHIJKLMNPQRSTUVWXYZ"; private static final String LOWER = "abcdefghijklmnpqrstuvwxyz"; private static final String NUMBER = "123456789"; private static final String SPECIAL = "!@#$%&amp;*+?"; private Random randGen = new Random(); public static void main(String[] argv) { Password me = new Password(); for (int i = 0; i &lt;= 10; i++) { me.printPassword(); } } private void printPassword() { StringBuffer buf = new StringBuffer(); buf.append(LOWER.charAt(Math.abs(randGen.nextInt()) % LOWER.length())); buf.append(LOWER.charAt(Math.abs(randGen.nextInt()) % LOWER.length())); buf.append(NUMBER.charAt(Math.abs(randGen.nextInt()) % NUMBER.length())); for (int i = 0; i &lt;= 4; i++) { buf.append(LOWER.charAt(Math.abs(randGen.nextInt()) % LOWER.length())); } buf.append(UPPER.charAt(Math.abs(randGen.nextInt()) % UPPER.length())); buf.append(LOWER.charAt(Math.abs(randGen.nextInt()) % LOWER.length())); System.out.println(buf.toString()); } } I had another algorithm that was better, but lost it. (I like to print out multiple "suggestions" and then pick the one that seems easiest to remember.)
score: 0
type: Answer

http://stackoverflow.com/comment/40387778
type: Comment
comment on: http://stackoverflow.com/a/25816238
has text: Thanks, you make a good case. It's the linguistic point I was getting at. I agree that ?[] is unnecessary, but generics are so complicated I think it would have been worth enabling it to make them more consistent and easier to understand. For example if you create a generic class MyClass<T> with an instance method foo that returns a T[], commonsense dictates that if you invoke foo on a MyClass<?> you ought to get a ?[]. In fact, IntelliJ actually lists the return type as ?[] (I don't know about eclipse). It's confusing and strange that you can't write ?[] in your code.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40482145
has text: @maaartinus Of course a shutdown hook is useful *in addition* to a standard mechanism---again as a last-resort measure in case of a failure to follow proper procedure. Most finalizer methods serve the same purpose.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25868660

http://stackoverflow.com/comment/40469029
has text: @Chaitu see my edit, I've linked an interesting answer.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25862003

http://stackoverflow.com/q/25753876
has comment: http://stackoverflow.com/comment/40309879
has comment: http://stackoverflow.com/comment/40310841
has comment: http://stackoverflow.com/comment/40271595
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25754047
downvote count: 0
answer count: 1
favorite count: 0
tagged with: blocked
has comment: http://stackoverflow.com/comment/40271743
has comment: http://stackoverflow.com/comment/40271786
has title: Stopping a Java thread blocked on a Scanner
has body: This is related to some other questions on here, but I haven't yet seen an answer that helps. (EDIT by JWW: per the comments, the cited duplicate doe not handle the EOF as expected or desired). In this example, the main() function starts a Thread, which blocks on a Scanner's nextLine() function. I then wait for 0.2 s, and after that time I want to force this Thread to terminate, even though nothing's been typed in. I can't get the Thread to stop on its own, without hitting a key to satisfy its Scanner. import java.util.*; class sandbox { public static void main(String[] args) { BlockingThread thread = new BlockingThread(); thread.start(); trySleep(200); // wait 0.2 s thread.closeScanner(); // try to close the Scanner, to terminate the Thread } public static void trySleep(int time) { try { Thread.sleep(time); } catch (InterruptedException e) {} } static class BlockingThread extends Thread { private Scanner scanner = new Scanner(System.in); public void run() { System.out.println("Running!"); scanner.nextLine(); System.out.println("Stopping!"); } public void closeScanner() { System.out.println("\tTrying to close the Scanner..."); scanner.close(); System.out.println("\tScanner is now closed."); } } } Some notes: It's definitely blocking on the Scanner's underlying stream. If you download and run this code, it'll halt right after printing "Trying to close the Scanner..." If you remove the call to thread.closeScanner(), it'll stop immediately after "Running!" I've seen some answers claiming that I want to call the Thread's interrupt() method. But that doesn't work, because the Thread is blocked. I've seen other answers claiming that I want to close the stream that the Scanner is reading. But that doesn't seem to work either&mdash;Scanner docs indicate that its close() method closes the underlying stream, so that should be what I'm doing in the above toy code. I'd even be willing to use a deprecated method like stop(), but even that appears to have no effect. Any ideas? Th…
type: UnansweredQuestion
tagged with: multithreading
tagged with: stream
has comment: http://stackoverflow.com/comment/40275840
upvote count: 1
linked to: http://stackoverflow.com/q/4983065
type: Question
linked to: http://stackoverflow.com/q/2124102

http://stackoverflow.com/comment/40291414
comment on: http://stackoverflow.com/a/25762622
score: 1
type: AnswerComment
type: Comment
has text: Oh, I see what the problem was. Your mesh doesn't have vertex color attributes, so `a_color` is just black with zero alpha. You can completely remove `v_color` from your vertex and fragment shaders since you aren't using color.

http://stackoverflow.com/comment/40372624
has text: I don't think that's an accurate analogy. Perhaps you don't understand my question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25800659

http://stackoverflow.com/comment/40278751
comment on: http://stackoverflow.com/q/25757969
score: 0
type: Comment
has text: either what you can do is, convert this to String, split the string with "." if it is 1 or 2 return true else false and check the split array for Number format Exception
type: QuestionComment

http://stackoverflow.com/q/25777524
has body: Edit: This question arises because I didn't realize there was a StrongLoop guide to follow. My request is for stubbing and not the StrongLoop code itself. I'm pretty new to Android and Java. I wanted to keep StrongLoop sample code in the project while I tested something, so I tried stubbing it (to get a build) and failed. I found and will follow the StrongLoop setup guide, but my stubbing skills are lacking. I think this is the minimum code for my question: 1: // UserRepository&lt;User&gt; userRepo = adapter.createRepository(UserRepository&lt;User&gt;.class); 2: UserRepository&lt;User&gt; userRepo = adapter.createRepository(UserRepository.class); 3: userRepo.findCurrentUser(new ObjectCallback&lt;User&gt;() { 4: public void onSuccess(User user) {} 5: }); 6: userRepo.loginUser("user", "pwd", 7: new UserRepository&lt;User&gt;.LoginCallback() { Stub attempt: public class User {} public class UserRepository&lt;a&gt; { public void findCurrentUser(ObjectCallback a) {} public void loginUser(String a, String b, UserRepository c) {} public void onSuccess(User u) {} public void LoginCallback() {} } At line, note: Commented; with &lt;User&gt;.class I get: "Cannot select from parameterized type". Searches tell me to read up on generic functions. The rabbit I chased; I thought error #1 meant "Remove the parameter (&lt;User&gt;) from the type (UserRepository)". findCurrentUser() resolves okay. onSuccess() resolves okay. . loginUser() probably resolves okay. "Cannot resolve symbol 'LoginCallback'" For #2 I had to add: @SuppressWarnings("unchecked"); ...and by the error on #7 I stopped digging the hole. It's too generic to search on without advice on what I'm breaking. So how do I fix my stub attempt? I'll learn from that, and with go-read suggestions I'll gladly study the concepts I can't name but am certainly misusing. The only idea I have right now is that when the callback executes the class is gone.
score: 0
tagged with: callback
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40347345
has title: Stubbing diamond-containing classes in Android
answer count: 0
tagged with: java
tagged with: stubbing
type: Question
has comment: http://stackoverflow.com/comment/40315792
has comment: http://stackoverflow.com/comment/40347051

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/25772655
tags question: http://stackoverflow.com/q/25751516
tags question: http://stackoverflow.com/q/25873131
tags question: http://stackoverflow.com/q/25846488
tags question: http://stackoverflow.com/q/25832566
tags question: http://stackoverflow.com/q/25762900
tag name: jfreechart
tags question: http://stackoverflow.com/q/25794801

http://stackoverflow.com/q/25821149
upvote count: 2
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40394103
has comment: http://stackoverflow.com/comment/40394055
has answer: http://stackoverflow.com/a/25822106
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40398597
has answer: http://stackoverflow.com/a/25822079
has comment: http://stackoverflow.com/comment/40394286
answer count: 2
score: 1
has body: There are falling snowballs. and when the snowball reaches a certain block (125&lt;=y&lt;=260) that block can only allow one snowball at a time to pass. The problem in my code is, they all pass on that block. It doesn't lock. What is wrong with my code? Please help. public void run() { while(true){ synchronized(this){ if((y&gt;=125)&amp;&amp;(y&lt;=260)){ y+=1; } } if(y&gt;=480){ x = randomGenerator.nextInt(400); y = 0; }else{ y=y+1; } } }
favorite count: 0
tagged with: synchronization
has comment: http://stackoverflow.com/comment/40394141
has title: Synchronized block won't lock
has comment: http://stackoverflow.com/comment/40394138

http://stackoverflow.com/comment/98386788
comment on: http://stackoverflow.com/a/25765032
score: 0
type: AnswerComment
has text: For Solution 1: With this constructor [[[ public MyBean(@Value("${some.prop}") String prop) ]]], how could I new a instance of this class?
type: Comment

http://stackoverflow.com/a/25903485
type: AcceptedAnswer
has body: No need to use TypeLiteral, you can just use Key directly. (And that gives you an opportunity to add an annotation if you want.) It's probably better to defer constructing instances until singleton time, instead of when the module is instantiated. For example, you could do: public final class MyModule&lt;T extends Parent&gt; extends AbstractModule { private final Key&lt;T&gt; key; private final Provider&lt;T&gt; provider; public MyModule(final Class&lt;T&gt; clazz, final String[] args) { this.key = Key.get(clazz); // Or add an annotation if you feel like it this.provider = new Provider&lt;T&gt;() { @Override public T get() { try { T instance = clazz.newInstance(); // etc. } catch (ReflectiveOperationException ex) { // throw a RuntimeException here } } }; } @Override protected void configure() { bind(key).toProvider(provider).in(Singleton.class); } }
accepted answer of: http://stackoverflow.com/q/25756913
answers question: http://stackoverflow.com/q/25756913
type: Answer
downvote count: 0
score: 1
upvote count: 1

http://stackoverflow.com/q/25743248
has body: I have two application written in playframework. I would like to join one to another. I have one database, and I would like to share my login classes between thems. Applications have difrent names used for classes, methods, variables. How can I achive it? Should I create jar version and try to join them. Or Should I move code from one app to another with new package name like application name But what about shared views or main controller and configuration files Please give me some advice.
linked to: http://stackoverflow.com/q/25746065
score: 0
answer count: 1
has title: Play framework combining two Play application into one
accepted answer: http://stackoverflow.com/a/25743907
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: join
has answer: http://stackoverflow.com/a/25743907
tagged with: java
type: Question

http://stackoverflow.com/q/25783381
has title: Error trying to get Google Calendar Service
has comment: http://stackoverflow.com/comment/40346551
linked to: http://stackoverflow.com/q/14519431
has body: I am developing an AppEngine application where I gotta work with Google Calendar API. Because of some reasons, we are not using the lastest version of this API (v3) and we are working with gdata-calendar-v2 which is still working until the next November. All right, I have two methods where I am using the Calendar Service. For one hand, I am adding a new event on my calendar and I do something like: CalendarService myService = new CalendarService("my_calendar"); // error on this line myService.setUserCredentials(EMAIL, PASSWORD); As I know, it is working fine and I am adding new events on my calendar with no problems. For another hand, I have another method where I do something different but I am using the same snippet code to connect to Google Calendar. In this case, I get this error: Caused by: java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.copyOf([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet; at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableTypes(AltFormat.java:399) at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableXmlTypes(AltFormat.java:387) at com.google.gdata.wireformats.AltFormat.&lt;clinit&gt;(AltFormat.java:49) at com.google.gdata.client.Service.&lt;clinit&gt;(Service.java:558) The libraries that I am using with -collections- and you can be interested are: Guava 11 (I already update to 18 and it's the same problem). I know there is a very similar thread with the same problem right here but there is one difference: it is working fine in one method of my project and it is not working fine in another. Can you give me a helping hand? Thank you in advance, Diego. Solution: I have been searching in Google and I found out this thread I have changed my Guava to guava-10.0.1.jar and I don't get this error anymore. The latest version of the gdata client library for java (version 1.46.0 as of this writing, found here: https://code.google.com/p/gdata-java-client/downloads/list) still embeds google-collection…
has comment: http://stackoverflow.com/comment/40361110
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: google-calendar-api
has answer: http://stackoverflow.com/a/25783916
tagged with: guava
tagged with: java
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/40592093
has text: I tried a lot to reduce its execution time , but unfortunately didn't get any success. @PeterdeRivaz can u or someone plz help in this problem.
comment on: http://stackoverflow.com/a/25804603
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40394840
type: Comment
type: QuestionComment
has text: Perhaps, you inserted the records in a different DB session and forgot to `COMMIT` it?
comment on: http://stackoverflow.com/q/25821413
score: 0

http://stackoverflow.com/q/25789676
score: 1
has body: We have a requirment to connect to a JMS queue provided by an externally controlled IBM Websphere MQ server. Now, the easiest way to do it would be to include the Websphere MQ client into our application and just use the queue. But IBM was so far not able to tell me about possible licensing costs of this setup. I saw forum posts and hints on IBM download pages that using the client is free of charge, but I do not know for sure. Maybe it's even the case, that the owner of the MQ server is allowed to provide us the client jar to use it for connecting to them, but again, I don't know for sure. So I am evaluating the possibility to setup my own open source JMS server, for example an Apache ActiveMQ, and then bridge over to the Websphere MQ. For this, 2 questions rise up for me: Technical solution: How would that be done exactly? I read a bit about bridging between JMS providers and something about the Apache Camel project, but have so far no exact idea how much work this will be and what needs exactly to be done. Impacts: What should I bear in mind when implementing such a scenario? Do I still have to include the MQ client and such would not benefit over a direct connect? Are there any negative impacts compared to a direct connect that I must consider? Update: Our application is a Java EE 6 application running on a JBosss 7.1. Concerning the MQ server version I have no information yet. 2nd Update: The MQ server version is 6.5.
tagged with: java
has title: How to use Webshere MQ Server via ActiveMQ server and what to bear in mind?
type: Question
possible better answer: http://stackoverflow.com/a/25792100
accepted answer: http://stackoverflow.com/a/25791818
has answer: http://stackoverflow.com/a/25791686
upvote count: 1
has answer: http://stackoverflow.com/a/25791818
tagged with: jms
favorite count: 0
has answer: http://stackoverflow.com/a/25792100
tagged with: ibm-mq
answer count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: activemq-classic
has answer: http://stackoverflow.com/a/25796737

http://stackoverflow.com/comment/40296005
comment on: http://stackoverflow.com/a/25758925
type: AnswerComment
score: 0
type: Comment
has text: Thanks Ajan. Can the front-end code directly call the classes in the back-end project if they are deployed as 2 separate war files in a EAR? We use an in-house third party library/jar for authentication and spring security along with it for authorization. I am curious to know if I need to write any extra code for communication between front-end and back-end projects.

http://stackoverflow.com/a/25792069
has body: Click the button File System and find the DTD file in your hibernate jar files.The path is : hibernate3.jar\org\hibernate\hibernate-configuration-3.0.dtd I wish it could help you and if you still can not solve the problem try the JPA annotation instead of the XML file.
score: 0
has comment: http://stackoverflow.com/comment/40360755
answers question: http://stackoverflow.com/q/25789036
type: Answer

http://stackoverflow.com/a/25754843
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25754740
has body: Simply save the date when the question is shown Date start = new Date(); Do the same when an answer is received and then calculate the difference and parse it to seconds or minutes: long diff = start.getTime() - end.getTime(); long diffSeconds = diff / 1000 % 60; long diffMinutes = diff / (60 * 1000) % 60;

http://stackoverflow.com/q/25730606
tagged with: junit
downvote count: 0
has answer: http://stackoverflow.com/a/25731055
favorite count: 0
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25731055
type: Question
linked to: http://stackoverflow.com/q/4055022
has title: JUnit custom Rule to run only on Annotated methods
has body: I'm trying to create a custom rule in JUnit which only runs on test methods that I have a custom annotation on. The thing is I can't see a way to find out if the method wrapped in the Statement instance has the annotation set. I was thinking I could use reflection but how could I tell if the method in the Statement represents one of the annotated methods? Not really sure how to approach this. Thanks.
answer count: 1

http://stackoverflow.com/a/25806895
answers question: http://stackoverflow.com/q/25806271
score: 1
has body: if the number of protected URL patterns is small enough, you can register filter only for them, leaving /cmd/** out. Although it is not very nice solution. Additional possible solution could be to write our filter that will exclude specific URLs from filtering and for others it just call original filter. Make something like here. public void doFilter(ServletRequest request,ServletResponse response,FilterChain chain) throws IOException, ServletException { String url = request.getRequestURL().toString(); if (matchExcludePatterns(url)) { chain.doFilter(request, response); return; } // call your filter }
downvote count: 0
has comment: http://stackoverflow.com/comment/40468449
type: Answer
upvote count: 1

junit
tags question: http://stackoverflow.com/q/25849691
type: Tag
tags question: http://stackoverflow.com/q/25762707
tags question: http://stackoverflow.com/q/25786193
tags question: http://stackoverflow.com/q/25732548
tags question: http://stackoverflow.com/q/25761221
tags question: http://stackoverflow.com/q/25763338
tags question: http://stackoverflow.com/q/25759306
tags question: http://stackoverflow.com/q/25835727
tags question: http://stackoverflow.com/q/25858224
tags question: http://stackoverflow.com/q/25869884
tags question: http://stackoverflow.com/q/25857164
tags question: http://stackoverflow.com/q/25732200
tags question: http://stackoverflow.com/q/25793068
tags question: http://stackoverflow.com/q/25852781
tags question: http://stackoverflow.com/q/25748868
tags question: http://stackoverflow.com/q/25795512
tag name: junit
tags question: http://stackoverflow.com/q/25856210
tags question: http://stackoverflow.com/q/25783271
tags question: http://stackoverflow.com/q/25833570
tags question: http://stackoverflow.com/q/25798033
tags question: http://stackoverflow.com/q/25728317
tags question: http://stackoverflow.com/q/25845911
tags question: http://stackoverflow.com/q/25860528
tags question: http://stackoverflow.com/q/25718617
tags question: http://stackoverflow.com/q/25815565
tags question: http://stackoverflow.com/q/25761824
tags question: http://stackoverflow.com/q/25796243
tags question: http://stackoverflow.com/q/25790438
tags question: http://stackoverflow.com/q/25719201
tags question: http://stackoverflow.com/q/25720758
tags question: http://stackoverflow.com/q/25759045
tags question: http://stackoverflow.com/q/25803121
tags question: http://stackoverflow.com/q/25730606
tags question: http://stackoverflow.com/q/25723026
tags question: http://stackoverflow.com/q/25821456
tags question: http://stackoverflow.com/q/25759102
tags question: http://stackoverflow.com/q/25865313
tags question: http://stackoverflow.com/q/25794258
tags question: http://stackoverflow.com/q/25795313
tags question: http://stackoverflow.com/q/25726545

http://stackoverflow.com/comment/40456568
comment on: http://stackoverflow.com/a/25853646
score: 0
type: Comment
has text: Yes! This was the problem. Thank you so much for the help!
type: AnswerComment

http://stackoverflow.com/comment/40233624
comment on: http://stackoverflow.com/q/25733347
score: 0
type: Comment
type: QuestionComment
has text: What error does it give you?

http://stackoverflow.com/comment/40448098
comment on: http://stackoverflow.com/q/25851017
type: Comment
has text: http://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CCAQFjAA&url=http%3A%2F%2Fwww.mkyong.com%2Fjava%2Fhow-to-modify-date-time-date-manipulation-java%2F&ei=Gv8WVOitDoKWyATEnIDICw&usg=AFQjCNGZ9vMlqiW0kf6ISm4gG7vVMsB9yA&sig2=1DRSP5JOcmJC8lM0BvOG-A&bvm=bv.75097201,d.aWw
type: QuestionComment
score: 0

http://stackoverflow.com/a/25823515
has comment: http://stackoverflow.com/comment/40398151
type: Answer
answers question: http://stackoverflow.com/q/25823464
has comment: http://stackoverflow.com/comment/40398067
score: 0
has body: Any reason for this? Because firstPendingIntent == secondPendingIntent. If there already is a PendingIntent matching your request, getBroadcast() returns the existing PendingIntent. FLAG_UPDATE_CURRENT says to replace the extras in the Intent wrapped inside the PendingIntent. In one of your two getBroadcast() calls, replace 0 with some other number, to get distinct PendingIntent objects. Also, I recommend that you replace getBaseContext() and getApplicationContext() with this. Only use getBaseContext() and getApplicationContext() when you know precisely why you are using them.

http://stackoverflow.com/a/25730934
type: Answer
has body: Add "OrderedPair." in front of all these variables public static void main(String[] args){ System.out.println(OrderedPair.c1.toString()); System.out.println(OrderedPair.c2.toString()); System.out.println(OrderedPair.c3.toString()); System.out.println(OrderedPair.c4.toString()); System.out.println(OrderedPair.c5.toString()); }
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/40228682
downvote count: 1
answers question: http://stackoverflow.com/q/25730881
has comment: http://stackoverflow.com/comment/40229912

http://stackoverflow.com/q/25720479
has comment: http://stackoverflow.com/comment/40210222
tagged with: maven
has answer: http://stackoverflow.com/a/25723513
has comment: http://stackoverflow.com/comment/40211026
has comment: http://stackoverflow.com/comment/40211196
tagged with: java
tagged with: eclipse
type: Question
score: 0
answer count: 1
has title: Error: Class in different directory than declared
has comment: http://stackoverflow.com/comment/40209262
has body: I am working in Rational Clear case. When I import maven project in my local system fom clear case and install, it installs successfully and all the java classes are compiling. When I try to work directly from clear case in Eclipse, and I try to install the same project, I get error in compiling all the java classes. Few lines of Error: Error building bundle &lt;groupId&gt;:&lt;artifactId&gt;:bundle:2.1.6 : Class in different directory than declared. Path from class name is services/helper/impl/DefaultDroolsHelper.class but the path in the jar is services/helper/impl/defaultdroolshelper.class from Jar:dot [ERROR] Error building bundle &lt;groupId&gt;:&lt;artifactId&gt;:bundle:2.1.6 : Class in different directory than declared. Path from class name is services/helper/impl/DefaultDroolsHelperFactory.class but the path in the jar is services/helper/impl/defaultdroolshelperfactory.class from Jar:dot [ERROR] Error(s) found in bundle configuration [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 52.422s [INFO] Finished at: Mon Sep 08 04:23:29 EDT 2014 [INFO] Final Memory: 15M/49M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.4:bundle (default-bundle) on project wss-services: Error(s) found in bundle configuration -&gt; [Help 1] After installation, in target folder, the two list are generated: createdfiles.lst entities\output\clientenrichmenttype$clienttrader.class entities\output\dateadjustmenttype.class entities\dtcc\valuation\output\collateralizedtype.class entities\triresolve\output\objectfactory.class But inputfiles.lst: entities\dtcc\leireplay\output\SecoryAssetClassType.java entities\dtcc\valuation\output\VerificationType.java entities\dtcc\leireplay\output\package-info.java entities\output\BlockTradeOrAllocationL…
type: UnansweredQuestion

http://stackoverflow.com/q/25844499
type: Question
tagged with: python
score: 0
has comment: http://stackoverflow.com/comment/40437945
has comment: http://stackoverflow.com/comment/40437477
tagged with: java
has title: Jython error in eclipse ImportError: No module named java.lang.InterruptedException :
type: UnansweredQuestion
tagged with: eclipse
has body: I am using Jython 2.5.3 version to integrate my python scripts with java. But while running the script I am getting an error while importing any java class. For example: File "C:\Jython.2.3\Lib\threading.py", line 1, in \r\n import java.lang.InterruptedException\r\n ImportError: No module named java.lang.InterruptedException\r\n') I tried looking for a solution and found a command clspack --auto, but that also didn't work for me. The use case is simple : I have a python file which has an import statement from java.lang import InterruptedException I have, installed jython 2.5.3. And I have setup the interprater as Pydev->Interpraters->Jython Interprater->path/to/jython.jar PS:When I run jython from command line I can import the java modules, wihout any problem. The problem only occurs while using eclipse. Any kind of help is appreciated. Thanks in advance.
tagged with: jython
answer count: 0
has comment: http://stackoverflow.com/comment/40437360
tagged with: importerror

http://stackoverflow.com/comment/40264700
type: QuestionComment
has text: Yeah Ok,May be my input would be confusing you.Let me explain you.
score: 0
comment on: http://stackoverflow.com/q/25750368
type: Comment

http://stackoverflow.com/q/25790952
has comment: http://stackoverflow.com/comment/40338057
tagged with: php
has comment: http://stackoverflow.com/comment/40343135
answer count: 0
has title: Java HttpsURLConnection reuse
upvote count: 1
type: Question
score: 1
tagged with: java
has body: What am I trying to achieve: I have a piece of Java code that's meant to connect to a web server in HTTPS. I want to use JVM's built-in HttpsURLConnection only. The intention is to keep the http connection open for an authenticated user and keep sending and receiving GET/POST requests. Once authenticated, all GET/POST requests will have the same PHP session ID I received from piece of php code at the web server. That PHP is actually the one that takes in the requests from my java app, processes (DB handling) and outputs in XML to my client for my better data handling. The Problem: I need to keep the same HttpsURLConnection open for the URL (since all requests are going to the same documentroot) and keep changing the parameters in the GET as I move along the client application. But as HTTP is intended to serve only one request at a time, I do not get to resend data without reinitializing the HttpsURLConnection. In that case, my session ID gets changed (because of obvious reasons of new HTTP connection) and I end up nowhere. Below is the piece of code I crafted out of my main app to clarify what I did (please disregard braces close): try{ URL url = new URL("https://localhost:8443/?type=login&amp;username=testu&amp;password=testp"); HttpsURLConnection conn = (HttpsURLConnection)(url).openConnection(); conn.setDoInput(true); conn.setDoOutput(true); conn.setRequestProperty("Connection","Keep-Alive"); System.out.println("Connecting..."); conn.connect(); System.out.println("Response: " + conn.getResponseCode()); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); System.out.println("" + in.readLine()); url = new URL("https://localhost:8443/?type=login&amp;username=testu1&amp;password=testp1"); conn = (HttpsURLConnection)url.openConnection(); conn.setDoInput(true); conn.setDoOutput(true); BufferedWriter out = new BufferedWriter(new OutputStreamWriter(conn.getOutputStream())); System.out.println("Connecting..." + conn.getRequestMethod()); in…
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40402361
type: UnansweredQuestion

http://stackoverflow.com/q/25748147
upvote count: 0
has comment: http://stackoverflow.com/comment/40260508
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/25748289
has comment: http://stackoverflow.com/comment/40260530
has answer: http://stackoverflow.com/a/25748588
has answer: http://stackoverflow.com/a/25748902
has title: How to search max and min values in java
has answer: http://stackoverflow.com/a/25749248
has answer: http://stackoverflow.com/a/25748217
possible better answer: http://stackoverflow.com/a/25748217
score: -4
has answer: http://stackoverflow.com/a/25748212
has body: I coded a simple calculation and I need to know whether the code can be made more short and simple. And I need to get the max price and min price values too. public class pro { public static void main(String args[]) { Scanner sc = new Scanner(System.in); System.out.print("Enter price : "); int val1 = sc.nextInt(); System.out.print("Enter price : "); int val2 = sc.nextInt(); System.out.print("Enter price : "); int val3 = sc.nextInt(); System.out.print("Enter price : "); int val4 = sc.nextInt(); System.out.print("Enter price : "); int val5 = sc.nextInt(); System.out.print("Total amount : " +(val1+val2+val3+val4+val5)); } }
has comment: http://stackoverflow.com/comment/40260474
linked to: http://stackoverflow.com/q/19671453
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40260504
accepted answer: http://stackoverflow.com/a/25749248
tagged with: java
type: Question
downvote count: 4

http://stackoverflow.com/comment/40361202
score: 0
comment on: http://stackoverflow.com/q/25803182
has text: I dont see any call to `loadText()` in class `Update`
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25775371
type: Answer
upvote count: 13
has comment: http://stackoverflow.com/comment/40337003
score: 13
downvote count: 0
has comment: http://stackoverflow.com/comment/40338145
has body: I think resource locators should do the job. In general they're re-locating the request to a different resource, which is able to consume it. In your case You'll have one root resource UserResource, which will handle users and sub-resources for cars, messages - CarsResource, MessagesResource. The root resource: @Path("users") class UsersResource { // GET: /users @GET @Path("{id}") public User getById(@PathParam("id") long id) {...} @Path("{id}/cars") public CarResource getCarResource(@PathParam("id") long userId) { return new CarResource(uesrId); } @Path("{id}/sendMessage") public MessagesResource getMessagesResourceForSend(@PathParam("id") long userId) { return new MessagesResource(userId); } @Path("{id}/messages") public MessagesResource getMessagesResourceForRead(@PathParam("id") long userId) { return new MessagesResource(userId); } } Cars and Messages resources: class CarsResource { long userId // GET: /users/123/cars @GET public Car getAllCars() { /*retrieve all cars for user userId*/ } // GET: /users/123/cars/3 @GET @Path("{carId}") public Car getById(@PathParam("carId") carId) { /*retrieve car for id carId*/ } } class MessagesResource { long userId // POST: /users/123/sendMessage @POST public void sendMessage(@FormParam("content") String content) { /*send message to user userId*/ } // GET: /user/123/messages/123/from/123/unread @GET @Path("{id1}/from/{id2}/unread") public void getUnread(@PathParam("id1") long id1, @PathParam("id2") long id2) { /*return unread messages*/ } } Sub-resources shouldn't be annotated with @Path on class level and they need to be registered with the JAX-RS runtinme in an Application class
answers question: http://stackoverflow.com/q/25755130

http://stackoverflow.com/q/25852516
answer count: 1
has comment: http://stackoverflow.com/comment/40451137
tagged with: hashmap
has comment: http://stackoverflow.com/comment/40451056
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25852678
has comment: http://stackoverflow.com/comment/40451388
has title: IdentityHashMap NullPointerException
has comment: http://stackoverflow.com/comment/40451421
has comment: http://stackoverflow.com/comment/40451247
has comment: http://stackoverflow.com/comment/40451350
has comment: http://stackoverflow.com/comment/40451268
has body: I came across a problem. I used a IdentityHashMap. I put these entries in it {150=1, 79=3, 345=6, 88=5, 50=4, 3=7, 24=2}.when the keys are 50, 150, I try to get their values. but I got java.lang.NullPointerException. I don't know why. please help me fix it. thank you very much. here is my code: import java.util.IdentityHashMap; import java.util.Arrays; public class HelloWorld { public static int[] twoSum(int[] numbers, int target) { int[] result = new int[2]; if (numbers == null || numbers.length &lt; 2) { return result; } IdentityHashMap&lt;Integer, Integer&gt; map = new IdentityHashMap&lt;Integer, Integer&gt;(); for (int i = 0; i &lt; numbers.length ; i++) { map.put(numbers[i], i+1); } Arrays.sort( numbers ); int head = 0; int tail = numbers.length - 1; while (head &lt; tail) { if (numbers[head] + numbers[tail] == target) { result[0] = map.get( numbers[head] ); result[1] = map.get( numbers[tail]i ); return result; } else if (numbers[head] + numbers[tail] &lt; target) { head++; } else { tail--; } } return result; } public static void main(String[] args) { int[] sorce = {150,24,79,50,88,345,3}; twoSum(sorce, 200); } }
has comment: http://stackoverflow.com/comment/40451226
favorite count: 0
tagged with: nullpointerexception
type: Question
linked to: http://stackoverflow.com/q/25804499
has comment: http://stackoverflow.com/comment/40451069
score: -1
has comment: http://stackoverflow.com/comment/40451087
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/40451162

http://stackoverflow.com/q/25829870
tagged with: java
has answer: http://stackoverflow.com/a/25833671
linked to: http://stackoverflow.com/q/8421007
type: Question
upvote count: 2
answer count: 2
downvote count: 1
has title: Get source of data in clipboard
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has body: How can I know what is the source of data in clipboard? For example when I copy something from Firefox to clipboard I want to get that the source is Firefox. Is there any command to do that in Linux? Or is there a way to do that in Java? Also, is there any way to track were the user pasted the data. I want to detect if for example the user try to copy important data from organization's system, then s/he try to paste it some where else. Thanks in advance for any help (:
has answer: http://stackoverflow.com/a/25848671
tagged with: clipboard
score: 1

http://stackoverflow.com/q/25853786
has comment: http://stackoverflow.com/comment/40453657
type: Question
has answer: http://stackoverflow.com/a/25853957
answer count: 1
has title: Maven 2 projects depend on one another
score: 0
has body: I have 2 projects, employees and data. The projects represent entities linked to my db. Each employee has a field linked to a table in data and so my employee pom.xml has a dependency for data. My problem resides here, every data is inserted by an employee and so data also has a dependency on employees. This results in a bi-directional dependency. Is this possible in maven? My understanding of maven is that this would cause problems. project employees @Entity @Table(name="employees", uniqueConstraints= { @UniqueConstraint(columnNames="idEmployees"), @UniqueConstraint(columnNames="idCardNumber"), @UniqueConstraint(columnNames="niNumber") }) public class Employee { @Id @GeneratedValue @Column(unique=true, nullable=false, updatable=false) private int idEmployees; //other class variables @ManyToOne(cascade=CascadeType.PERSIST, fetch=FetchType.LAZY) @JoinColumn(name="niCategoryId", nullable=false, updatable=false) private NIData niCategory; //constructors getter and setters } data project @Entity @Table(name="nidata", uniqueConstraints= { @UniqueConstraint(columnNames="idNiData") }) public class NIData { @Id @GeneratedValue @Column(unique=true, nullable=false, updatable=false) private int idNiData; //other class variables @ManyToOne(cascade=CascadeType.PERSIST, fetch=FetchType.LAZY) @JoinColumn(name="createdEmployeeId", nullable=false, updatable=false) private Employee createdEmployee; //constructors getter and setters } As you can see they depend on each other but I want them in different projects as they belong to different schemas. Also I plan to add other schemas that I may not want to expose in every part of the system I am designing but only parts of it.
accepted answer: http://stackoverflow.com/a/25853957
tagged with: maven
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25735429
favorite count: 0
type: UnansweredQuestion
downvote count: 0
score: 1
has body: byte[] b = new byte[buffLent]; // buffLent = 10000 len = readerIn.read(b); //InputStream System.out.println("FIRST BYTE: " + b[0]); System.out.println("SECOND BYTE: " + b[1]); System.out.println("THIRD BYTE: " + b[2]); if(b[0] == 0x82) { //its binary } in this code I can detect the begining of binary data, if the file is small then I can read it fully, but if its too big, then it splits into parts, which hex code I should use to detect the continuation of binary data? cause as I tested it, the first byte becomes a length of current frame, so here I'am stucked, any ideas please?
tagged with: java
type: Question
tagged with: javascript
has answer: http://stackoverflow.com/a/25745845
upvote count: 1
tagged with: http://stackoverflow.com/tag/html
answer count: 1
tagged with: websocket
has title: WebSockets how to identify binary data continuation frame?

http://stackoverflow.com/comment/40361851
type: Comment
type: QuestionComment
score: 0
has text: @B.Dalton well thats normal. but what surprised me is everyone in the class post the homework at StackOverflow?
comment on: http://stackoverflow.com/q/25803521

http://stackoverflow.com/comment/40211838
type: AnswerComment
comment on: http://stackoverflow.com/a/25721259
type: Comment
score: 0
has text: i think your not creating the folder , 1st create the folder and then write file, i have updated the code , check it

http://stackoverflow.com/q/25722262
has answer: http://stackoverflow.com/a/39974434
tagged with: opennlp
tagged with: nlp
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/39974434
tagged with: java
has answer: http://stackoverflow.com/a/25722404
has title: Apache OpenNLP, how to train or made new model?
type: Question
possible better answer: http://stackoverflow.com/a/25722404
linked to: http://stackoverflow.com/q/19397291
has body: For example en name finder does not find some names, and I want to add new data to existing data model. I found this click here answer, but I do not understand what is en-ner-person.train ? is it clone of en-ner-person.bin? We should load existing model and add new data from file? What type of info should contain txt file?
score: 0
answer count: 2

http://stackoverflow.com/q/25828401
downvote count: 0
has body: I have the following manifest in a jar file: Manifest-Version: 1.0 Ant-Version: Apache Ant 1.9.3 Created-By: 1.7.0_67-b01 (Oracle Corporation) Main-Class: tld.project.Example Name: tld/project Specification-Title: Example Specification-Version: 1.0 Specification-Vendor: Me Implementation-Title: tld.project Implementation-Version: 20140913 Implementation-Vendor: Me I use the following to read some attributes from the manifest at runtime: // Try and load the Jar manifest as a resource stream. InputStream manInputStream = Example.class.getResourceAsStream("/META-INF/MANIFEST.MF"); if (manInputStream != null) { // Try and extract a version string from the Manifest. Manifest manifest = new Manifest(manInputStream); Attributes attributes = manifest.getAttributes("tld/project"); Why does the above code set attributes to null, but only on OS X? (1.7.51) If I check manifest.getEntries().size() it also returns zero, but again, this works as expected on Windows and Linux. Any ideas?
has comment: http://stackoverflow.com/comment/40407177
accepted answer: http://stackoverflow.com/a/25828985
has title: Reading a Jar's Manifest on OS X
answer count: 1
tagged with: macos
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25828985
score: 1
tagged with: java
type: Question

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

http://stackoverflow.com/q/25866361
type: Question
has comment: http://stackoverflow.com/comment/40476005
score: -1
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40476536
favorite count: 0
has comment: http://stackoverflow.com/comment/40476015
has comment: http://stackoverflow.com/comment/40476030
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40476420
tagged with: android
has body: I am creating an app where there is a button on the action bar called About. It should link to an activity by the same name through intent method. But its not working. public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity_actions, menu); return true; } public boolean onOptionItemSelected(MenuItem item){ switch(item.getItemId()){ case R.id.About: Intent i = new Intent(this, About.class); startActivity(i); return true; default: return super.onOptionsItemSelected(item); } } this is the java code, declaring the action to do when the user clicks on action bar button. The XML code that creates the button is as follows: <?xml version="1.0" encoding="utf-8"?> <item android:id="@+id/About" android:orderInCategory="100" android:showAsAction="always" android:title="About"/> The menu button is being created and it is clickable, but no event is taking place. The content of my android manifest file is: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="18" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> / <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.ted.MainActivity" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.ted.DisplayMessageActivity" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.ted.MainActivity" /> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value="com.example.ted.MainActivity" />
tagged with: android-intent
has answer: http://stackoverflow.com/a/25866839
has title: Intent not working in android menu bar
tagged with: java
has comment: http://stackoverflow.com/comment/40475918
downvote count: 1

http://stackoverflow.com/comment/40392320
has text: This looks really good, but I'm not that advanced (Sorry) and changed my mind of the whole Try catch it looks easier than this complicated code. But thanks anyways :)
comment on: http://stackoverflow.com/a/25820057
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40262139
has text: Just to make sure these 2 lines: SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE); sharedPreference.edit().putInt(KEY, v.getId()).commit(); are in the OnClick methodand where shouldI type the other 2 Lines
comment on: http://stackoverflow.com/a/25735780
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40429397
has text: try viewpager for your use
comment on: http://stackoverflow.com/q/25840405
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/40214038
comment on: http://stackoverflow.com/a/25720797
has text: That is really weird. Look, in case Hibernate is mapped properly, this simple scenario is working always. So, check my answer and doc, compare it with what you really do have (DB vs mapping). This is very easy scenario... (having many of these mappings)
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25791901
has body: Divide by 10 (243/10 = 24.3) Put this in an int, multiply by 10. (24*10 = 240) Do this for all values and you should have the correct value
answers question: http://stackoverflow.com/q/25791843
score: 0
type: Answer

http://stackoverflow.com/q/25857241
tagged with: javafx
has body: I am sorry if this is a trivial problem that I am having, but I cannot figure this out. I am using two Scanners inside a Initialize method in JavaFX Controller class. First one uses comma as delimiter, and it works fine. The other one uses dot as delimiter and has a String as stream. That other one won't work. Is there a problem with dot as delimiter? I am getting NumberFormatException at line where I declare int day. My input format example from file ponude.txt is Kontiki, Kusadasi, 26.06.2013. import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.net.URL; import java.util.ArrayList; import java.util.ResourceBundle; import java.util.Scanner; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.RadioButton; import javafx.scene.control.TextArea; import javafx.scene.control.TextField; public class FormController implements Initializable{ ArrayList&lt;Ponuda&gt; ponude = new ArrayList&lt;Ponuda&gt;(); @FXML Button bt1; @FXML RadioButton rb1; @FXML RadioButton rb2; @FXML TextArea ta1; @FXML TextField tf1; @FXML private void bt1Click(){ } @Override public void initialize(URL arg0, ResourceBundle arg1) { File file = new File("ponude.txt"); BufferedReader br=null; try { br=new BufferedReader(new FileReader(file)); } catch (FileNotFoundException e) { e.printStackTrace(); } String trL = null; try { trL = br.readLine(); } catch (IOException e) { e.printStackTrace(); } while(trL!=null){ Scanner sc=new Scanner(trL); sc.useDelimiter(","); String agency=sc.next().trim(); String destination=sc.next().trim(); Scanner scInner = new Scanner(sc.next()); scInner.useDelimiter("."); int day=Integer.parseInt(scInner.next().trim()); int month=Integer.parseInt(scInner.next().trim()); int year=Integer.parseInt(scInner.next().trim()); //System.out.println(scInner.next().toString()); Datum datum; try { trL= br.readLine(); }…
has title: Using Scanner in Initialize method in JavaFX
answer count: 1
has answer: http://stackoverflow.com/a/25857277
score: 0
tagged with: java.util.scanner
accepted answer: http://stackoverflow.com/a/25857277
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40399293
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25823689
has text: @ItachiUchiha Well.. to be honest I'm not sure of the implementation myself, I'm a novice when it comes to the TableView! It's just that I have over 2000 icons, and a ListView wasn't practical enough to display them.. so now I am attempting to display them in a TableView that has a visible width of "8 icons" and height of "5 icons". This is fixed, and all icons are the same size. I don't need any dynamic resizing. But I can't quite figure out how to lay them out in to the table structure. Using simply setItems() just sets the the icons for ALL 8 columns (duplicated).

http://stackoverflow.com/q/25784561
linked to: http://stackoverflow.com/q/130794
has comment: http://stackoverflow.com/comment/40327185
favorite count: 0
type: UnansweredQuestion
downvote count: 1
type: Question
tagged with: oop
has comment: http://stackoverflow.com/comment/40327049
has body: Currently I have made a class named "FundamentalClass" which contains all the methods and Database related objects. Now I have about 15 different JFrame forms and all these forms are calling and initializing the FundamentalClass when they are opened so that I can access its methods and properties like this FundamentalClass con = new FundamentalClass(); I just wanted to know that is it the correct way of initializing class in each form when it is opened or there is another better way because in this procedure whenever the form is opened every time it initializes FundamentalClass which have a lot of methods. I have a MainScreen form which have menus to call these 15 forms. Will it be a better idea to call and initialize FundamentalClass in MainScreen form and pass its object in every JFrame form? Guys I am not a OOP Expert so please suggest me what would you do if you had 15 forms and all these forms had to call such class? And these forms are opened through the Menus of MainScreen.
tagged with: java
score: -1
tagged with: forms
tagged with: class
has answer: http://stackoverflow.com/a/25784962
upvote count: 0
answer count: 1
has title: Correct way of Initializing and calling class object on each form in java

http://stackoverflow.com/a/25712964
score: 2
has comment: http://stackoverflow.com/comment/40194775
has comment: http://stackoverflow.com/comment/40194865
downvote count: 0
has comment: http://stackoverflow.com/comment/40194753
upvote count: 2
has body: You cant do that in this way, because you cant override static methods. What you can do is that you create a BaseService class which do this job. snippet: public class BaseService { .... public static Base instantiate(Class&lt;? extends Base&gt; clazz) { //create the new instance based upon the parameter } } in main: Base base = BaseService.instantiate(Sub1.class); or if you want the Sub1 instance as a Sub1 typed variable, you should cast.
has comment: http://stackoverflow.com/comment/40194819
has comment: http://stackoverflow.com/comment/40195296
answers question: http://stackoverflow.com/q/25712896
type: Answer

http://stackoverflow.com/comment/40341845
comment on: http://stackoverflow.com/q/25773370
score: 0
type: Comment
type: QuestionComment
has text: @jgr208 didn't know there is another commons-configuration than the apache one.

http://stackoverflow.com/a/25857846
has comment: http://stackoverflow.com/comment/40467275
has comment: http://stackoverflow.com/comment/40475545
has body: If you don't set a message factory, ParameterizedMessageFactory is used by default. By default, log4j uses a message factory for parameterized messages, so you can do logger.warn("hello {}", user.getName()); You set your own factory by calling LogManager.getLogger(name, messageFactory) when you obtain a logger. If you want the String.format kind of params (the System.out.printf format) you would use LogManager.getLogger(MyClass.class, new StringFormatterMessageFactory()) to obtain a logger. If your most common usage is parameterized messages (the {} format), but if you occasionally want more control over the output format as afforded by the string formatter, you can declare your logger normally (so it uses {} parameterized messages), and use the Logger.printf methods. Example: class MyClass { private static Logger logger = LogManager.getLogger(MyClass.class); public void someMethod() { // use printf here to precisely control the number of digits displayed logger.printf(Level.INFO, "pi: %.5f", Math.PI); } } This is all in code. Configuration (XML or otherwise) is not involved.
type: Answer
has comment: http://stackoverflow.com/comment/40472919
accepted answer of: http://stackoverflow.com/q/25845120
answers question: http://stackoverflow.com/q/25845120
score: 15
upvote count: 15
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40912313
type: Comment
has text: After looking at your code changes I think you made a mistake. From what I see your while loop only runs one time and is basically doing nothing. Your code is doing exactly the same thing. The total is set to 0 at the start of the loop. so when you do data.length-total your setting it to data.length-0 so you don't need the white loop as your only running the read() one time.
score: 0
comment on: http://stackoverflow.com/a/25716154
type: AnswerComment

http://stackoverflow.com/comment/40240066
has text: You used ImageButton in xml file but in code you used only Button not ImageButton.Replace it.ImageButton button = (ImageButton)findViewById(R.id.imageButton13);
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25736566

http://stackoverflow.com/comment/77500868
type: Comment
has text: @I Am Batman Well the probability of getting the same random number is negligible. If you want to use non-random IDs it might help but you still have to make sure the user doesn't use the same tag.
type: AnswerComment
comment on: http://stackoverflow.com/a/42159687
score: 0

http://stackoverflow.com/q/25777129
tagged with: java
has answer: http://stackoverflow.com/a/25793350
type: Question
score: 0
has title: Possible reasons for EntityNotFoundException
answer count: 1
has body: Under what circumstances could a get() in Google AppEngine throw an EntityNotFoundException? Does it truly only happen if the requested key does not exist in the datastore at the time of the request, or could it also happen because of some other issue during the call, like for example a time-out? In other words, if I start a new transaction and a get() in that transaction throws an EntityNotFoundException, can I be 100% certain that a put() in that same transaction will never overwrite some already existing entry, that the get() somehow missed? To add some code: private Entity getOrCreate(Key key, String initialData) { DatastoreService datastore = DatastoreServiceFactory.getDatastoreService(); Transaction txn = datastore.beginTransaction(); try { Entity result; try { // Try to read existing entity result = datastore.get(key); } catch (EntityNotFoundException e) { // If entity is not found, create and put a new one result = new Entity(key); result.setProperty("data", initialData); datastore.put(result); // Could this EVER overwrite an existing entity? } txn.commit(); return result; } finally { if (txn.isActive()) txn.rollback(); } } Could this code ever overwrite an existing entity by accident due to some mechanism that leads to the EntityNotFoundException other than this entity truly not existing?
type: UnansweredQuestion
tagged with: google-app-engine

http://stackoverflow.com/q/25855536
tagged with: data-structures
accepted answer: http://stackoverflow.com/a/25855570
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/40456890
possible better answer: http://stackoverflow.com/a/25855575
has answer: http://stackoverflow.com/a/25855575
has comment: http://stackoverflow.com/comment/40457032
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25855601
tagged with: if-statement
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/50257428
tagged with: set
has body: public static void main(String[] args) { Map&lt;String, HashSet&lt;String&gt;&gt; test = new HashMap&lt;String, HashSet&lt;String&gt;&gt;(); test.put("1", new HashSet&lt;String&gt;()); System.out.println(test); System.out.println(test.get("1")); if(test.get("1") == null){ System.out.println("Hello world"); } } The first println gets me {1=[]} The second one gets me [] I am trying to print out "Hello world" but the if statement isn't going through. Is the empty HashSet, [] not equal to null? How do I use the empty HashSet in this if statement?
type: Question
has title: How to use java empty HashSet in if-statement?
has answer: http://stackoverflow.com/a/25855570
score: 5
downvote count: 0
tagged with: hashset

http://stackoverflow.com/q/25784568
type: Question
score: 4
tagged with: jta
upvote count: 4
tagged with: optimistic-locking
has comment: http://stackoverflow.com/comment/42018617
has title: OptimisticLockingFailureException updating step execution after commit failure in Spring Batch
downvote count: 0
favorite count: 0
tagged with: spring-batch
has comment: http://stackoverflow.com/comment/49484150
linked to: http://stackoverflow.com/q/17680863
tagged with: spring
has body: I am performing some integration testing for my application in which I am trying to force an exception whenever there is an update/insert happening in the database. Whenever any exception thrown due to this the Spring batch step hangs with the below exception Caused by: org.springframework.dao.OptimisticLockingFailureException: Attempt to update step execution id=10657 with wrong version (1), where current version is 2 at org.springframework.batch.core.repository.dao.JdbcStepExecutionDao.up dateStepExecution(JdbcStepExecutionDao.java:185) at org.springframework.batch.core.repository.support.SimpleJobRepository .update(SimpleJobRepository.java:171) at sun.reflect.GeneratedMethodAccessor227.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti on(AopUtils.java:317) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJo inpoint(ReflectiveMethodInvocation.java:183) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:150) at org.springframework.transaction.interceptor.TransactionInterceptor$1. proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport. invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.in voke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:172) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami cAopProxy.java:204) at $Proxy74.update(Unknown Source) at org.springframework.batch.core.job.flow.JobFlowExecutor.abandonStepEx ecution(JobFlowExecutor.java:76) at org.springframework.batch.core.job.flow.support.state.StepState.handl e(StepState.java:59) at org.…
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/36185628
answers question: http://stackoverflow.com/q/25729319
upvote count: 5
has body: Using reflection to access a private field in the system class loader instance presents several problems: The accession can be forbidden by a security manager The solution is implementation dependent Another solution less "intrusive" is: For a given classloader enumerate all the manifest available cl.getResources("META-INF/MANIFEST.MF"). These manifests can be of jars managed by the current class loader or its ascendants classloaders. Do the same for its parent classloader Return the set of jars of those manifest in (1) but not in (2) The only requirement for this method to work is that jars in the classpath must have a manifest in order to be returned (not much to ask). /** * Returns the search path of URLs for loading classes and resources for the * specified class loader, including those referenced in the * {@code Class-path} header of the manifest of a executable jar, in the * case of class loader being the system class loader. * &lt;p&gt; * Note: These last jars are not returned by * {@link java.net.URLClassLoader#getURLs()}. * &lt;/p&gt; * @param cl * @return */ public static URL[] getURLs(URLClassLoader cl) { if (cl.getParent() == null || !(cl.getParent() instanceof URLClassLoader)) { return cl.getURLs(); } Set&lt;URL&gt; urlSet = new LinkedHashSet(); URL[] urLs = cl.getURLs(); URL[] urlsFromManifest = getJarUrlsFromManifests(cl); URLClassLoader parentCl = (URLClassLoader) cl.getParent(); URL[] ancestorUrls = getJarUrlsFromManifests(parentCl); for (int i = 0; i &lt; urlsFromManifest.length; i++) { urlSet.add(urlsFromManifest[i]); } for (int i = 0; i &lt; ancestorUrls.length; i++) { urlSet.remove(ancestorUrls[i]); } for (int i = 0; i &lt; urLs.length; i++) { urlSet.add(urLs[i]); } return urlSet.toArray(new URL[urlSet.size()]); } /** * Returns the URLs of those jar managed by this classloader (or its * ascendant classloaders) that have a manifest * @param cl * @return */ private static URL[] getJarUrlsFromManifests(ClassLoader cl) { try { Set&lt;URL&gt; urlSet …
downvote count: 0
score: 5
type: Answer

http://stackoverflow.com/comment/40324255
type: Comment
type: QuestionComment
has text: I have never used JFileChooser in my life, but one quick look at the javadocs gives a hint to this answer immediately
comment on: http://stackoverflow.com/q/25782707
score: 0

http://stackoverflow.com/q/25830693
favorite count: 0
has comment: http://stackoverflow.com/comment/40411257
has comment: http://stackoverflow.com/comment/40418000
possible better answer: http://stackoverflow.com/a/25830797
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25830705
score: 1
tagged with: java
upvote count: 1
has body: I have a text and I want to replace variables in it with proper values and my variables located between two @. When I use [/(?m)@.*?@/] to get these texts it also returns texts before and after first and last @. how could I get texts only between these two @ sign. thanks in advance. I use String.split(&quot;&quot;) method in Java. for example I want use on the following String: this is @the best@ possible way @t@o do result!!! and I wanna get these two results: the best t
type: Question
has title: regular expression text between two sign
answer count: 2
has comment: http://stackoverflow.com/comment/40411174
downvote count: 0
accepted answer: http://stackoverflow.com/a/25830705
tagged with: regex
has answer: http://stackoverflow.com/a/25830797

http://stackoverflow.com/a/25775496
accepted answer of: http://stackoverflow.com/q/25772992
answers question: http://stackoverflow.com/q/25772992
score: 0
type: AcceptedAnswer
has body: OK, so this took a bunch of hacking. First use add ant-contrib to your ant you can download it from here. Then I declared a var instead of a property in my main ant script. In the compile macro I've passed it to the javac as the classpath. After the compile is done, I've appended the new classes output folder to the classpath var and called the next compile. Good luck. The compile script: &lt;?xml version="1.0"?&gt; &lt;project name="PDF Test Client" default="main" basedir="."&gt; &lt;taskdef resource="net/sf/antcontrib/antlib.xml" /&gt; &lt;macrodef name="Compile"&gt; &lt;attribute name="ProjectName" default=" -- set aname to a 'ProjectName' property --" /&gt; &lt;attribute name="ProjectRootDir" default="." /&gt; &lt;attribute name="SourceDir" default="@{ProjectRootDir}/src" /&gt; &lt;attribute name="OutputDir" default="@{ProjectRootDir}/output" /&gt; &lt;attribute name="BuildDir" default="@{OutputDir}/bin" /&gt; &lt;attribute name="ClassesDir" default="@{BuildDir}/classes" /&gt; &lt;sequential&gt; &lt;echo message="Compiling... @{ProjectName}" /&gt; &lt;mkdir dir="@{ClassesDir}" /&gt; &lt;javac srcdir="@{SourceDir}" destdir="@{ClassesDir}" classpath="${ClassPathFolders}" includeantruntime="true" /&gt; &lt;var name="ClassPathFolders" value="${ClassPathFolders}; @{ClassesDir}" /&gt; &lt;echo message="-" /&gt; &lt;/sequential&gt; &lt;/macrodef&gt; &lt;target name="main"&gt; &lt;/target&gt; &lt;/project&gt;
type: Answer

http://stackoverflow.com/a/25765657
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25765559
score: 1
downvote count: 0
has body: This should work: int i = 0; for(Objectclass p : Test) { i++; System.out.println(i + ". Name: " + p.getName() + " Number: " + p.getNumber()); } Sadly, there is no way of extracting an iteration index from an enhanced for-loop.

user-interface
tags question: http://stackoverflow.com/q/25840267
tags question: http://stackoverflow.com/q/25729804
tags question: http://stackoverflow.com/q/25868376
tags question: http://stackoverflow.com/q/25728363
tags question: http://stackoverflow.com/q/25769702
type: Tag
tags question: http://stackoverflow.com/q/25755181
tags question: http://stackoverflow.com/q/25803428
tags question: http://stackoverflow.com/q/25712994
tags question: http://stackoverflow.com/q/25870584
tags question: http://stackoverflow.com/q/25824130
tags question: http://stackoverflow.com/q/25756919
tags question: http://stackoverflow.com/q/25714434
tags question: http://stackoverflow.com/q/25841382
tags question: http://stackoverflow.com/q/25792962
tags question: http://stackoverflow.com/q/25770447
tags question: http://stackoverflow.com/q/25832672
tags question: http://stackoverflow.com/q/25756969
tags question: http://stackoverflow.com/q/25839564
tags question: http://stackoverflow.com/q/25832838
tags question: http://stackoverflow.com/q/25731679
tags question: http://stackoverflow.com/q/25825495
tags question: http://stackoverflow.com/q/25738035
tags question: http://stackoverflow.com/q/25852412
tags question: http://stackoverflow.com/q/25851894
tags question: http://stackoverflow.com/q/25721354
tags question: http://stackoverflow.com/q/25836135
tags question: http://stackoverflow.com/q/25775182
tags question: http://stackoverflow.com/q/25790702
tags question: http://stackoverflow.com/q/25848140
tag name: user-interface
tags question: http://stackoverflow.com/q/25767519

http://stackoverflow.com/comment/40204791
type: AnswerComment
has text: i want to chech those starting with q=http. bcoz there are also other text other than links starting with same
comment on: http://stackoverflow.com/a/25718139
type: Comment
score: 0

http://stackoverflow.com/comment/40284635
type: Comment
type: QuestionComment
has text: Try to avoid `++/--` in compound expressions. While this behavior is well-defined in Java, it produces different results (ie. 12) in perl and results in undefined-behavior in C/C++. Plus, it often makes the expression harder to quickly analyze.. (case in point, perhaps)
score: 65
comment on: http://stackoverflow.com/q/25761337

http://stackoverflow.com/a/28997544
downvote count: 1
upvote count: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25833295
has body: the solution is nick's comment: This happens usually when one of your servlet mappings is broken. You should double-triple-check your web.xml.
score: 3
answers question: http://stackoverflow.com/q/25833295
type: Answer
has comment: http://stackoverflow.com/comment/57208266

http://stackoverflow.com/q/25757043
has comment: http://stackoverflow.com/comment/40277235
tagged with: area
linked to: http://stackoverflow.com/q/21356277
favorite count: 0
has answer: http://stackoverflow.com/a/25757091
tagged with: geometry
downvote count: 2
has comment: http://stackoverflow.com/comment/40277109
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40277043
tagged with: java
has body: I know there have been Java questions about triangles on here already, but I've tried looking and can't find a solution to my problem. I'm working on a homework assignment where I need to provide the lengths of the sides of the triangle (which the user can provide in any order. I have to find the type of the triangle (right, isosceles, etc) except for scalene since that wasn't in the instructions. I also have to find the area of the triangle. I have over a hundred lines but the still doesn't work at all. There aren't any errors that prevent it from compiling; it just doesn't work properly when executed. Any help would be much appreciated. import javax.swing.JOptionPane; public class TriangleChecker { public static void main(String[] args) { Boolean triangle, right, equilateral, isosceles; triangle = false; right = false; equilateral = false; String side1, side2, side3; double s1, s2, s3, perimeter, areai, bi, hi, fhi, be, he, fhe, areae, br, hr, arear; System.out.println("Hello welcome to the Triangle Checker"); side1 = JOptionPane.showInputDialog("Please enter side 1 of the triangle."); side2 = JOptionPane.showInputDialog("Please enter side 2 of the triangle."); side3 = JOptionPane.showInputDialog("Please enter side 3 of the triangle."); s1 = Double.parseDouble(side1); s2 = Double.parseDouble(side2); s3 = Double.parseDouble(side3); if ((s1 &gt; s2 + s3) || (s2 &gt; s1 + s3) || (s3 &gt; s1 + s2)) { triangle = false; } else { triangle = true; } if ((s1 &gt; s2 &amp;&amp; s1 &gt; s3) &amp;&amp; (s1*s1 == s2*s2 + s3*s3)) { right = true; } else if((s2 &gt; s1 &amp;&amp; s2 &gt; s3) &amp;&amp; (s2*s2 == s1*s1 + s3*s3)) { right = true; } else if((s3 &gt; s1 &amp;&amp; s3 &gt; s2) &amp;&amp; (s3*s3 == s1*s1 + s2*s2)) { right = true; } else { right = false; } if((s1 == s2) &amp;&amp; (s1 == s3)) { equilateral = true; right = false; isosceles = false; } else { equilateral = false; } if((s1 == s2) &amp;&amp; (s1 != s3)) { isosceles = true; } else if((s1 == s3) &amp;&amp; (s1 …
accepted answer: http://stackoverflow.com/a/25757091
has title: Finding the area of a triangle and the type
type: Question
upvote count: 0
score: -2
tagged with: types
answer count: 1

http://stackoverflow.com/a/74446191
upvote count: 2
has body: For people who have same issue with the latest versions of Weld and Hibernate: Both Weld and Hibernate have dependency on Jandex but with different versions, you need to exclude Jandex dependency from the hibernates dependency: org.hibernate hibernate-entitymanager ${hibernate.version} org.jboss jandex Good Luck
downvote count: 0
answers question: http://stackoverflow.com/q/25797866
type: Answer
has comment: http://stackoverflow.com/comment/132049252
score: 2

http://stackoverflow.com/q/25833295
type: Question
upvote count: 2
tagged with: http-status-code-503
accepted answer: http://stackoverflow.com/a/28997544
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/28997544
answer count: 1
has body: I developed a maven module application that works fine using (google appengine; maven; springmvc). 3 weeks after when I decided to add some features I noticed that I can no longer deploy it on the local, when I try to do so, I get: HTTP ERROR: 503 Problem accessing /. Reason: SERVICE_UNAVAILABLE Powered by Jetty:// NB : I did not change the code(so I'm pretty sure that it's not a source code problem), I just installed some applications like jenkins and sonar.
has comment: http://stackoverflow.com/comment/43380183
favorite count: 0
has title: Jetty shows http error message 503 SERVICE_UNAVAILABLE
has comment: http://stackoverflow.com/comment/40416729
has comment: http://stackoverflow.com/comment/43258690
has comment: http://stackoverflow.com/comment/46198677
tagged with: jetty
tagged with: maven
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40415889
downvote count: 0
tagged with: java

http://stackoverflow.com/comment/40473420
type: QuestionComment
type: Comment
has text: Clear the entitymanager (first flush!) and load the product if you don't it will be retrieved from the first level cache.
comment on: http://stackoverflow.com/q/25864840
score: 0

http://stackoverflow.com/comment/40365915
has text: possible duplicate of [Warning message: The value of the field CancelAnAlarmActivity.mDetailsButton is not used](http://stackoverflow.com/questions/22478523/warning-message-the-value-of-the-field-cancelanalarmactivity-mdetailsbutton-is)
comment on: http://stackoverflow.com/q/25757033
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25719311
has comment: http://stackoverflow.com/comment/40210685
has comment: http://stackoverflow.com/comment/40206883
upvote count: 1
has comment: http://stackoverflow.com/comment/40207016
has body: Try to apply theme on your Dialog constructor to Translucent setStyle(R.style.Theme.AppCompat.Translucent);
has comment: http://stackoverflow.com/comment/40206928
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25718741
type: Answer
has comment: http://stackoverflow.com/comment/40211288

http://stackoverflow.com/q/25868286
type: AnsweredQuestion
upvote count: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25868374
has comment: http://stackoverflow.com/comment/40479332
tagged with: factorial
has answer: http://stackoverflow.com/a/25868374
downvote count: 3
has body: This is my code for displaying factorial. But I think it's too long. How can I make my code shorter? Feedback will be appreciated. Thank you! This is the sample output: 6! = 5*4*3*2*1 = 720 This is my code: import java.io.*; public class Factorial { public static void main (String args[]) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int f = 1; System.out.print("Enter number: "); int num = Integer.parseInt(br.readLine()); int temp3 = num; String temp [] = new String [num]; while (num &gt;= 1) { f = num * f; num = num - 1; } for (int x=1; x&lt;temp3; x++) { temp[x]= "" + Integer.toString(x); } StringBuffer result = new StringBuffer(); for (int i = temp3 - 1; i &gt;= 1; i--) { result.append(temp[i]); if (i &gt; 1) { result.append("*"); } } System.out.print(temp3 + "! = " + result.toString() + " = " + f); } }
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40479342
has comment: http://stackoverflow.com/comment/40479441
has comment: http://stackoverflow.com/comment/40479568
score: -3
has title: Simplifying Factorial

http://stackoverflow.com/comment/40493339
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25868714
has text: You are right, I can't comply probably because JSON API is not in the path. My assumption is that this is bundled with Java EE 7. However, I am already looking for a third party lib to take care of that. It is unfortunate though. I will really appreciate any solution that will not involve external lib

http://stackoverflow.com/a/25729544
score: 2
accepted answer of: http://stackoverflow.com/q/25729495
has comment: http://stackoverflow.com/comment/40225715
upvote count: 3
has comment: http://stackoverflow.com/comment/40225914
downvote count: 1
has body: How about if you configure the "object" as a singleton of the entire application? This way, everybody (your app) sees the changes... See some insights here: http://developer.android.com/guide/faq/framework.html#3 For example, in some other file (Student.java): public class Student { public String Name; } Create a custom application class: public MyApp extends Application { private Student obj = new Student(); public Student getMyObject() { return obj; } } Anywhere in your application (e.g. SomeActivity.java): Student appStudent = ((MyApp) getActivity().getApplicationContext()).getMyObject(); appStudent.Name = "New Name"; // "global" update
has comment: http://stackoverflow.com/comment/40225818
has comment: http://stackoverflow.com/comment/40227489
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40225854
has comment: http://stackoverflow.com/comment/40226163
type: Answer
answers question: http://stackoverflow.com/q/25729495

http://stackoverflow.com/comment/40536550
comment on: http://stackoverflow.com/q/25855517
type: Comment
type: QuestionComment
has text: So your initial issue is solved (effectively, MAPQUESTOSM tiles are still working under 3.0.8). And you have now a new distinct issue => open a new one, and provide relevant code. But, first of all, you should upgrade to the latest osmdroid version.
score: 0

http://stackoverflow.com/comment/40195770
has text: @LittleChild:- You may try to change the method defintion as `BigInteger fact(BigInteger n){` or `BigInteger fact(long n){ def fact = 1G`and check the result.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25713512
type: Comment

http://stackoverflow.com/comment/40278896
type: Comment
has text: @gantners i can never == 1 because it starts at 0 and never gets incremented because the loop can never be entered because index starts at -1 so it is never == 1.
comment on: http://stackoverflow.com/a/25758127
score: 0
type: AnswerComment

http://stackoverflow.com/a/25854317
has comment: http://stackoverflow.com/comment/40456648
has comment: http://stackoverflow.com/comment/40456790
has comment: http://stackoverflow.com/comment/40457935
answers question: http://stackoverflow.com/q/25853804
has comment: http://stackoverflow.com/comment/40456420
has comment: http://stackoverflow.com/comment/40455221
has comment: http://stackoverflow.com/comment/40454580
has comment: http://stackoverflow.com/comment/40464123
has comment: http://stackoverflow.com/comment/40471080
has comment: http://stackoverflow.com/comment/40454249
has comment: http://stackoverflow.com/comment/40457455
score: 0
has comment: http://stackoverflow.com/comment/40457560
has body: Try to change WEB-INF/dispatcher-servlet.xml on /WEB-INF/dispatcher-servlet.xml in web.xml
has comment: http://stackoverflow.com/comment/40471099
has comment: http://stackoverflow.com/comment/40454782
type: Answer

http://stackoverflow.com/q/25756862
tagged with: google-app-engine
tagged with: android
has answer: http://stackoverflow.com/a/25758390
accepted answer: http://stackoverflow.com/a/25758390
type: AnsweredQuestion
has title: How to reference the default Id property of an entity on google app engine
type: Question
tagged with: java
answer count: 1
has body: If i've annotated a string variable in my JDO to be used as the id e.g. @Id private String nameOfId; And in the appengine's console it's named as 'NAME/ID', what do I use to get the property Note: For my queries, I'm using the datastore's query and not the entity manager, this means a collection of entities are returned to me and i've to get it's properties using, 'getProperty("propertyName")' Also Note: ive tried the following names getProperty("id"); getProperty("Id"); getProperty("name"); getProperty("NAME"); getProperty("NAME/ID"); getProperty("nameOfId"); none of these worked, I would just like to know what text I need to put as my argument for the getProperty method
score: 0

http://stackoverflow.com/comment/40222712
type: Comment
has text: Do I understand that you want to somehow take an unmodified jar and at some point in some method make it invoke a method in a different jar? You might accomplish this with bytecode manipulation but since your question is so vague and lacking in specific details it is impossible to tell.
type: QuestionComment
comment on: http://stackoverflow.com/q/25727605
score: 0

http://stackoverflow.com/a/25799080
has body: I spent quite some time wrapping my head around spring-security when using pure java configuration. There are a few steps involved in getting this to work. It should be something along these lines. The basic process is as follows: Create custom filters to check requests for specific authorization information Each filter returns null (if no authorization of that type is found), or a custom AbstractAuthenticationToken If a filter returns a token, each AuthenticationProvider's supports(class) method will be invoked with that token returning true|false if it should try authentication attemptAuthentication will then be called on the AuthenticationProvider which supports the token. Here you do any service calls to authenticate the user. You can then throw LoginException's or call authentication.setAuthenticated(true) and return the token for a successful authentication. I have been using this setup for a while supporting various authentication methods (signed request, username/password, oauth etc) and it works quite well. You can also pass AuthenticationSuccessHandler's and AuthenticationFailuersHandler's to the custom security filters to provide custom redirection strategies and failure handling. Also be sure to setup the ant matchers in the filter's constructors to control what url patterns the filters apply too. For example, an ldap request filter would probably need to be check with any request "/*" whereas a username/password filter can just be checked on POST's to /login or something similar. Example Code: Create custom AuthenticationToken's for each type of authentication you want to support public class LDAPAuthorizationToken extends AbstractAuthenticationToken { private String token; public LDAPAuthorizationToken( String token ) { super( null ); this.token = token; } public Object getCredentials() { return token; } public Object getPrincipal() { return null; } } public class OTPAuthorizationToken extends UsernamePasswordAuthenticationToken { private String otp; p…
has comment: http://stackoverflow.com/comment/99305245
score: 68
type: Answer
upvote count: 68
has comment: http://stackoverflow.com/comment/74805523
accepted answer of: http://stackoverflow.com/q/25794680
answers question: http://stackoverflow.com/q/25794680
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40461311
score: 0
type: Comment
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61309/discussion-between-kick-buttowski-and-martin).
comment on: http://stackoverflow.com/q/25857956

http://stackoverflow.com/comment/40242920
comment on: http://stackoverflow.com/q/25738129
score: 0
type: Comment
type: QuestionComment
has text: answer posted for your acceptance

http://stackoverflow.com/comment/40357528
has text: in browser, password was never requested ?
comment on: http://stackoverflow.com/q/25800657
type: Comment
type: QuestionComment
score: 0

encoding
tags question: http://stackoverflow.com/q/25780189
tags question: http://stackoverflow.com/q/25757183
type: Tag
tags question: http://stackoverflow.com/q/25867488
tags question: http://stackoverflow.com/q/25735374
tags question: http://stackoverflow.com/q/25771951
tag name: encoding
tags question: http://stackoverflow.com/q/25797018
tags question: http://stackoverflow.com/q/25871695

http://stackoverflow.com/comment/40305881
has text: Yes. start pricessing at the same time.
type: Comment
comment on: http://stackoverflow.com/q/25771937
type: QuestionComment
score: 0

http://stackoverflow.com/q/25758687
tagged with: java
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40279812
tagged with: jar
score: -1
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25761138
favorite count: 0
upvote count: 0
has body: I met problem when trying to export my java project into runnable jar. the code runs in eclipse, but can't get resource after exported. My dir structure in eclipse project_A - src - package_a - a.java - res - b.png structure in jar A - src - A.class res - b.png META-INF - MANIFEST what's in the MANIFEST Manifest-Version: 1.0 Class-Path: . Main-Class: project_A.A_class I'm using following code to get image resource URL url = getClass().getResource("res/b.png"); img_bg = ImageIO.read(url); This code works in Eclipse, but only with relative path, and if I set res dir as the same level with src dir, above code doesn't work either, always return input is null. I can't see what path this program get when I execute jar, don't know how to debug without output information. So can anyone help me figure out what is the right structure and how to get image in jar? my mistake, the first eclipse structure is wrong, it's the same structure as shown in Betlista's anwser
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40279982
has title: Can't load resource from jar

http://stackoverflow.com/q/25855563
has body: I have an entity called Profile. This entity can be followed or follow other Profiles. public class Profile{ @ManyToMany(cascade=CascadeType.PERSIST) @JoinTable(name = "profile_fans") public Set&lt;Profile&gt; fansFollowed; } I want to delete a Profile, and it throws me this error: Cannot delete or update a parent row: a foreign key constraint fails (profile_fans, CONSTRAINT FK48ECA896ADDBF9EF FOREIGN KEY (fansFollowed_id) REFERENCES profile (id)) I want to delete only the relation between Profiles. Not the entity. Is this possible?
has answer: http://stackoverflow.com/a/25867925
possible better answer: http://stackoverflow.com/a/25856540
score: 0
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25856540
tagged with: playframework
type: AnsweredQuestion
tagged with: jpa
accepted answer: http://stackoverflow.com/a/25867925
has title: Many to many on delete cascade relations
type: Question
has comment: http://stackoverflow.com/comment/40458255
answer count: 2

http://stackoverflow.com/comment/40358919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25795290
has text: Are you using spring-mvc? If so you can use interceptors in spring-mvc. http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html#mvc-handlermapping-interceptor
score: 0

http://stackoverflow.com/comment/40295785
comment on: http://stackoverflow.com/a/25767527
score: 4
type: AnswerComment
type: Comment
has text: I think the `Character.isDigit(ch)` check is entirely superfluous.

http://stackoverflow.com/comment/40530054
comment on: http://stackoverflow.com/q/25836936
has text: That's why we ask for a **complete** (Complete – Provide all parts needed to reproduce the problem) example. With this we can run your code and see what might be going wrong. Please provide the rest of your code (not just random snippets)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25790201
type: Answer
has comment: http://stackoverflow.com/comment/40336830
has comment: http://stackoverflow.com/comment/40336590
score: -1
answers question: http://stackoverflow.com/q/25790040
downvote count: 1
upvote count: 0
has body: The reason is because your value for j is ALWAYS 1 less than the value for i. Therefore, infinite while loop.

http://stackoverflow.com/q/25728885
tagged with: domdocument
upvote count: 1
accepted answer: http://stackoverflow.com/a/25733664
type: Question
has answer: http://stackoverflow.com/a/59375924
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40224686
possible better answer: http://stackoverflow.com/a/59375924
answer count: 2
has comment: http://stackoverflow.com/comment/40327594
downvote count: 0
tagged with: transformer-model
favorite count: 0
has answer: http://stackoverflow.com/a/25733664
has body: I want to produce xml files with 1.1 as version in the header, since i get SaxparserExceptions when parsing my xml-files with version 1.0: "Character reference "&amp;#3" is an invalid XML character". When I manually change the header, i don't get any errors. Changing the version via outputkeys doesn't seem to work. The file has still the wrong header: "&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;" example code: try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); TransformerFactory transformerFactory = TransformerFactory .newInstance(); Transformer transformer = transformerFactory .newTransformer(); transformer.setOutputProperty( OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.VERSION, "1.1"); transformer .setOutputProperty( "{http://xml.apache.org/xslt}indent-amount", "2"); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult( "processed_.xml"); transformer.transform(source, result); } catch (TransformerConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (TransformerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); }
has title: Java produce version "1.1" in XML header with transformer
tagged with: version
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion

http://stackoverflow.com/comment/40420694
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25835895
has text: Made into a community wiki as I should not get credit for this answer for a question that has been asked over and over.

http://stackoverflow.com/a/27044481
score: 47
type: Answer
has comment: http://stackoverflow.com/comment/55247891
has body: It seems a dependency will not be excluded if there is another dependency somewhere that points to that same dependency without any of the excludes. You can exclude a dependency through configuration however: configurations { all*.exclude group: 'com.google.guava', module:'guava-jdk5' }
answers question: http://stackoverflow.com/q/25792398
upvote count: 47
downvote count: 0

http://stackoverflow.com/q/25799611
tagged with: java
tagged with: memory
tagged with: caching
has answer: http://stackoverflow.com/a/25799685
answer count: 1
score: 0
has body: As specified in CacheStatistics: getCacheHits(): The number of times a requested item was found in the cache. getInMemoryHits(): Number of times a requested item was found in the Memory Store. What actually is this memory store? I had been thinking that "a cache" is a "in memory" instance in JVM as well? What is the difference between cache and memory store in ehcache? In what scenarios will the values returned be different?
has title: EhCache's CacheStatistics getCacheHits vs getInMemoryHits
tagged with: ehcache
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/40491277
type: AnswerComment
comment on: http://stackoverflow.com/a/25864123
type: Comment
has text: Yeah but how exactly does it get emails which are dated atleast 10 days before the current date?
score: 0

http://stackoverflow.com/q/25789250
accepted answer: http://stackoverflow.com/a/25789601
has body: Suppose I have a CSV file as: employees.csv ID,Name,Role,Salary 1,Pankaj Kumar,CEO,"5,000USD" 2,Lisa,Manager,500USD 3,David,,1000USD I can parse this to the list of Employee objects as: Employee.java package com.journaldev.parser.csv; public class Employee { private String id; private String name; private String role; private String salary; 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 getRole() { return role; } public void setRole(String role) { this.role = role; } public String getSalary() { return salary; } public void setSalary(String salary) { this.salary = salary; } @Override public String toString(){ return "ID="+id+",Name="+name+",Role="+role+",Salary="+salary+"\n"; } } But what if I want to make my code so that it can process files with more or less columns, without knowing in advance what their names are: employees.csv ID,Name,Role,Salary, dateJoined, sex 1,Pankaj Kumar,CEO,"5,000USD",Jan 05 2014 12:04:01PM,MALE 2,Lisa,Manager,500USD,Feb 11 2012 12:04:01PM, FEMALE 3,David,,1000USD,Jan 02 2013 12:04:01PM, MALE I would like to make this so that it doesn't matter the number of columns in file. So for each column in file, code creates another element in the list of objects. The rest of my code: package openCSV_fileReader; import java.io.FileReader; import java.io.IOException; import java.io.StringWriter; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import au.com.bytecode.opencsv.CSVReader; import au.com.bytecode.opencsv.CSVWriter; public class OpenCSV_fileReader { public static void main(String[] args) throws IOException { List&lt;Employee&gt; emps = parseCSVFileAsList(); System.out.println("**********"); writeCSVData(emps); } private static void writeCSVData(List&lt;Employee&gt; emps) throws IOException { StringWriter writer = new StringWriter(); CSVWriter csvWriter = new CSVWriter…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40335403
tagged with: java
tagged with: string-parsing
has comment: http://stackoverflow.com/comment/40337036
type: Question
tagged with: object
has answer: http://stackoverflow.com/a/25789601
score: 0
has comment: http://stackoverflow.com/comment/40334992
has title: How to make a dynamic list of Objects
answer count: 1
has comment: http://stackoverflow.com/comment/40334814
tagged with: opencsv

http://stackoverflow.com/q/25841836
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40460524
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40432170
tagged with: google-play
has comment: http://stackoverflow.com/comment/40432214
tagged with: java
has answer: http://stackoverflow.com/a/25841866
type: Question
tagged with: admob
has title: Admob crashing the app
score: 0
tagged with: android
answer count: 1
has body: I tried running my code without admob first. It works fine. Then I tried running my code with the admob the app just crashes on start doesn't even show a message just crashes. I have provided the code for activity main and layout.xml and manifest. If you need to look at the imageAdapter and GalleryFlow I will post that too. Here is my code: public class ActivityMain extends Activity { private GalleryFlow mGalleryFlow; private AdView adView; private InterstitialAd interstitial; private int[] imageIds = new int[] { R.drawable.gal1, R.drawable.gal2, R.drawable.gal3, R.drawable.gal4, R.drawable.gal5, R.drawable.gal6, R.drawable.gal7, R.drawable.gal8, R.drawable.gal9, R.drawable.gal10, R.drawable.gal11, R.drawable.gal12, R.drawable.gal13, R.drawable.gal14, R.drawable.gal15, R.drawable.gal16, R.drawable.gal17,}; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_gallery); findViews(); initViews(); adView = new AdView(this); adView.setAdSize(AdSize.SMART_BANNER); adView.setAdUnitId("MY ID HERE"); RelativeLayout layout = (RelativeLayout) findViewById(R.id.layoutAdView); layout.addView(adView); AdRequest adRequest = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("INSERT_YOUR_HASHED_DEVICE_ID_HERE") .build(); adView.loadAd(adRequest); interstitial = new InterstitialAd(this); interstitial.setAdUnitId("MY ID HERE"); AdRequest adRequest1 = new AdRequest.Builder().build(); interstitial.loadAd(adRequest); interstitial.setAdListener(new AdListener() { public void onAdLoaded() { displayInterstitial(); } }); } public void displayInterstitial() { if (interstitial.isLoaded()) { interstitial.show(); } } private void findViews() { mGalleryFlow = (GalleryFlow) findViewById(R.id.Gallery01); } private void initViews() { ImageAdapter adapter = new ImageAdapter(this, imageIds); adapter.createReflectedImages(); mGalleryFlow.setAdapter(adapter); } } Layout xml <com.norka.gallery.GalleryFlow an…

http://stackoverflow.com/q/25740043
has title: Migrating to OpenJDK from Oracle JDK
has comment: http://stackoverflow.com/comment/40246513
answer count: 1
accepted answer: http://stackoverflow.com/a/25744009
downvote count: 0
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/40246315
tagged with: maven
score: 2
type: AnsweredQuestion
has body: I'm working on migrating my project from Oracle JDK to open JDK. As a part of the development I also want to replace all my Oracle licensed jars with equivalent open source license jars. Now there are quite a lot of it. The project is maven built and all the dependencies are in the pom file. I was wondering if there is a way to use my pom.xml file and get all my jars with equivalent open source jars? As of now I'm manually going to each jar's release notes and checking for an Open source license. Here when I say Oracle licensed I mean it is not an Open source jar. Appreciate the help!!!! Cheers !!!
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25744009
type: Question
tagged with: open-source

http://stackoverflow.com/comment/40467373
has text: @HarisMehmood which class you are talking about
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25861105
score: 0

http://stackoverflow.com/comment/40285478
type: Comment
score: 4
type: AnswerComment
has text: this will fail if "of" is at start of string i.e no string at start.
comment on: http://stackoverflow.com/a/25761929

http://stackoverflow.com/q/25723026
answer count: 1
has comment: http://stackoverflow.com/comment/40235936
has body: I am trying to build a Dynamic web project where user can practice Java code. I got success on writing the code written by user in a .java file, compile the code &amp; get error messages using Java Compile API. Now, I need to run JUnit 1.4 Compatible test on that code. I researched for it, and found something like parameterized junit testing. But my view on how should it be done isn't still clear. UPDATE This (http://codingbat.com/prob/p171896) is the exact thing what I'm trying to implement.
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Building Java file at runtime & running JUnit test on that class file
score: 2
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/8071894
downvote count: 0
has answer: http://stackoverflow.com/a/40245534
tagged with: parameterized
has comment: http://stackoverflow.com/comment/40240096
tagged with: junit

http://stackoverflow.com/comment/52495905
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/29357973
has text: You don't need to connect previously to do a synchronous connection (as you do in method `doSomething()`). Still, your code will work.
score: 1

http://stackoverflow.com/a/25749559
accepted answer of: http://stackoverflow.com/q/25749498
score: 1
answers question: http://stackoverflow.com/q/25749498
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: You just need to add fasterxml library. Are you using maven? If yes add the dependency. If not, link the project in IDE with the fasterxml jar. See the maven repository here.

java-8
tags question: http://stackoverflow.com/q/25867548
tags question: http://stackoverflow.com/q/25847397
tags question: http://stackoverflow.com/q/25853988
tags question: http://stackoverflow.com/q/25727647
tags question: http://stackoverflow.com/q/25784337
tags question: http://stackoverflow.com/q/25735583
tags question: http://stackoverflow.com/q/25829292
tags question: http://stackoverflow.com/q/25787127
tags question: http://stackoverflow.com/q/25794388
tags question: http://stackoverflow.com/q/25722134
tags question: http://stackoverflow.com/q/25831301
tags question: http://stackoverflow.com/q/25793628
tags question: http://stackoverflow.com/q/25747499
tags question: http://stackoverflow.com/q/25728581
tags question: http://stackoverflow.com/q/25850008
tags question: http://stackoverflow.com/q/25798876
tags question: http://stackoverflow.com/q/25811112
tags question: http://stackoverflow.com/q/25868613
tags question: http://stackoverflow.com/q/25855637
tag name: java-8
tags question: http://stackoverflow.com/q/25843346
tags question: http://stackoverflow.com/q/25796118
tags question: http://stackoverflow.com/q/25850491
tags question: http://stackoverflow.com/q/25864559
tags question: http://stackoverflow.com/q/25819082
tags question: http://stackoverflow.com/q/25776637
tags question: http://stackoverflow.com/q/25793098
tags question: http://stackoverflow.com/q/25782601
tags question: http://stackoverflow.com/q/25753723
type: Tag
tags question: http://stackoverflow.com/q/25784417
tags question: http://stackoverflow.com/q/25727296

http://stackoverflow.com/q/25757605
tagged with: javascript
type: UnansweredQuestion
has title: Select2 support for quick option filtering via a search box
score: -1
favorite count: 0
has answer: http://stackoverflow.com/a/25757901
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/40278951
tagged with: java
downvote count: 1
has body: This is my code but iam not able to get the required select2 with support for quick option filtering via a search box. $(document).ready(function(){ alert( 'You are running jQuery version: ' + $.fn.jquery ); alert("ready"); $("#e1").select2(); }); select Alabama Germany Poland Wyoming plz help and let me know where iam doing the mistake
has comment: http://stackoverflow.com/comment/40278003
upvote count: 0

http://stackoverflow.com/comment/40211413
has text: Get the millisecond and mod it with 1000. `time2.toMillis(true) % 1000`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25721865

http://stackoverflow.com/q/25819313
favorite count: 0
duplicate of: http://stackoverflow.com/q/513832
answer count: 5
tagged with: android
has comment: http://stackoverflow.com/comment/40392065
accepted answer: http://stackoverflow.com/a/25819318
type: AnsweredQuestion
upvote count: 2
score: 1
tagged with: java
downvote count: 1
type: Question
has title: What is getStringExtra format
has answer: http://stackoverflow.com/a/25819937
has comment: http://stackoverflow.com/comment/40390920
has body: //intent.putExtra(EXTRA_MESSAGE, "abc"); intent.getStringExtra(Home.EXTRA_MESSAGE) == "abc" // false intent.getStringExtra(Home.EXTRA_MESSAGE) == getString(R.string.abc) //false (with R.string.abc=="abc") String abc = "abc"; intent.getStringExtra(Home.EXTRA_MESSAGE) == abc //false Why everything is false? If I print the values with a toast they're apparently identical. Thanks.
has answer: http://stackoverflow.com/a/25819318
has answer: http://stackoverflow.com/a/25819325
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/25819831
has answer: http://stackoverflow.com/a/25819546
possible better answer: http://stackoverflow.com/a/25819325

http://stackoverflow.com/q/25860213
has title: In Spring . different session bean data being shared among browser tabs.. how to stop this?
tagged with: spring
has comment: http://stackoverflow.com/comment/40465395
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/6243201
has comment: http://stackoverflow.com/comment/40465313
tagged with: spring-mvc
score: 1
tagged with: session
tagged with: java
has answer: http://stackoverflow.com/a/25864401
type: Question
upvote count: 1
answer count: 1
favorite count: 0
has body: in my webapp, using spring @scope : session i have made scope of bean as session. My problem is if i login as admin in one tab of browser to web app and login as normal user in another tab of browser the data are being shared amoung them. How to avoid this. If i am using two different browsers the problem is not occurring. Kindly suggest where am i doing wrong. I have placed @scope session in all bean classes and controller classes .

http://stackoverflow.com/comment/40251247
has text: Thank you very much! That makes sense and I got it working. The only issue (highlighted as an error in STS) is the string parameter you've included in your Autowired annotation - I don't believe that's possible? I had to remove it, STS reported it's value is undefined for annotation type Autowired. So to confirm I've understood this correctly, the Repository annotation has basically indicated to Spring that my DAO class is now a persistence layer and by adding the Autowired annotation to my instance var of that class it has created a bean for me behind the scenes - that correct?
score: 0
comment on: http://stackoverflow.com/a/25729995
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25749315
answers question: http://stackoverflow.com/q/25748992
has body: You may use String#endsWith: boolean endsWithNewline = nextResult.endsWith("\n"); Or String#charAt: boolean endsWithNewLine = nextResult.charAt(nextResult.length() - 1) == '\n'; However, your current code works fine for me. Perhaps there is some kind of typo in your inputs.
downvote count: 0
upvote count: 8
type: Answer
score: 8

http://stackoverflow.com/comment/40219448
score: 0
has text: I checked the state of the transaction before updateDb() is called using TransactionSynchronizationManager.isActualTransactionActive() and it returned false. But why is the transaction not active? Is my pointcut expression wrong? Note im using the default package in Eclipse.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25721818

http://stackoverflow.com/a/26079087
type: Answer
accepted answer of: http://stackoverflow.com/q/25840405
has body: It looks like the best option to achieve this experience is a ViewPager, which requires the android support library. http://developer.android.com/reference/android/support/v4/view/ViewPager.html
answers question: http://stackoverflow.com/q/25840405
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/40309686
comment on: http://stackoverflow.com/q/25774846
type: Comment
type: QuestionComment
score: 0
has text: And *where* are the errors? You've posted a lot of code and very little description...

http://stackoverflow.com/q/25760195
type: AnsweredQuestion
tagged with: overloading
tagged with: java
possible better answer: http://stackoverflow.com/a/25760869
upvote count: 1
has body: I hit a bump when I'm doing my Java code. I feel like I somehow got the concept messed up, like I not sure for this: void setScore(float[] sco) { sco = score; } public void setScore(float sco, int id) { sco[id] = score; } The error message corresponds to "sco[ID] = score; " The type of the expression must be an array type but it resolved to float I'm confused what I should put in the bracket, the book asks me to put "float[] score" instead of "float[] sco", but it doesn't work, so I edited a bit after several trials. This part of coding generally describes the method of overloading that stores the score for 5 subjects. And this is my whole coding: public class Score { float math, english, physics, chemistry, biology; float sum, average; float[] score; int id; void setMath(float Math) { math = Math; } void setEnglish(float English) { english = English; } void setPhysics(float Physics) { physics = Physics; } void setChemistry(float Chemistry) { chemistry = Chemistry; } void setBiology(float Biology) { biology = Biology; } void setSum(float Sum) { sum = math + english + physics + chemistry + biology; } void setAverage(float Average) { average = sum / 5; } float getMath() { return math; } float getEnglish() { return english; } float getPhysics() { return physics; } float getChemistry() { return chemistry; } float getBiology() { return biology; } float getSum() { return sum; } float getAverage() { return average; } public void setScore(float[] sco) { sco = score; } public void setScore(float sco, int id) { sco[id] = score; } } Now my problem solved! Since I just changed like this: public void score() { } public void setScore(float[] score) { sco = score; } Can anyone tell me why now the problem resolved? Will really appreciate a lot!
accepted answer: http://stackoverflow.com/a/25760861
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25760861
has answer: http://stackoverflow.com/a/25760942
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25760869
favorite count: 0
has title: The type of the expression must be an array type but it resolved to float

http://stackoverflow.com/tag/xml
tags question: http://stackoverflow.com/q/25773370
tags question: http://stackoverflow.com/q/25828240
tags question: http://stackoverflow.com/q/25743808
tags question: http://stackoverflow.com/q/25809538
tags question: http://stackoverflow.com/q/25741671
tags question: http://stackoverflow.com/q/25713407
tags question: http://stackoverflow.com/q/25867568
tags question: http://stackoverflow.com/q/25827606
tags question: http://stackoverflow.com/q/25747578
tags question: http://stackoverflow.com/q/25715234
type: Tag
tags question: http://stackoverflow.com/q/25752819
tags question: http://stackoverflow.com/q/25748936
tags question: http://stackoverflow.com/q/25872159
tags question: http://stackoverflow.com/q/25793256
tags question: http://stackoverflow.com/q/25861377
tags question: http://stackoverflow.com/q/25761257
tags question: http://stackoverflow.com/q/25753902
tags question: http://stackoverflow.com/q/25833078
tags question: http://stackoverflow.com/q/25794912
tags question: http://stackoverflow.com/q/25750188
tags question: http://stackoverflow.com/q/25794516
tags question: http://stackoverflow.com/q/25728801
tags question: http://stackoverflow.com/q/25721732
tags question: http://stackoverflow.com/q/25751707
tags question: http://stackoverflow.com/q/25811447
tags question: http://stackoverflow.com/q/25804122
tags question: http://stackoverflow.com/q/25733442
tags question: http://stackoverflow.com/q/25858085
tags question: http://stackoverflow.com/q/25845496
tags question: http://stackoverflow.com/q/25816400
tags question: http://stackoverflow.com/q/25856485
tags question: http://stackoverflow.com/q/25747876
tags question: http://stackoverflow.com/q/25728826
tags question: http://stackoverflow.com/q/25788055
tags question: http://stackoverflow.com/q/25814564
tags question: http://stackoverflow.com/q/25825577
tags question: http://stackoverflow.com/q/25745672
tags question: http://stackoverflow.com/q/25767607
tags question: http://stackoverflow.com/q/25810916
tags question: http://stackoverflow.com/q/25811351
tags question: http://stackoverflow.com/q/25759477
tags question: http://stackoverflow.com/q/25793860
tags question: http://stackoverflow.com/q/25817789
tags question: http://stackoverflow.com/q/25745786
tags question: http://stackoverflow.com/q/25746687
tags question: http://stackoverflow.com/q/25840661
tags question: http://stackoverflow.com/q/25772747
tags question: http://stackoverflow.com/q/25749492
tags question: http://stackoverflow.com/q/25844204
tags question: http://stackoverflow.com/q/25870156
tags question: http://stackoverflow.com/q/25837852
tags question: http://stackoverflow.com/q/25850502
tags question: http://stackoverflow.com/q/25751255
tags question: http://stackoverflow.com/q/25772152
tags question: http://stackoverflow.com/q/25849832
tags question: http://stackoverflow.com/q/25748324
tags question: http://stackoverflow.com/q/25724019
tag name: xml
tags question: http://stackoverflow.com/q/25738129
tags question: http://stackoverflow.com/q/25723459
tags question: http://stackoverflow.com/q/25762915
tags question: http://stackoverflow.com/q/25839671
tags question: http://stackoverflow.com/q/25763806
tags question: http://stackoverflow.com/q/25821771
tags question: http://stackoverflow.com/q/25809373
tags question: http://stackoverflow.com/q/25849883
tags question: http://stackoverflow.com/q/25723446
tags question: http://stackoverflow.com/q/25805738
tags question: http://stackoverflow.com/q/25762715
tags question: http://stackoverflow.com/q/25828255
tags question: http://stackoverflow.com/q/25832117
tags question: http://stackoverflow.com/q/25818403
tags question: http://stackoverflow.com/q/25847959
tags question: http://stackoverflow.com/q/25820034
tags question: http://stackoverflow.com/q/25851145
tags question: http://stackoverflow.com/q/25763711
tags question: http://stackoverflow.com/q/25794980
tags question: http://stackoverflow.com/q/25788141
tags question: http://stackoverflow.com/q/25776647

http://stackoverflow.com/comment/40378971
score: 0
type: Comment
type: QuestionComment
has text: Well my JFrame isn't showing and it has to do with this, i believe i am not connecting the jFrame and container object properly, hence why i think my code needs to be changed
comment on: http://stackoverflow.com/q/25813108

http://stackoverflow.com/a/25892610
type: AcceptedAnswer
downvote count: 0
score: 16
type: Answer
accepted answer of: http://stackoverflow.com/q/25867347
has comment: http://stackoverflow.com/comment/73834372
has body: Spring 4.1 introduces a SockJs Java Client which is quite useful for server to server communication and performance testing. It doesn't come with a Stomp client (this is certainly in the roadmap) but you can check out the tests in the sample app which has already an implementation. Seems this is what you are looking for. Update 8 Sep 2015: Spring 4.2 has a STOMP Java client which can be used along with the SockJS Java client. More: https://docs.spring.io/spring/docs/4.2.x/spring-framework-reference/htmlsingle/#websocket-stomp-client
answers question: http://stackoverflow.com/q/25867347
has comment: http://stackoverflow.com/comment/40544618
has comment: http://stackoverflow.com/comment/40531588
upvote count: 16
has comment: http://stackoverflow.com/comment/40531864
has comment: http://stackoverflow.com/comment/40548346
has comment: http://stackoverflow.com/comment/40557502

http://stackoverflow.com/comment/40322540
has text: @rasikavijay So I have it. You can delete the answer. And what is the problem exactly? What you get and what you expect?
comment on: http://stackoverflow.com/a/25781375
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25834704
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/40422340
has comment: http://stackoverflow.com/comment/40418626
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40418893
linked to: http://stackoverflow.com/q/14187963
answer count: 0
has title: Injecting variables to the JavaFX thread
tagged with: java
tagged with: javafx
has body: I'm trying to learn JavaFX and I'm having some trouble understanding how the JavaFX thread can interact with the rest of my application. I'm using JavaFX for the interface window but I have some other stuff running in the main thread. I load my FXML from a file I've created with the Scene Builder and I've attached the open method to a MenuItem in Scene Builder. I've tried having an instance variable in the Editor class and populating it in the constructor as well as the start method but it's always null in the open method. As far as I understand this is because the open method is called from the JavaFX thread. What is the best practice to solve this problem? This goes the other way to, what if I want to access a component if the JavaFX thread in my main thread? public class Editor extends Application { private Stage stage; private FileChooser fileChooser; @Override public void start(Stage stage) throws Exception { this.stage = stage; stage.setTitle("Editx"); stage.setScene(new Scene( FXMLLoader.load(this.getClass().getResource("./Editor.fxml")), 1280, 800)); stage.show(); this.fileChooser = new FileChooser(); this.fileChooser.getExtensionFilters().add( new FileChooser.ExtensionFilter("OBJ", "*.obj")); this.fileChooser.getExtensionFilters().add( new FileChooser.ExtensionFilter("All Files", "*.*")); } @FXML private void open() { // Both this.fileChooser and this.stage is null here for example File file = this.fileChooser.showOpenDialog(this.stage); } }
tagged with: multithreading
type: Question
has comment: http://stackoverflow.com/comment/40418541
score: 0

http://stackoverflow.com/a/25827954
accepted answer of: http://stackoverflow.com/q/25827907
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/25827907
downvote count: 0
score: 3
type: AcceptedAnswer
has body: Your code is fine. Just one thing. Assuming you want the user to press enter after entering a word here : System.out.print("Enter a word:"); then you just have to make a minor change: word = kb.nextLine(); The rest is fine. reading the input like this: index1 = kb.nextInt(); index2 = kb.nextInt(); index3 = kb.nextInt(); index4 = kb.nextInt(); means that your Scanner has the default delimiter of " " so the input should be like that: Enter a word: "Whatever" Enter four indices: 1 2 3 4 The numbers should be seperated by a space. Hope this helps

http://stackoverflow.com/a/25749756
answers question: http://stackoverflow.com/q/25749550
score: 27
upvote count: 27
has comment: http://stackoverflow.com/comment/78530187
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25749550
has body: You can't use the getFile of TarArchiveEntry. That getter is there only for the opposite operation, when you are compressing files inside a tar file. Instead, you should read directly from TarArchiveInputStream. It will take care of returning you the content of the "file" decompressing it on the fly. For example (untested code, YMMV) : TarArchiveInputStream tarInput = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream("c://temp//test.tar.gz"))); TarArchiveEntry currentEntry = tarInput.getNextTarEntry(); BufferedReader br = null; StringBuilder sb = new StringBuilder(); while (currentEntry != null) { br = new BufferedReader(new InputStreamReader(tarInput)); // Read directly from tarInput System.out.println("For File = " + currentEntry.getName()); String line; while ((line = br.readLine()) != null) { System.out.println("line="+line); } currentEntry = tarInput.getNextTarEntry(); // You forgot to iterate to the next file }
has comment: http://stackoverflow.com/comment/67126833

http://stackoverflow.com/a/41574485
score: 8
answers question: http://stackoverflow.com/q/25851423
upvote count: 8
type: Answer
has body: I am a little late on the answer here but I was dealing with a similar issue and found a solution. The reason you are still seeing data in the intent is because your app was originally started with an intent that contained data. That original intent is stored somewhere in Androids' ActivityManager and is immutable, to my understanding. When user reopens the app from "recent tasks", Android uses that original intent to recreate the application. There is a workaround to this, however. In your apps onCreate() method, you can check to see if the Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY is set, which would allow your app to distinguish if it is being started from "recent tasks" or not, and therefore, you can avoid using the data contained in the intent. Putting the following snippet in your onCreate() method would return true if the app is being opened from "recent tasks" (getIntent().getFlags() &amp; Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0)
downvote count: 0
has comment: http://stackoverflow.com/comment/73474241
has comment: http://stackoverflow.com/comment/78772445

http://stackoverflow.com/q/25830755
downvote count: 1
has answer: http://stackoverflow.com/a/25830971
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40411492
score: 0
answer count: 2
tagged with: time-complexity
has body: So what i am basically trying to do here is to take out the characters such as 'S' 'P' 'O' 'R' 'T' from the array which contains all the alphabets from 'A'...'Z' This code works fine but i want to know if there is a better way to do it.. a more simplified version or so.. And i would appreciate answers which involves only arrays n not list or hashes! String key = "SPORT"; char [] keys = key.toCharArray(); String alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char [] alpha = alphabets.toCharArray(); int len = alpha.length; int keylen = keys.length; System.out.println(len); int new_len = (alpha.length) - keylen; char [] newalpha = new char [new_len]; for (int j = 0 ; j &lt; keys.length ; j++) { for (int i = 0 ; i &lt; len ; i++) { if (alpha[i] == keys[j]) { alpha[i] = '@'; } } } int k = 0; for (int i = 0 ; i &lt; len ; i++) { if (alpha[i] != '@') { newalpha[k] = alpha[i]; k++; } } for (int i = 0 ; i &lt; newalpha.length ; i++) { System.out.println(newalpha[i]); }
tagged with: arrays
has comment: http://stackoverflow.com/comment/40411403
favorite count: 0
has comment: http://stackoverflow.com/comment/40411448
has comment: http://stackoverflow.com/comment/40411522
has comment: http://stackoverflow.com/comment/40411533
has title: Is there a better way to do it? I want to literally subtract characters from one array into another
has answer: http://stackoverflow.com/a/25830960
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/a/25775827
upvote count: 8
downvote count: 0
score: 8
type: Answer
has body: You can't. Java doesn't support custom operator overloading. Overriding equals doesn't affect ==. The closest you can get to &lt; is to implement the Comparable interface, which includes a compareTo method. http://docs.oracle.com/javase/7/docs/api/java/lang/Comparable.html
answers question: http://stackoverflow.com/q/25775808

http://stackoverflow.com/q/25731506
has answer: http://stackoverflow.com/a/25732849
tagged with: mapreduce
answer count: 2
tagged with: hdfs
has answer: http://stackoverflow.com/a/25732839
tagged with: unix
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
tagged with: hadoop
has body: Our log files are stored in year/month/day/hourly folders in HDFS See below for structure: /year=2014/month=8/day=20/hour=1/logA.txt /year=2014/month=8/day=20/hour=2/logB.txt /year=2014/month=8/day=20/hour=2/logC.txt If i pass one log file as input to Java mapreduce program, it works. See my working syntax below: hadoop jar test.jar wc /year=2014/month=8/day=20/hour=1/logA.txt output/ How do i pass all the files in month = 8 as input to my map reduce program? i.e. month = 8 has folders for each day, and each day has subfolders for hours. Log files are stored in the hour folders. I need to pass all in the files in each hour for each day in the month of August as input to my Mapreduce program.
has title: Running Mapreduce on files in folders and sub folders

http://stackoverflow.com/comment/40342438
type: QuestionComment
comment on: http://stackoverflow.com/q/25793068
has text: Download the groovy-all.jar and add it to project class path. Then delete your project manifest and a regenerate it or add it manually.
score: 0
type: Comment

http://stackoverflow.com/comment/40278355
comment on: http://stackoverflow.com/a/25757645
score: 0
type: AnswerComment
type: Comment
has text: what's stream object in first section?

http://stackoverflow.com/a/25774010
has comment: http://stackoverflow.com/comment/40307976
answers question: http://stackoverflow.com/q/25773898
has comment: http://stackoverflow.com/comment/40308254
has comment: http://stackoverflow.com/comment/40308404
downvote count: 0
has body: In your JSP your variable row represents the Student object. So when you say row.studentDetails you are getting java.util.List now when you try to access anything on this list, then JSP assumes you are trying to fetch an element of the list using the provided index. So it is like list.indexNumber, so JSP assumes FatherName and MotherName as number and tries to convert them to integer and gets the exception. To fix this you have to iterate through the list: &lt;c:forEach items="${srow.studentDetails}" var="details"&gt; ${details.FatherName} ${details.MotherName} &lt;/c:forEach&gt; Update: As per naming convention you have to access the properties using details.fatherName and details.motherName The standard way of declaring Java beans is to name the properties as fatherName instead of FatherName private String fatherName; private String motherName; public String getFatherName() { return fatherName; } public void setFatherName(String fatherName) { this.fatherName = fatherName; } public String getMotherName() { return motherName; } public void setMotherName(String motherName) { this.motherName = motherName; }
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40308969
upvote count: 1

http://stackoverflow.com/comment/40417605
type: QuestionComment
has text: @mihi Ah, now we're talking... I've always had an issue with the stateful `accessible` API. I really don't see any benefit to it and security issues abound.
score: 1
comment on: http://stackoverflow.com/q/25823358
type: Comment

http://stackoverflow.com/comment/90898652
has text: "`src/main/resources` is normally where you put non-Java artifacts that should be moved into the normal package hierarchy, like XML config files loaded as classpath resources." Yes, they're moved into the normal package hierarchy.
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25786667
type: AnswerComment

http://stackoverflow.com/q/25858027
answer count: 2
has answer: http://stackoverflow.com/a/25858078
has body: Using this line to get the text in an EditText field to get the string to translate texttotranslate = (String) txtText.toString(); I get errors of this type: 09-15 15:20:13.311: E/ATTN:(27603): android.widget.EditText{421dbeb8 VFED..CL .F...... 0,190-720,260 #7f0b0029 app:id/txtText}- your input where "(27603): android.widget.EditText{421dbeb8 VFED..CL .F...... 0,190-720,260 #7f0b0029 app:id/txtText" is the value found in texttotranslate. The actual input was supposed to be the word "yes". Has anyone seen errors of this type? Am I using toString() incorrectly?
tagged with: android
has title: Error using toString() with EditText
has answer: http://stackoverflow.com/a/25858037
accepted answer: http://stackoverflow.com/a/25858037
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25858078
score: 0

http://stackoverflow.com/comment/40258617
type: QuestionComment
has text: You definitely can't download the "middle" of a file (byte range requests are only really supported for video/audio files). You could open a URL as a stream like this: `URL url= new URL("http://www.amazon.com/Harry-Potter-Sorcerers-Stone-Book/dp/059035342X"); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));` but then you still have to parse the stream manually, which is going to be next to impossible, and do it before the file downloads anyway. Amazon have [various APIs](https://developer.amazon.com/); see if one of them helps.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25747010

http://stackoverflow.com/comment/40523810
type: Comment
comment on: http://stackoverflow.com/a/25792370
has text: I checked everything. Its a pretty simple code. Stream closing is proper. Still no luck :(
type: AnswerComment
score: 0

http://stackoverflow.com/q/25848655
has comment: http://stackoverflow.com/comment/40443835
has answer: http://stackoverflow.com/a/25848812
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40443742
has comment: http://stackoverflow.com/comment/40443816
has answer: http://stackoverflow.com/a/25848723
has body: I'm trying to make a basic program that allows the use to input and remove up to 10 contacts (a [10][4] array supposed to be filled with First Name, Last Name, Phone #, and age). However when I try to input the 5th contact eclipse gives me an error message. I'd like to know why I'm receiving an error message. (I assume it's something to do with the columns since it's whenever i'm inputting something >4, but i'm not sure what exactly.) import java.util.Scanner; public class Lab2 { public static void main(String[] args){ new Lab2 (); } // This will act as our program switchboard public Lab2 (){ Scanner input = new Scanner(System.in); String[][] personalInfo = new String[10][4]; System.out.println("Welcome to the contacts database."); System.out.println("Please select a number from the options below"); System.out.println(""); while(true){ // Give the user a list of their options System.out.println("1: Add a new contact."); System.out.println("2: Remove an existing contact."); System.out.println("0: Exit the database."); // Get the user input int userChoice = input.nextInt(); switch(userChoice){ case 1: addContact(personalInfo); break; case 2: removeContact(personalInfo); break; case 0: System.out.println("Thank you for using the contact database."); System.exit(0); } } } private void addContact(String personalInfo[][]) { Scanner input = new Scanner(System.in); System.out.println(); System.out.println( " Hello user, please enter your contact info. (I.E. First and Last Names, Phone #, and Age. Max 10 Contacts)"); String addedContact = input.nextLine(); int j; for(int i = 0; i &lt; personalInfo.length; i++) { for(j = 0; j &lt; personalInfo.length; j++){ if(personalInfo[i][j] == null) { personalInfo[i][j] = addedContact; break; } } } } private void removeContact(String personalInfo[][]) { Scanner input = new Scanner(System.in); System.out.print( " Please enter an existing contact that you would like to remove. "); String deleteContact = input.nextLine(); int i , j; for(i =…
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40443752
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40443684
tagged with: arrays
has title: Two-Dimensional Array of contacts (Java)
has answer: http://stackoverflow.com/a/25848997
tagged with: multidimensional-array
answer count: 3
has comment: http://stackoverflow.com/comment/40443964

http://stackoverflow.com/a/25755918
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40377137
has body: You should use BigDecimal instead of double, that way you won't lose precision. Can you show code in: thePdf.setFileSizeInMegaBytes() and thePdf.getFileSizeInMegaBytes()
type: Answer
accepted answer of: http://stackoverflow.com/q/25755797
answers question: http://stackoverflow.com/q/25755797
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/25742226
has comment: http://stackoverflow.com/comment/40254956
tagged with: java
has title: How to refresh a Map in java
type: Question
has body: i have a problem. i need to refresh positions on a GPS that shows truck and their position. Here is the code for displaying the truck: private static void addMarkerTruck(String name, double x, double y, int mVitesse) { BitmapDescriptor icon; double mLatitude =x; double mLongitude = y; Marker currentMarker = getMarker(name); if ( getMarker(name) != null) { currentMarker.setPosition(new LatLng(mLatitude, mLongitude)); } else { if (mVitesse &lt;= 0) { icon = BitmapDescriptorFactory.fromResource(R.drawable.truck_orange); } else if (mVitesse &gt; 5 &amp;&amp; mVitesse &lt; 90) { icon = BitmapDescriptorFactory.fromResource(R.drawable.truck_blue); } else { icon = BitmapDescriptorFactory.fromResource(R.drawable.truck_black); } Marker mark = mMap.addMarker(new MarkerOptions() .title(name) .position(new LatLng(mLatitude, mLongitude)) .snippet(String.valueOf("Vitesse: " + mVitesse + " km/h ")).icon(icon)); vehicles.put(name, mark); } //mark.setPosition(latlng); } And here is the refresh that doesn't work properly. public static void refreshMarkersPosition() { mMap.clear(); displayAllCar(); if (FragmentMainMenu.booleanShowPoi == 1) { displayAllPoi(); } }
has comment: http://stackoverflow.com/comment/40249535
has comment: http://stackoverflow.com/comment/40249633
answer count: 1
has answer: http://stackoverflow.com/a/25746883
tagged with: dictionary
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40252589
has comment: http://stackoverflow.com/comment/40251629
tagged with: refresh
has comment: http://stackoverflow.com/comment/40249384

http://stackoverflow.com/a/27940677
type: Answer
upvote count: 11
has comment: http://stackoverflow.com/comment/50191394
downvote count: 1
has comment: http://stackoverflow.com/comment/45708442
score: 10
has comment: http://stackoverflow.com/comment/45635478
has body: Steps I took to fix this : Close STS Delete folder cache on sts-3.6.0.RELEASE\p2\org.eclipse.equinox.p2.repository Run STS Select Window -> Preferences Expand Install/Update and select Available Software Sites Uncheck all update site, Except http://download.eclipse.org/releases/luna and save Select Help -> Check for updates Select Window -> Preferences Expand Install/Update and select Available Software Sites Check http://dist.springsource.com/release/TOOLS/update/e4.4/ and save Select Help -> Check for updates If u got error "STS.exe", just remove (backup first) STS.exe, and check for updates again.
answers question: http://stackoverflow.com/q/25824902

http://stackoverflow.com/q/25821677
type: Question
accepted answer: http://stackoverflow.com/a/25827170
tagged with: jpa
answer count: 1
tagged with: wildfly
has answer: http://stackoverflow.com/a/25827170
tagged with: maven
has body: I am trying to build up a Java (Java version build 1.8.0_11-b12) Maven Web Application (built up in NetBeans 8.0) that runs on Wildfly-8.1.0.Final using JPA (EclipseLink JPA 2.1) for accessing a MySQL database. The host system is Ubuntu 14.04 64Bit. I have successfully created the datasource on Wildfly to the database on MySQL. Testing the connection sends back a message saying it was successful. Therefore, I think Wildfly should be working fine. I then created a very simple Entity Class "Dog.java" for persisting. The problem comes up when I compile the WAR file and copy it for deployement on the Wildfly server. Wildfly sends back endless yellow warning messages and I am not able to kill Wildfly or Java. The only way out is to restart the entire operating system. Does anyone know this problem? Or das anyone see any problem in my configuration? Does maybe anyone know a Howto somewhere on the net that explains Step-by-Step how to create a Web Application for Wildfly accessing a database with JPA? I already tried to find one, but was not successful. Every help highly appreciated! Thanks in advance!
type: AnsweredQuestion
score: 0
has title: Building up Java Web Application with JPA for Wildfly fails?
tagged with: java
tagged with: mysql

swing
tags question: http://stackoverflow.com/q/25725969
tags question: http://stackoverflow.com/q/25818019
tags question: http://stackoverflow.com/q/25805694
tags question: http://stackoverflow.com/q/25727879
tags question: http://stackoverflow.com/q/25743102
tags question: http://stackoverflow.com/q/25738472
tags question: http://stackoverflow.com/q/25849166
tags question: http://stackoverflow.com/q/25744771
tags question: http://stackoverflow.com/q/25782118
tags question: http://stackoverflow.com/q/25825780
tags question: http://stackoverflow.com/q/25762772
tags question: http://stackoverflow.com/q/25832726
tags question: http://stackoverflow.com/q/25757055
tags question: http://stackoverflow.com/q/25742909
tags question: http://stackoverflow.com/q/25751022
tags question: http://stackoverflow.com/q/25843276
tags question: http://stackoverflow.com/q/25836423
tags question: http://stackoverflow.com/q/25824084
tags question: http://stackoverflow.com/q/25796095
tags question: http://stackoverflow.com/q/25784281
tags question: http://stackoverflow.com/q/25813213
tags question: http://stackoverflow.com/q/25725085
tags question: http://stackoverflow.com/q/25728344
tags question: http://stackoverflow.com/q/25814428
tags question: http://stackoverflow.com/q/25827652
tags question: http://stackoverflow.com/q/25836533
tags question: http://stackoverflow.com/q/25819241
tags question: http://stackoverflow.com/q/25844814
tags question: http://stackoverflow.com/q/25849576
tags question: http://stackoverflow.com/q/25816205
tags question: http://stackoverflow.com/q/25775182
tags question: http://stackoverflow.com/q/25763985
tags question: http://stackoverflow.com/q/25736778
tags question: http://stackoverflow.com/q/25819745
tags question: http://stackoverflow.com/q/25731000
tags question: http://stackoverflow.com/q/25845915
tags question: http://stackoverflow.com/q/25861041
tags question: http://stackoverflow.com/q/25770690
tags question: http://stackoverflow.com/q/25817092
tags question: http://stackoverflow.com/q/25714594
tags question: http://stackoverflow.com/q/25780009
tags question: http://stackoverflow.com/q/25734882
tags question: http://stackoverflow.com/q/25742509
tags question: http://stackoverflow.com/q/25789047
tags question: http://stackoverflow.com/q/25837024
tags question: http://stackoverflow.com/q/25755923
tags question: http://stackoverflow.com/q/25716380
tags question: http://stackoverflow.com/q/25860165
tags question: http://stackoverflow.com/q/25839303
tags question: http://stackoverflow.com/q/25746846
tags question: http://stackoverflow.com/q/25826637
tags question: http://stackoverflow.com/q/25749881
tags question: http://stackoverflow.com/q/25735470
tags question: http://stackoverflow.com/q/25735195
tags question: http://stackoverflow.com/q/25803810
tags question: http://stackoverflow.com/q/25827289
tags question: http://stackoverflow.com/q/25844196
tags question: http://stackoverflow.com/q/25748025
tags question: http://stackoverflow.com/q/25822901
tags question: http://stackoverflow.com/q/25763862
tags question: http://stackoverflow.com/q/25729689
type: Tag
tags question: http://stackoverflow.com/q/25802370
tags question: http://stackoverflow.com/q/25832882
tags question: http://stackoverflow.com/q/25817867
tags question: http://stackoverflow.com/q/25772314
tags question: http://stackoverflow.com/q/25769024
tags question: http://stackoverflow.com/q/25864244
tags question: http://stackoverflow.com/q/25736443
tags question: http://stackoverflow.com/q/25717366
tags question: http://stackoverflow.com/q/25759986
tags question: http://stackoverflow.com/q/25829652
tags question: http://stackoverflow.com/q/25739572
tags question: http://stackoverflow.com/q/25846488
tags question: http://stackoverflow.com/q/25836210
tags question: http://stackoverflow.com/q/25754454
tags question: http://stackoverflow.com/q/25735372
tags question: http://stackoverflow.com/q/25780348
tags question: http://stackoverflow.com/q/25864493
tags question: http://stackoverflow.com/q/25808451

http://stackoverflow.com/comment/40235305
comment on: http://stackoverflow.com/q/25734354
score: 0
type: Comment
type: QuestionComment
has text: The `dispose()` method is not special. What did you expect to happen, and how is that different from what happened?

http://stackoverflow.com/comment/40282891
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25759586
type: AnswerComment
has text: Excuse me. i read that link before your send topic but i'm using `call` method form `WSDLHelper` in all of project and i must be return result from it to use other methods and i can not **Remove** `WSDLHelper`. can i return result from it after get output with `processFinish`.for example: `LoginFields loginSoapParser = tsms.SoapParser(wsdlHelper.call(tsms.SoapObjectRequest));` please help me thanks

http://stackoverflow.com/comment/40484636
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25870404
score: 0
has text: Please add your marshalling code along with how are you reading the xml elements, I cannot figure out the main issue.

http://stackoverflow.com/a/25742975
downvote count: 0
answers question: http://stackoverflow.com/q/25742781
type: Answer
has comment: http://stackoverflow.com/comment/40251053
has comment: http://stackoverflow.com/comment/40251116
accepted answer of: http://stackoverflow.com/q/25742781
has body: Actually "NO". Since you use JMS aplications don't have to find each other on the network. It is a JMS, so they both just should know a Broker URL to connect, as for sending part as well as for receiving. You just need to configure application.properties correctly: spring.activemq.broker-url=tcp://192.168.1.210:9876 spring.activemq.user=admin spring.activemq.password=secret And continue to use the same @EnableAutoConfiguration on both sides.
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/25769458
tagged with: abstract
has comment: http://stackoverflow.com/comment/40299423
tagged with: types
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25769747
has body: I'm working on an Abstract Data Type called Pair in Java. It's supposed to take two objects and group them together in this data type. This is supposed to take less than 30 minutes, but I have been working at it for 3 and a half hours. I believe I have the first two methods right, but I cannot figure out reverse or equals. You can see what I attempted in the code: public class Pair&lt;T1,T2&gt; implements PairInterface&lt;T1,T2&gt; { // TO DO: Your instance variables here. public T1 first; public T2 second; public Pair(T1 aFirst, T2 aSecond) { first = aFirst; second = aSecond; } /* Gets the first element of this pair. * @return the first element of this pair. */ public T1 fst() { return this.first; } /* Gets the second element of this pair. * @return the second element of this pair. */ public T2 snd() { return this.second; } /* Gets a NEW pair the represents the reversed order * of this pair. For example, the reverse order of the * pair (x,y) is (y,x). * @return a NEW pair in reverse order */ public PairInterface&lt;T2,T1&gt; reverse() { return PairInterface&lt;this.snd(),this.fst()&gt;;//Pair&lt;second;first&gt; } /* Checks whether two pairs are equal. Note that the pair * (a,b) is equal to the pair (x,y) if and only if a is * equal to x and b is equal to y. * * Note that if you forget to implement this method, your * compiler will not complain since your class inherits this * method from the class Object. * * @param otherObject the object to be compared to this object. * @return true if this pair is equal to aPair. Otherwise * return false. */ public boolean equals(Object otherObject) { if(otherObject == null) { return false; } if(getClass() != otherObject.getClass()) { return false; } if (otherObject.fst.equals(this.fst) &amp;&amp; otherObject.snd.equals(this.snd)) { return true; } else { return false; } } /* Generates a string representing this pair. Note that * the String representing the pair (x,y) is "(x,y)". There * is no whitespace unless x or y or both con…
has comment: http://stackoverflow.com/comment/40299817
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40304589
score: 0
tagged with: java
upvote count: 1
downvote count: 1
has title: Trying to create an ADT that pairs two objects
accepted answer: http://stackoverflow.com/a/25769747
type: Question
has comment: http://stackoverflow.com/comment/40305104
has comment: http://stackoverflow.com/comment/40299508
linked to: http://stackoverflow.com/q/17551280
tagged with: adt
has comment: http://stackoverflow.com/comment/40299671
duplicate of: http://stackoverflow.com/q/17551280

http://stackoverflow.com/a/25947234
has body: I do not see you mention adding the Android support library android-support-v4.jar. You need to make sure Eclipse is properly including it for com.google.android.gms.maps.SupportMapFragment to work: Another potential issue is mismatch of play services library in your app and the play services verion on your nexus 5 device. If you downloaded the latest library from SDK manager, it may be higher version than the one on your device. I am guessing your play services version on device is 5.0.89, you can check on device Settings -&gt; Apps -&gt; Downloaded -&gt; Google Play Services. Try using older version of the library if that's the case.
accepted answer of: http://stackoverflow.com/q/25839336
answers question: http://stackoverflow.com/q/25839336
type: AcceptedAnswer
type: Answer
score: 0

http://stackoverflow.com/q/25819554
downvote count: 1
has answer: http://stackoverflow.com/a/25819622
has comment: http://stackoverflow.com/comment/40391391
has comment: http://stackoverflow.com/comment/40391414
has comment: http://stackoverflow.com/comment/40391392
type: AnsweredQuestion
has body: I have this code. public String Login(String email, String password) { String mode = ""; try { con = DriverManager.getConnection(url, userdb, passdb); Statement select = con.createStatement(); ResultSet result = select.executeQuery("SELECT * FROM doit WHERE DoitEmail='" + email + "' AND DoitPassword='" + password + "'"); if (result.first()) { mode = "doit"; } } catch (SQLException ex) { } return mode; } What seems to be the problem why is it not returning the value for mode inside the if statement. In other words, why is it not executing the if statement block, when I debug, it directly goes to return mode without setting new value for mode? UPDATE: Im using the new code... (it has the single quote at the end..) UPDATE2: Problem solved,,,
tagged with: java
accepted answer: http://stackoverflow.com/a/25819562
type: Question
answer count: 2
has title: Why is it not getting into the if condition?
has comment: http://stackoverflow.com/comment/40391431
favorite count: 0
has comment: http://stackoverflow.com/comment/40391442
score: 1
has answer: http://stackoverflow.com/a/25819562
upvote count: 2
possible better answer: http://stackoverflow.com/a/25819622
has comment: http://stackoverflow.com/comment/40391399

http://stackoverflow.com/a/25790928
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25789526
has body: Can you do something like this: public class MainApp extends Application { private Parent uiContent ; public static final double DEFAULT_WIDTH = 800 ; public static final double DEFAULT_HEIGHT = 600 ; public Parent getContent() { if (uiContent == null) { uiContent = initializeUI(); } return uiContent ; } public Scene createScene() { return new Scene(getContent(), DEFAULT_WIDTH, DEFAULT_HEIGHT); } public void initializeAndShowStage(Stage stage) { stage.setScene(createScene()); stage.show(); } private Parent initializeUI() { // probably wise to check we are on the FX Application thread here... Pane root = ... ; // build ui.... return root ; } @Override public void start(Stage primaryStage) throws Exception { initializeAndShowStage(primaryStage); } public static void main(String[] args) { launch(args); } } And public class UpdaterApp extends Application { @Override public void start(Stage primaryStage) throws Exception { // whatever you need to launch the updater app here... } // invoke from the FX Application Thread to "start" main app: private void showMainApp(Stage stage) { MainApp app = new MainApp(); app.initializeAndShowStage(stage); } private void showMainApp() { showMainApp(new Stage()); } public static void main(String[] args) { launch(args); } } This would be the far preferred approach. If you have requirements that force you to call main, then you could try something like this: public class MainApp extends Application { @Override public void start(Stage primaryStage) throws Exception { // .... build UI etc } public static void main(String[] args) throws Exception { if (Platform.isFXApplicationThread()) { Stage someStage = new Stage(); MainApp app = new MainApp(); app.start(stage); } else { launch(args); } } } Then your updater app can just call MainApp().main(new String[0])); from the FX Application Thread. This feels like a bit of a hack though.
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40481499
has comment: http://stackoverflow.com/comment/40445773
answers question: http://stackoverflow.com/q/25789526

http://stackoverflow.com/comment/40321726
type: Comment
has text: Thanks that worked ! I can now get the date and time in target timezone correctly . But I tried similar approach for day_of_week. It still points to the first timezone dayof weeek. How is this possible ?
comment on: http://stackoverflow.com/a/25781375
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40444792
has text: I have to question the point of such an endeavor - RSA 512 bits is already easily crackable (see [this](http://www.geek.com/news/512-bit-keys-cracked-in-6-weeks-549618/)), and that was over 10 years ago - now it wouldn't take anywhere near that long. I suppose you could use a lot of reflection to remove any such restrictions, or perhaps find a different JVM which allows such things, or maybe even implement your own RSA suite, but none of those would help the underlying security issue.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25849076
score: 1

http://stackoverflow.com/comment/40306901
comment on: http://stackoverflow.com/a/25773232
type: AnswerComment
score: 0
type: Comment
has text: Unfortunately, doesn't work since it's my own data type instantiated with <Person>.

http://stackoverflow.com/q/25764100
answer count: 1
tagged with: dayofweek
has answer: http://stackoverflow.com/a/25764372
has comment: http://stackoverflow.com/comment/40289444
favorite count: 0
has title: How to get day of week from day of month in java (android)?
linked to: http://stackoverflow.com/q/5270272
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40289202
upvote count: 1
duplicate of: http://stackoverflow.com/q/5270272
tagged with: java
tagged with: weekday
tagged with: date
downvote count: 1
type: Question
has body: I would like to get day of week from day of month. For example: I have a date: 2014-09-10 13:45:20 I parse this and get the day of month which is 10. Now i would like to know, that the 10. (tenth) day of the 9. month (September) in the year of 2014 is which day of the week? Just like Calendar.getInstance().get(Calendar.DAY_OF_WEEK); which is returns 1 for Monday, 2 for Tuesday, 3 for Wednesday... etc
score: 0
has comment: http://stackoverflow.com/comment/40289551
has comment: http://stackoverflow.com/comment/86883854

http://stackoverflow.com/a/25807848
has body: Try this way,hope this will help you to solve your problem. HashMap&lt;Integer,Boolean&gt; map = new HashMap&lt;Integer, Boolean&gt;(); Toast.makeText(context, text1, Toast.LENGTH_SHORT).show(); for (int i = 0; i &lt; rgroup.getChildCount(); i++) { RadioButton btn = (RadioButton) rgroup.getChildAt(i); if (btn.getId() == checkedId) { String text = btn.getText().toString(); map.put(btn.getId(),true); String text1 = user_answer.put(i+"", text); Toast.makeText(context, text1, Toast.LENGTH_SHORT).show(); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25807695

http://stackoverflow.com/a/25721466
upvote count: 2
answers question: http://stackoverflow.com/q/25721366
type: Answer
has comment: http://stackoverflow.com/comment/40210784
has body: You could use the FileStream.Read method to read a block of text and add it to another result string in a new Thread.
has comment: http://stackoverflow.com/comment/40215236
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25721366

http://stackoverflow.com/comment/40370137
score: 0
has text: Something like `pw = new PrintWriter( .... );` is missing. Change `pw` into `System.out` for testing.
comment on: http://stackoverflow.com/q/25808492
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25719025
upvote count: 1
has comment: http://stackoverflow.com/comment/40206335
score: 1
has comment: http://stackoverflow.com/comment/40207447
has body: Perhaps you have another service running on port 8080, or your kernel somehow has that port closed. Try configuring another port and see if the problem persists. Edit: Ok, here comes the actionable part: open a terminal and run netstat -t | grep 8080 This should show you anything currently listening on port 8080. As Ubuntu doesn't activate a firewall out of the box, this is very likely the source of the problem. Another edit: The original question did not state that you were on Android. This is a vital piece of information, as Android includes SELinux, which forbids opening a port without prior consent from the security layer. To allow opening the port, look here.
has comment: http://stackoverflow.com/comment/40207664
answers question: http://stackoverflow.com/q/25718980
downvote count: 0
has comment: http://stackoverflow.com/comment/40206839
type: Answer
has comment: http://stackoverflow.com/comment/40207401

http://stackoverflow.com/comment/40326241
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25782515
has text: @user3705478 please add the dependencies to your question so we can try it by our own.

classification
tags question: http://stackoverflow.com/q/25750959
tag name: classification
tags question: http://stackoverflow.com/q/25820706
tags question: http://stackoverflow.com/q/25808624
tags question: http://stackoverflow.com/q/25759687
type: Tag
tags question: http://stackoverflow.com/q/25839302

http://stackoverflow.com/comment/40451655
type: AnswerComment
comment on: http://stackoverflow.com/a/25852136
type: Comment
has text: @ChinmayKale - It matters. A `JFrame` is a particular type of `Container` that is intended to be shown as a top-level container for an app. A generic `Container` is pretty much any kind of visual component of a Java program that can hold other visual components. A `JFrame` itself contains a special `Container` called the _content pane_ in which most of its contained components are placed. (A `JFrame` also has a menu bar; other Swing container types may also have their own specialized components.) When you add components to a `JFrame`, they actually get added to its content pane.
score: 4

http://stackoverflow.com/q/25804776
has comment: http://stackoverflow.com/comment/40415666
has answer: http://stackoverflow.com/a/25849175
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40438653
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 0
accepted answer: http://stackoverflow.com/a/25849175
answer count: 1
has title: Parsing JSON response gives null value
tagged with: jackson
has body: My code which parse JSON: ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true); JsonNode rootNode = mapper.readTree(response.toString()); JsonNode entriesNode = rootNode.path("messages"); StoreMessageList objects = mapper.readValue(rootNode.toString(), new TypeReference&lt;StoreMessageLis(){}); Log.d("JacksonParser", objects.toString()); Below is my POJO class: @JsonIgnoreProperties(ignoreUnknown = true) public class StoreMessageList { private String location; @JsonProperty("messages") List&lt;MessageList&gt; messages; public StoreMessageList() { } public StoreMessageList(String location, List&lt;MessageList&gt; messages) { this.location = location; this.messages = messages; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public List&lt;MessageList&gt; getMessages() { return this.messages; } public void setMessages(List&lt;MessageList&gt; messages) { this.messages = messages; } @Override public String toString() { return "StoreMessageList:{location: " + location + ", messages: " + messages + "}"; } @JsonIgnoreProperties(ignoreUnknown = true) public class MessageList implements Serializable{ @JsonProperty("Text") private String Text; @JsonProperty("DetailPicture") private String DetailPicture; @JsonProperty("Title") private String Title; @JsonProperty("ListPicture") private String ListPicture; public MessageList() { } public MessageList(String Text, String DetailPicture, String Title, String ListPicture) { this.Text = Text; this.DetailPicture = DetailPicture; this.Title = Title; this.ListPicture = ListPicture; } public String getText() { return this.Text; } public void setText(String text) { this.Text = text; } public String getDetailPicture() { return this.DetailPicture; } public void setDetailPicture(String detailPicture) { this.DetailPicture = detailPicture; } public String getTitle() { return this.Title; } public void setTitle…

http://stackoverflow.com/comment/40257799
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25742725
has text: The example don't show how to manage revisions, just to save and retrieve.
score: 0

http://stackoverflow.com/comment/40330955
has text: thanks for the simple answer. Im really new to hashtables and maps and all related to it and didnt really understand the first answer.
type: Comment
comment on: http://stackoverflow.com/a/25778042
type: AnswerComment
score: 0

http://stackoverflow.com/q/25778117
has body: Right now, it makes number above 50 positive and numbers below 50 negative. How should I change the code to make it so that any number can be either positive or negative? public class P1G { static void main() { int[] a = new int[10]; for(int index = 0; index &lt; 10; index ++) { double r = Math.random(); int p = (int) (((100 - 0) + 1) * r + 0); // (-) or (+) if ( p &lt; 50 ) { int n = (int) (((100 - 0) + 1) * r + 0); n = n * -1; System.out.println(n); } else { int n = (int) (((100 - 0) + 1) * r + 0); n = n; System.out.println(n); } } } }
has comment: http://stackoverflow.com/comment/40315942
tagged with: java
has comment: http://stackoverflow.com/comment/40315605
has answer: http://stackoverflow.com/a/25778161
downvote count: 3
answer count: 3
has comment: http://stackoverflow.com/comment/40315910
has answer: http://stackoverflow.com/a/25778145
type: UnansweredQuestion
score: -3
has title: What should I change to make any random generated number positive or negative?
upvote count: 0
has comment: http://stackoverflow.com/comment/40315820
favorite count: 0
has comment: http://stackoverflow.com/comment/40315564
type: Question
has answer: http://stackoverflow.com/a/25778208

http://stackoverflow.com/comment/40441807
score: 2
has text: This conflates *function-try-block* and normal *try-block*. The latter is a statement (but not a compound statement). The former is not a statement at all.
comment on: http://stackoverflow.com/a/25847199
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25774068
has comment: http://stackoverflow.com/comment/40385449
score: 5
downvote count: 0
answers question: http://stackoverflow.com/q/25773886
type: Answer
has body: Since the JDK implementation of [Linked]HashMap does not permits you to override the equals/hashCode implementation, the only other ways are: a wrapping object like this: class A { private final String fieldA; // equals/hashCode based on that field. private final String fieldB; // equals/hashCode based on that field. } class B { private A a; public int hashCode() {return a.fieldA.hashCode();} public boolean equals(Object o) {... the same ... } } Map<B, Value> map = new HashMap<B, Value>(); map.put(new B(new A("fieldA", "fieldB")), new Value(0)); Well, with more getters/constructors. This can be annoying, and perhaps there exists some library (like Guava) that allows an equals/hashCode method to be given like you can give a Comparator to TreeMap. You'll find below a sample implementation that point out what to do to decorate an existing map. use a TreeMap with a specific Comparator. The other answer point it, but I'd say you'll need to correctly define a Comparator because this could lead to problems: if you compareTo method returns 0 when equality is reached, and 1 in other case, this means there is no natural ordering. You should try to find one, or use the wrapper object. If you want to take the challenge, you can create a basic implementation using delegation/decoration over another HashMap (this could be another kind of map, like LinkedHashMap): public class DelegatingHashMap<K,V> implements Map<K,V> { private final BiPredicate<K,Object> equalsHandler; private final IntFunction<K> hashCodeHandler; private final Map<Wrapper<K>,V> impl = new HashMap<>(); public DelegatingHashMap( BiPredicate<K,Object> equalsHandler, IntFunction<K> hashCodeHandler ) { this.equalsHandler = requireNonNull(equalsHandler, "equalsHandler"); this.hashCodeHandler= requireNonNull(hashCodeHandler, "hashCodeHandler"); } public Object get(K key) { Wrapper<K> wrap = new Wrapper<>(key); return impl.get(wrap); } ... static class Wrapper<K2> { private final K2 key; private final BiPredicate<K> eq…
upvote count: 5
has comment: http://stackoverflow.com/comment/40382827

http://stackoverflow.com/q/25788569
score: 1
accepted answer: http://stackoverflow.com/a/25791172
tagged with: entitymanager
favorite count: 0
has comment: http://stackoverflow.com/comment/40336059
has comment: http://stackoverflow.com/comment/40336598
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: transactions
has comment: http://stackoverflow.com/comment/40337910
tagged with: java
tagged with: spring-data
has title: Spring Data CrudRepository on java based configuration - EntityManager - no transaction is in progress
upvote count: 1
has comment: http://stackoverflow.com/comment/40335229
has body: I've read I believe tried all of the posts on this, but no luck in finding the right answer. I am using java based configuration with my spring mvc project, and wanted to try Spring CrudRepository, to get away from DAOs, and that is when the whole hell broke loose: started with "no transaction is in progress" on flush after persist: - tried adding @Transactional to the method - none of the variations found here worked - tried changing configuration, but since it is java based, most of the answers are xml based. no luck either. So finally I have to ask: How to configure my project to make CrudRepository persist, or how to create Spring EntityManager using java configuration. This is the last version of my configuration file: @Configuration @ComponentScan(basePackages = { "ba.fit.vms" }) @ImportResource(value = "classpath:spring-security-context.xml") @EnableTransactionManagement @EnableJpaRepositories public class AppConfig { @Bean public static PropertyPlaceholderConfigurer propertyPlaceholderConfigurer() { PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer(); ppc.setLocation(new ClassPathResource("/persistence.properties")); return ppc; } // Security Configuration @Bean public KorisnickiServis korisnickiServis(){ return new KorisnickiServis(); } @Bean public TokenBasedRememberMeServices rememberMeServices() { return new TokenBasedRememberMeServices("remember-me-key", korisnickiServis()); } @Bean public PasswordEncoder passwordEncoder() { return new StandardPasswordEncoder(); } // Jpa Configuration @Value("${dataSource.driverClassName}") private String driver; @Value("${dataSource.url}") private String url; @Value("${dataSource.username}") private String username; @Value("${dataSource.password}") private String password; @Value("${hibernate.dialect}") private String dialect; @Value("${hibernate.hbm2ddl.auto}") private String hbm2ddlAuto; @Bean public DataSource configureDataSource() { DriverManagerDataSource dataSource = new DriverManagerDataSourc…
has answer: http://stackoverflow.com/a/25791172
type: Question
has comment: http://stackoverflow.com/comment/40335906
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/40471213
type: Comment
comment on: http://stackoverflow.com/a/25863165
has text: I just saw your link with the supported encodings, the weird thing is that the ISO-8859-8-i is the only one that works, and its not even supported by java. I don't understand why !?!
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40272063
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25734770
type: AnswerComment
has text: @Zhaonan OIC...yes, you should be able to find a counter example to show that "drop the left part of A, and right part of B at the same time" is incorrect. I suggest first stepping through the algorithm with a debugger to get a deeper understanding of how it works. This might help you come up with the counter example you are looking for.

http://stackoverflow.com/q/25803121
type: Question
has comment: http://stackoverflow.com/comment/40551702
has comment: http://stackoverflow.com/comment/40552099
tagged with: ant
upvote count: 2
has comment: http://stackoverflow.com/comment/40512420
has answer: http://stackoverflow.com/a/25962288
answer count: 1
tagged with: junit
has body: I need to prepare a reporting system which will be displayed the code parts are used and not used by the application and in this particular case I'm going to use EMMA. However there will be no any test code next to project and emma will scan only the methods and give such a report like "20% are not using, %80 are in use" etc... Is this possible? If yes how should I configure ant without junit? (Please share sample ant code) Do I need to make something additional to work with jenkins?
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: Using Emma without Junit through Jenkins + ANT + Android
score: 2
downvote count: 0
tagged with: jenkins
has comment: http://stackoverflow.com/comment/40516791
tagged with: java
has comment: http://stackoverflow.com/comment/40591877

http://stackoverflow.com/q/25808785
favorite count: 0
duplicate of: http://stackoverflow.com/q/2422468
upvote count: 5
downvote count: 0
has body: I have a webform on JSP which has several string values and a file to uploaded to the server through a servlet. It is strange to see that I'm able to upload the file on to the server but not able to get the values in the servlet using request.getParameter("someString"). What's the problem with my code, or guide me? EDIT: With a bit of research, i have come to know that if i use enctype="multipart/form-data" in the form tag, i will not be able to get parameters in servlet using request.getParameter(). The question could be now, how can i send both a file and other values to a servlet for processing. webform.jsp: *ID riparazione *ID mandrino smontato *Service livello(SL) Attachment And uploadFile.java @WebServlet( name = "uploadFile", urlPatterns = { "/uploadFile" } ) public class uploadFile extends HttpServlet { private static final long serialVersionUID = 1L; private static final int THRESHOLD_SIZE = 1024 * 1024 * 3; private static final int MAX_FILE_SIZE = 1024 * 1024 * 15; private static final int MAX_REQUEST_SIZE = 1024 * 1024 * 20; /** * handles file upload via HTTP POST method */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // checks if the request actually contains upload file //ServletFileUpload.isMultipartContent(request); String idRiparazione = request.getParameter("idRiparazione"); String idMandrinoSmontato = request.getParameter("idMandrinoSmontato"); String serviceLivello = request.getParameter("serviceLivello"); PrintWriter out = response.getWriter(); out.println(" "); out.println(" "); out.println(" Hello Servlet Get "); out.println(idMandrinoSmontato); out.println(serviceLivello); out.println(" "); out.println(" "); DiskFileItemFactory factory = new DiskFileItemFactory(); factory.setSizeThreshold(THRESHOLD_SIZE); factory.setRepository(new File(System.getProperty("java.io.tmpdir"))); ServletFileUpload upload = new ServletFileUpload(factory); upload.setFileSizeMax(MAX_FILE_SIZE); …
type: AnsweredQuestion
tagged with: java
tagged with: file
linked to: http://stackoverflow.com/q/2422468
tagged with: forms
tagged with: servlets
type: Question
score: 5
answer count: 1
tagged with: jsp
has title: Form parameters not passing but File in the same form processed?
has answer: http://stackoverflow.com/a/25811948
accepted answer: http://stackoverflow.com/a/25811948

http://stackoverflow.com/comment/40373362
comment on: http://stackoverflow.com/q/25810350
has text: For each loop is a bit different for normal for loop. You need to understand that a for each loop we get the collection and use the iterator to loop though it.
score: 0
type: Comment
type: QuestionComment

recursion
type: Tag
tags question: http://stackoverflow.com/q/25778502
tags question: http://stackoverflow.com/q/25802459
tags question: http://stackoverflow.com/q/25835595
tags question: http://stackoverflow.com/q/25817980
tag name: recursion
tags question: http://stackoverflow.com/q/25796444
tags question: http://stackoverflow.com/q/25717040
tags question: http://stackoverflow.com/q/25831939
tags question: http://stackoverflow.com/q/25858862
tags question: http://stackoverflow.com/q/25857066
tags question: http://stackoverflow.com/q/25852643
tags question: http://stackoverflow.com/q/25857738
tags question: http://stackoverflow.com/q/25756948
tags question: http://stackoverflow.com/q/25782608
tags question: http://stackoverflow.com/q/25772669
tags question: http://stackoverflow.com/q/25847561
tags question: http://stackoverflow.com/q/25828740
tags question: http://stackoverflow.com/q/25829540
tags question: http://stackoverflow.com/q/25857255
tags question: http://stackoverflow.com/q/25811373
tags question: http://stackoverflow.com/q/25789477
tags question: http://stackoverflow.com/q/25755458
tags question: http://stackoverflow.com/q/25740352
tags question: http://stackoverflow.com/q/25755446
tags question: http://stackoverflow.com/q/25733029
tags question: http://stackoverflow.com/q/25854054

http://stackoverflow.com/comment/40446117
score: 0
has text: hey i made a mistake adding the log4j jar, its running without the error now. Thanks!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25847960

http://stackoverflow.com/q/25734689
linked to: http://stackoverflow.com/q/11260604
has comment: http://stackoverflow.com/comment/40235883
score: 0
has body: The text is stored in String variable and it is processed by some API to give me a hashmap which stores the keys and values. The keys are some specific words in text and value is a new word which will replace the key in the text. I have to process the text such that it will replace the keys with the value from hashmap but I have to leave the first instance of the key in the text as it is. Problem: I am able to replace all the instances which I am doing by iterating the hashmap and replacing the keys in the text. I want to leave the first matched key as it is. In string functions what I see is replace, replaceAll, replaceFirst. How should I handle this case. for eg: input: Example [2] This is a sample text. This is a sample text [69-3]. This is a sample [69-3] text. hashmap: {sample=sImple,text=text2,[69-3]=somenum} output: Example [2] This is a sample text. This is a sImple text2 [69-3]. This is a sImple text2 somenum. Also the key match is for the whole word and not a subString. like if name is the key and surname is the string in the text then it should not be matched and sur"name" should not be changed. I m using replaceAll instead of replace to do the replacement. Thanks in advance.
tagged with: regex
answer count: 4
has answer: http://stackoverflow.com/a/25755749
type: UnansweredQuestion
type: Question
has title: replace all string but first in text if present in hashmap
has answer: http://stackoverflow.com/a/25734941
has comment: http://stackoverflow.com/comment/40236311
tagged with: java
has answer: http://stackoverflow.com/a/25735114
has answer: http://stackoverflow.com/a/25734974

http://stackoverflow.com/q/25799030
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/25811182
type: Question
has body: jdbc.password= How can I assign jdbc.password key in my application.properties file an empty string? I understand I can do this programmatically as follows, but I would like to set this in properties file. Properties props = new Properties(); props.put("password", "");
answer count: 1
score: 22
favorite count: 0
accepted answer: http://stackoverflow.com/a/25799053
tagged with: security
has title: Set empty string as the value of a key in properties file
upvote count: 22
has answer: http://stackoverflow.com/a/25799053
downvote count: 0
tagged with: web-applications
tagged with: properties
tagged with: passwords

http://stackoverflow.com/a/25744598
score: 1
answers question: http://stackoverflow.com/q/25729002
downvote count: 0
has body: Here it is clearly saying you are putting a null value for a property which is declared as a not null property. You are directly setting the objects with out any values.So person id is setting null.But you configured it as a not null.Check it once.
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40343191
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25793564
has text: can you add the exception, please?
type: Comment

http://stackoverflow.com/q/25841715
answer count: 1
tagged with: jinternalframe
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25842526
tagged with: swing
type: Question
has body: i'm making a program, and I have 1 JFrame with JDesktopPane in this frame i open two JInternalFrame and I want to pass data between this two JInternalFrame but with JTextField. I'm just made to pass the data but it doesn't update the JInternalFrame that i want to show. But if i choose to open again it show me the data. Please Help me! THANKS In this JInternalFrame 2 i sent the data to another JInternalFrame 1 private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { String word = jTxtIDACA.getText(); DatosPersonales frame = new DatosPersonales(); frame.getData(word); frame.setVisible(true); this.getDesktopPane().add(frame); this.dispose(); } this is JInternalFrame 1 and i have public void getData(String word){ initComponents(); this.word = word; jTxtIDACA.setText(word); }
has title: How to pass data between two JInternalFrame?
has comment: http://stackoverflow.com/comment/40432433
has comment: http://stackoverflow.com/comment/40431736
score: 0
accepted answer: http://stackoverflow.com/a/25842526

http://stackoverflow.com/comment/40365141
comment on: http://stackoverflow.com/q/25805507
type: Comment
type: QuestionComment
score: 0
has text: Please post your error.

http://stackoverflow.com/comment/40397192
comment on: http://stackoverflow.com/a/25821956
type: Comment
has text: i have edited my solution. See above. Problem seems to be with your configuration file.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25741003
has body: According to your comment to the question, the following line returns null: ImageView promoIcon = (ImageView) findViewById(R.id.icon_promo); This means that findViewById did not find the view you're looking for, so trying to access the object in this line promoIcon.setVisibility(View.VISIBLE); fails, as promoIcon == null and you can not call any methods on null. That's exactly what the exception message says: One of the object variables you were trying to use was not initialized. Your job is to by debugging find out which one :-)
answers question: http://stackoverflow.com/q/25740369
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25740369

http://stackoverflow.com/a/25831152
score: 2
has comment: http://stackoverflow.com/comment/40412106
has comment: http://stackoverflow.com/comment/40412174
answers question: http://stackoverflow.com/q/25831139
downvote count: 0
has comment: http://stackoverflow.com/comment/40411987
upvote count: 2
type: Answer
has body: It's because a fragment doesn't have a method findViewById(). You can either call that method on your activity: getActivity().findViewById() Or just use the layout that you've just inflated and find view's inside of it: rootView.findViewById() The 2nd one is better (IMO) as it doesn't rely on the activity.

http://stackoverflow.com/q/25784845
has title: Can't locate error origin
has comment: http://stackoverflow.com/comment/40327202
has comment: http://stackoverflow.com/comment/40327706
tagged with: exception
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25785134
has body: I get this weird error in my MainActivity, can't reproduce it myself but this is what I get in Crash report: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=65538, result=0, data=null} to activity {lv.mobi.android/lv.mobi.android.MainActivity}: java.lang.NullPointerException at android.app.ActivityThread.deliverResults(ActivityThread.java:3455) at android.app.ActivityThread.handleSendResult(ActivityThread.java:3498) at android.app.ActivityThread.access$1300(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:212) at android.app.ActivityThread.main(ActivityThread.java:5135) 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:877) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at lv.mobi.android.b.aj.a(Unknown Source) at android.support.v4.app.FragmentActivity.onActivityResult(Unknown Source) at lv.mobi.android.MainActivity.onActivityResult(Unknown Source) at android.app.Activity.dispatchActivityResult(Activity.java:5423) at android.app.ActivityThread.deliverResults(ActivityThread.java:3451) ... 11 more I thought it could be something in onActivityResult, but can't figure out what, my result function doesn't have much in it: @Override protected void onActivityResult(int _requestCode, int _resultCode, Intent _data) { super.onActivityResult(_requestCode, _resultCode, _data); if(_resultCode==Activity.RESULT_OK){ reloadUser(); } }
possible better answer: http://stackoverflow.com/a/25785248
type: Question
has answer: http://stackoverflow.com/a/25785248
has comment: http://stackoverflow.com/comment/40327230
has comment: http://stackoverflow.com/comment/40327189
tagged with: java
has comment: http://stackoverflow.com/comment/40327823
accepted answer: http://stackoverflow.com/a/25785134
score: 0
answer count: 2

http://stackoverflow.com/q/25775190
upvote count: 1
has body: In my while loop for my OpenGL program i have some something like this: if (Keyboard.isKeyDown(Keyboard.KEY_W)) { ... } Now of course this if is getting checked multiple times per button press. Is there a way to let it detect the button only once per press? For example like the KeyListener in Java Swing does. I already handle movement speed with an elapsedTimevariable, maybe I can use that for that problem too?
tagged with: input
accepted answer: http://stackoverflow.com/a/25788670
favorite count: 0
has comment: http://stackoverflow.com/comment/40312800
tagged with: lwjgl
has answer: http://stackoverflow.com/a/25788670
possible better answer: http://stackoverflow.com/a/25776042
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25776042
has comment: http://stackoverflow.com/comment/40311114
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40313187
has title: Reading a KeyDown only once in while loop (Like KeyListener in Swing)
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40310558
has comment: http://stackoverflow.com/comment/40312101

http://stackoverflow.com/q/25749761
tagged with: layout-inflater
type: Question
tagged with: android-layout
has body: I found an solution A big thank you to cyroxis for the constructive criticism and suggestions that led me into the correct direction. At the beginning I thought it isn't the accepted answer, but after some thinking I am sure it is. Nevertheless I want to provide some additionale informations that matches my case more precisely. You can find the solution text at the bottom of this post Original question my first question here. :-) Let's start: I wonder if there is a simple way (through the API, maybe?!) to avoid a unnecessary deep view hierarchy when using LayoutInflater inside a custom class that extends a ViewGroup e.g. LinearLayout. For example This is an Android xml layout file "my_xml_layout.xml" &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"&gt; &lt;TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="New Text" android:id="@+id/textView" /&gt; &lt;ImageView android:layout_width="64dp" android:layout_height="64dp" android:id="@+id/imageView" android:layout_gravity="center_horizontal" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New Button" android:id="@+id/button" android:layout_gravity="center_horizontal" /&gt; &lt;/LinearLayout&gt; And now I want to encapsulate the layout into a custom view and control the behavior and interaction of all its components (the TextView, the Button and the ImageView). So I create a class which extends e.g LinearLayout like this one public class MyCustomView extends LinearLayout { public MyCustomView(Context context) { super(context); inflateLayout(context); } public MyCustomView(Context context, AttributeSet attrs) { super(context, attrs); inflateLayout(context); } public MyCustomView(Context context, AttributeSet attrs, int defStyle) { super(context, attr…
downvote count: 0
has comment: http://stackoverflow.com/comment/40295723
upvote count: 2
answer count: 1
accepted answer: http://stackoverflow.com/a/25750238
has comment: http://stackoverflow.com/comment/40293375
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
tagged with: android
has answer: http://stackoverflow.com/a/25750238
type: AnsweredQuestion
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40292738
has title: Android: How to avoid doubling ViewGroups with LayoutInflater

http://stackoverflow.com/q/25806349
has body: I have a pretty embarrassingly simple problem with the Canvas in JavaFx. I need to implement trivial paint/erase tools, and I've got the paint tool working, but I can't get the erase to work. I've tried clip() and clearRect() but neither do anything in my case.. not sure what I am doing wrong there. But, ideally, I would like the erase tool to work in the same manner as the paint tool (just with bigger stroke), not with the clearRect()-method. Can I achieve this with the blending modes or something? Here's my current code: canvas.setOnMousePressed(e -&gt; { if (e.getButton() == MouseButton.PRIMARY) { if (erasing) { } else { gfx.beginPath(); gfx.moveTo(e.getX(), e.getY()); gfx.stroke(); } e.consume(); } }); canvas.setOnMouseDragged(e -&gt; { if (e.getButton() == MouseButton.PRIMARY) { if (erasing) { } else { gfx.lineTo(e.getX(), e.getY()); gfx.stroke(); } e.consume(); } });
has comment: http://stackoverflow.com/comment/40377388
answer count: 0
tagged with: javafx
type: Question
has title: JavaFx Canvas Eraser Tool
tagged with: java
has comment: http://stackoverflow.com/comment/40369201
score: 0
has comment: http://stackoverflow.com/comment/40369435
type: UnansweredQuestion

http://stackoverflow.com/q/25752437
has title: Client Socket Programming: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
has comment: http://stackoverflow.com/comment/40268664
has body: I am trying to get the host address by passing host name. But while running my code, I get the exception: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at socketprogram_client.SocketProgram_Client.main(SocketProgram_Client.java:16) Java Result: 1 Can anyone please tell me why I am getting this error? Here is my code: package socketprogram_client; import java.io.*; import java.net.*; public class SocketProgram_Client { public static void main ( String args[] ) throws IOException { String host_name = args[0]; try { InetAddress my_ipaddr = InetAddress.getByName(host_name); System.out.println("Resolved to IP address: " + my_ipaddr.getHostAddress()); } catch ( UnknownHostException e ) { System.out.println("Could not find IP address for: " + host_name); } } }
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40268635
has answer: http://stackoverflow.com/a/25752652
answer count: 1
accepted answer: http://stackoverflow.com/a/25752652
has comment: http://stackoverflow.com/comment/40268509
has comment: http://stackoverflow.com/comment/40269237
score: 0
has comment: http://stackoverflow.com/comment/40268658

http://stackoverflow.com/q/25873507
has title: How to return two multidimetional arrays from same java method?
has body: I would like to know how to return two multidimentional arrays from the same method: public static arraysReturn() { int [][] A={{1,2},{2,3},{4,5}}; int [][] B={{1,2},{2,3},{4,5}}; return A,B; }
favorite count: 0
has answer: http://stackoverflow.com/a/25873557
answer count: 3
tagged with: matrix
possible better answer: http://stackoverflow.com/a/25873524
has answer: http://stackoverflow.com/a/25873524
tagged with: return
accepted answer: http://stackoverflow.com/a/25873557
has comment: http://stackoverflow.com/comment/40489322
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/25873526
downvote count: 0
score: 4

http://stackoverflow.com/comment/40396798
score: 0
type: QuestionComment
type: Comment
has text: @trashgod--One last thought: All I really need to do is just MOVE into a different class file all the modules that COULD be placed elsewhere and make sure include as little as possible likely-to-change logic in the Swing-built class file. Meanwhile, just pan down to look for the blue arrows indicating MY changes, which is still a pain, but I guess it's the price I'll pay until I revamp the UI.
comment on: http://stackoverflow.com/q/25817867

http://stackoverflow.com/q/25751993
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25752586
type: Question
tagged with: session
has comment: http://stackoverflow.com/comment/40267851
score: 0
has comment: http://stackoverflow.com/comment/40268147
answer count: 1
has comment: http://stackoverflow.com/comment/40268103
accepted answer: http://stackoverflow.com/a/25752586
has body: I can't find a solution for setting an associations using DAO. It needs to be explain. There are 3 entities: Bank, Client and Account. Bank and Client have bidirectional many-to-many association, Client and Account have one-to-many association. There is GenericDAO interface which is implemented by each entity's DAO. As application is not-multithreading I decided to realize session-per-request "pattern" by opening and closing session in each method of DAO-interface implementations. Please take a look at the code. The problem is described below the code. Bank POJO @Entity @Table(name = "bank") public class Bank { private int bankID; private String bankName; private Set&lt;Client&gt; setOfClients; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "bank_id") public int getBankID() { return bankID; } public void setBankID(int bankID) { this.bankID = bankID; } @Column(name = "bank_name") public String getBankName() { return bankName; } public void setBankName(String bankName) { this.bankName = bankName; } @ManyToMany(mappedBy = "setOfBanks", fetch = FetchType.EAGER) public Set&lt;Client&gt; getSetOfClients() { return setOfClients; } public void setSetOfClients(Set&lt;Client&gt; setOfClients) { this.setOfClients = setOfClients; } }** Client POJO @Entity @Table(name = "client") public class Client { private int clientID; private String firstName; private String secondName; private Set&lt;Account&gt; setOfAccounts; private Set&lt;Bank&gt; setOfBanks; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "client_id") public int getClientID() { return clientID; } public void setClientID(int clientID) { this.clientID = clientID; } @Column(name = "first_name") public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @Column(name = "second_name") public String getSecondName() { return secondName; } public void setSecondName(String secondName) { this.secondName = secondName; …
has title: Hibernate: how to deal with Session in DAO to set associations properly?
type: AnsweredQuestion

http://stackoverflow.com/a/41060083
has body: If you are using WPA_PSK authentication, you have to specify preSharedKey. netConfig.preSharedKey = "testPassword"; netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); Otherwise it will crash and restart the device.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25766425

http://stackoverflow.com/a/25783596
type: Answer
has body: i guess i have solved it now with two steps: 1.) I used the MP3 SPI from http://www.javazoom.net/mp3spi/sources.html to play sounds 2.) I have a Netbeans maven project and i use filtering in case of resources, so i have to exclude the folder where sounds are saved, otherwise the sound files become corrupted when Netbeans is copying files to target folder and are not recognized as mp3 files anymore: resources ../resources true data/sounds/** resources ../resources false data/sounds/** Now, even short mp3 files works as expected!
score: 0
answers question: http://stackoverflow.com/q/25763580

http://stackoverflow.com/a/25812653
accepted answer of: http://stackoverflow.com/q/25812583
has comment: http://stackoverflow.com/comment/40378895
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40379195
has comment: http://stackoverflow.com/comment/40378984
type: Answer
has comment: http://stackoverflow.com/comment/40378289
has comment: http://stackoverflow.com/comment/40378818
has comment: http://stackoverflow.com/comment/40380461
score: 2
answers question: http://stackoverflow.com/q/25812583
has comment: http://stackoverflow.com/comment/40379132
has body: The problem is that Integer.parseInt without a radix will interpret the string as a decimal number, not binary. Most such "binary" strings will represent numbers that are over the maximum integer possible, a little over 2 billion, e.g. 111,000,101,010,001. Pass in a radix of 2 (binary) to Integer.parseInt: int temp = Integer.parseInt(toBinary, 2); However, if the first "bit" is set, then the represented number will be over Integer.MAX_VALUE, and then only Long.parseLong will work.

http://stackoverflow.com/comment/40437457
has text: i changed the content type : application/octet-stream and rest as u said. It is working perfectly awesome. Thank you so much.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25844530
score: 0

http://stackoverflow.com/q/25744408
has body: I want to parse an array from Server but I can't obtain the array Here is the jsonString Successfully got : { "status":"OK", "message":"this is your start and end coordinates", "data":"{\"start\":[\"35.778763\",\"51.427360\"],\"end\":[\"35.768779, 51.415002\"]}" } I want the Double Values from data arraylist: //try/catch Log.d(TAG, "Passes here"); JSONObject jObject = new JSONObject(jsonString); JSONArray jData = jObject.getJSONArray("data"); Log.d(TAG, "Not PAASING HERE !!! "); JSONArray jArrayStart = (JSONArray) jData.get(0); JSONArray jArrayEnd = (JSONArray) jData.get(1); latitudeStart = (Double) jArrayStart.get(0); longtitudeStart = (Double) jArrayEnd.get(1); latitudeEnd = (Double) jArrayEnd.get(0); longtitudeEnd = (Double) jArrayEnd.get(1);
answer count: 3
has answer: http://stackoverflow.com/a/25744943
tagged with: parsing
favorite count: 0
upvote count: 2
tagged with: android
possible better answer: http://stackoverflow.com/a/25744456
has answer: http://stackoverflow.com/a/25744456
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25744630
accepted answer: http://stackoverflow.com/a/25744943
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
downvote count: 1
type: Question
has title: Parse Json array without keys
tagged with: arrays

http://stackoverflow.com/a/25877886
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25838996
type: Answer
answers question: http://stackoverflow.com/q/25838996
score: 1
upvote count: 1
has body: Make sure that you are indeed releasing the connection back to the pool? Can you use try with resources (in addition to increasing threshold as Brett mentioned): try (Connection conn = DBConnectionPool.getConnection(); PreparedStatement ps = conn.prepareStatement(preparedQuery);) { and the resultset (because some drivers/databases may not clean out resultset when connection is cleaned though not sure if this is still valid for new drivers/databases but I'm not sure what you are using): try (ResultSet rs = ps.executeQuery();) { Increase the leak detection threshold if needed though I think if you have to make it too large, you have an issue which needs to be fixed.
type: AcceptedAnswer

http://stackoverflow.com/q/25842952
tagged with: content-repository
has title: Minimum set of libraries required to use Jackrabbit JCR implementation?
has answer: http://stackoverflow.com/a/25999760
score: 0
tagged with: java
has body: I am planning to user Jackrabbit for developing an online document library. To develop simple POCs, i have put the jackrabbit-standalone.jar inside my class path and everything works fine. But on opening the jackrabbit-standalone.jar, i found out that it's a web project in itself. I copied all the jars from jackrabbit-standalone.jar/WEB-INF/lib and kept in my class path and my project again works fine. My concern here is that I don't want to keep any extra jars in my project. So my question is : What are the minimal jars which are required to interact with Jackrabbit repository? What is the best way of using jackrabbit in a web project, as per enterprise standards. Is it using standalone jar in the class path or using only the required jars?
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/26008553
tagged with: jcr
tagged with: jackrabbit
type: UnansweredQuestion

http://stackoverflow.com/comment/40461795
comment on: http://stackoverflow.com/a/25858225
type: Comment
score: 0
type: AnswerComment
has text: I tried this and it would not let the user enter another currency type after runing the program once

http://stackoverflow.com/comment/40236071
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25734635
has text: Nit Pick: Pretty sure `JPanel` doesn't have a `dispose` method - not sure if this is what you meant, but that's how it read ;)
type: AnswerComment

http://stackoverflow.com/a/25787726
type: AcceptedAnswer
score: 6
type: Answer
answers question: http://stackoverflow.com/q/25787711
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25787711
upvote count: 6
has body: You should check out BigInteger

http://stackoverflow.com/comment/40392772
comment on: http://stackoverflow.com/q/25820308
has text: i use only dispose because net-bean drag and drop automatically set setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25823378
upvote count: 0
downvote count: 5
has comment: http://stackoverflow.com/comment/40398246
has body: I updated my java VM to v8. But still my command promt shows version is 1.8 and i am unable to run java commands in PC. What is the exact issue ? give me some suggestions to rectify this.....
answer count: 1
has comment: http://stackoverflow.com/comment/40397839
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/25823463
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40397803
score: -5
tagged with: java
has title: how to know current java VM version
type: Question

http://stackoverflow.com/comment/40579275
type: Comment
has text: It's not clear what you're trying to achieve - are you trying to get the value of `T`?
type: AnswerComment
comment on: http://stackoverflow.com/a/25900608
score: 0

http://stackoverflow.com/comment/40201301
type: QuestionComment
has text: What part are you having difficulty with? Figuring out which lines have points in common? Figuring out when a set of lines forms a loop? Figuring out if that loop is a proper polygon with non-overlapping lines?
comment on: http://stackoverflow.com/q/25716292
score: 0
type: Comment

http://stackoverflow.com/q/25734921
has answer: http://stackoverflow.com/a/25734927
type: Question
has comment: http://stackoverflow.com/comment/40236553
has comment: http://stackoverflow.com/comment/40236317
has body: I'm getting a weird problem in Eclipse. I'm trying to set a boolean to null, but I am getting an error. How can I fix this and why is this happening?
has answer: http://stackoverflow.com/a/25734959
downvote count: 4
has title: Type mismatch: cannot convert from null to boolean
has comment: http://stackoverflow.com/comment/40236286
has answer: http://stackoverflow.com/a/25735044
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/25734934
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40236275
answer count: 4
has comment: http://stackoverflow.com/comment/40236475
upvote count: 3
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/25796670
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25796003
type: Answer
downvote count: 0
score: 1
has body: I would use a custom ArrayAdapter which sets the color based on position in getView Something like MainActivity.java public class MainActivity extends Activity { ListView mainList; String[] listContent = { "Line 1", "Line 2", "Line 3", "Line 4" }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mainList = (ListView)findViewById(R.id.main_listView); MyColoringAdapter adapter = new MyColoringAdapter(this,listContent); mainList.setAdapter(adapter); mainList.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { //When clicked, go to specific activity Toast.makeText(getApplicationContext(),"Clicked on list item "+position,Toast.LENGTH_SHORT).show(); switch (position) { case 0: //code specific to first list item break; case 1: //code specific to second list item break; } } }); } private class MyColoringAdapter extends ArrayAdapter<String> { private final Context context; private final String[] values; public MyColoringAdapter(Context context, String[] values) { super(context, R.layout.list_item, values); this.context = context; this.values = values; } @Override public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = inflater.inflate(R.layout.list_item, parent, false); TextView textView = (TextView) rowView.findViewById(R.id.list_textview); // Set text textView.setText(values[position]); // Set color depending on position int textColorId = R.color.black; // Default color switch (position%2) { case 0: // Even places textColorId = R.color.red; break; case 1: // Odd places textColorId = R.color.green; break; } textView.setTextColor(getResources().getColor(textColorId)); return rowView; } } } list_item.xml <?xml version="1.0" encoding="utf-8"?> <TextV…
answers question: http://stackoverflow.com/q/25796003

http://stackoverflow.com/comment/40415345
has text: Be more descriptive in you're question please!
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25833022
type: QuestionComment

http://stackoverflow.com/a/25735780
type: Answer
has body: First change SharedPreferences sharedPreferences = getSharedPreferences("wallpaperapp",0); To SharedPreferences sharedPreferences = getPreferences(MODE_PRIVATE); Whenever you change the wallpaper, you should save the resource id of the newly changed wallpaper to your shared preferences file, in your onClick method: sharedPreference.edit().putInt(KEY, v.getId()).commit(); Note* The KEY variable in the putInt method is a constant which you will have to define, it is the name of the preference you want to change, you can give it the value "wallpaperapp" Now you can simply retrieve the id when the phone has finished booting. Using the same KEY int retrievedImageID = sharedPreference.getInt(KEY, someDefaultValue); then simply set the image display.setImageResource(retrievedImageID); Here is android official documentation on sharedPreferences http://developer.android.com/training/basics/data-storage/shared-preferences.html your MainActivity will look something like ths: public class MainActivity extends Activity implements OnClickListener { // add these variables public static final String KEY = "wallpaperapp" private SharedPreferences sharedPreference; private int retrievedImageID; protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_main); //add these lines sharedPreference = getPreferences(MODE_PRIVATE); changeWallpaper(); } public void onClick(View v) { switch(){} // add this line below the switch statement sharedPreference.edit().putInt(KEY, v.getId()).commit(); } //add this method public void changeWallpaper(){ int someDefaultValue = R.id.iv1; retrievedImageID = sharedPreference.getInt(KEY, someDefaultValue); display.setImageResource(retrievedImageID); } And your boot receiver: public void onReceive(Context context,Intent intent){ // comment out the existing code in here // and add the following lines Intent in = new Intent(context, MainActivity.class); // these flags must be set for the receiver to start the activity in.setFlags( In…
has comment: http://stackoverflow.com/comment/40263055
has comment: http://stackoverflow.com/comment/40263100
has comment: http://stackoverflow.com/comment/40259139
has comment: http://stackoverflow.com/comment/40263538
has comment: http://stackoverflow.com/comment/40252812
upvote count: 1
has comment: http://stackoverflow.com/comment/40263479
score: 1
has comment: http://stackoverflow.com/comment/40263216
has comment: http://stackoverflow.com/comment/40263287
has comment: http://stackoverflow.com/comment/40262803
downvote count: 0
has comment: http://stackoverflow.com/comment/40261836
has comment: http://stackoverflow.com/comment/40261443
answers question: http://stackoverflow.com/q/25735088
has comment: http://stackoverflow.com/comment/40262139
has comment: http://stackoverflow.com/comment/40262005

http://stackoverflow.com/q/25792333
has title: Eclilpse changing the context root of WebLogic web application
upvote count: 3
type: UnansweredQuestion
tagged with: web-applications
tagged with: war
has answer: http://stackoverflow.com/a/49881744
type: Question
score: 3
has answer: http://stackoverflow.com/a/50748456
tagged with: weblogic
tagged with: java
has body: For some reason my Eclipse sometimes changes the context root of my web application in the weblogic.xml file to the name of the project. The name of the project is different from the context root. How do I prevent this?
tagged with: eclipse
answer count: 2
has comment: http://stackoverflow.com/comment/40345220
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/16617595

http://stackoverflow.com/comment/40213886
score: 0
has text: Thanks, thats pretty interesting.
comment on: http://stackoverflow.com/q/25722136
type: Comment
type: QuestionComment

http://stackoverflow.com/a/26018325
has body: With your current code, your 'scheduler' starts immediatly after sch.start(), so I am guessing you want to know how force your Job to trigger when your 'scheduler' starts. If so, you can not achieve this with only a cron expression but I have two solutions for you. If you want your Job to be trigger at start and then every ten minutes after, consider using a SimpleScheduleBuilder. In your code, replace the CronExpressionSchedule : Trigger trigger = TriggerBuilder.newTrigger() .withIdentity("trigger1", "Group2") .withSchedule(ScheduleBuilder.simpleSchedule() .withIntervalInMinutes(10) .repeatForever()) .startNow() .build(); If you want your Job to trigger at start and then fires on a scheduling based on your Cron expression. Consider using a second trigger : [...] Trigger trigger2 = TriggerBuilder.newTrigger() .withIdentity("trigger2", "Group2") .withSchedule(ScheduleBuilder.simpleSchedule()) .startNow() .build(); [...] sch.start(); sch.scheduleJob(job, trigger); sch.scheduleJob(job, trigger2);
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25843425
upvote count: 1

http://stackoverflow.com/comment/40269578
score: 1
has text: You probably modified the key after it was put in the HashMap. Since it doesn't have the same hashCode than it had when put in the map, it's still in the keySet, but get() doesn't find it in the bucket where it should be according to its new hashCode.
type: Comment
comment on: http://stackoverflow.com/q/25752910
type: QuestionComment

http://stackoverflow.com/a/25873731
answers question: http://stackoverflow.com/q/25871763
upvote count: 1
has body: You can have a look at the API for [DatagramSocket]: http://docs.oracle.com/javase/7/docs/api/java/net/DatagramSocket.html You will have to somehow find the amount of data that you are supposed to receive. This can be exchanged by the sender at the beginning. If you are only responsible for constructing the server then DatagramSocket(int port); // Port is the port number to which ur server will be listening. byte[] buffer = new byte[1024]; // A byte array of 1024 bytes is allocated DatagramPacket packetData = new DatagramPacket(buffer, buffer.length); datagramSocket.receive(packetData ); // This is a blocking call and will wait for you to recieve data. Incase you want the data recieve to stop then execute the above within a loop and look for the end of the data stream.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/40201334
type: QuestionComment
score: 2
has text: *"I need JTextArea because it supports multiple lines."* So does a `JLabel` ..or a `JButton` for that matter.
type: Comment
comment on: http://stackoverflow.com/q/25716380

performance
tags question: http://stackoverflow.com/q/25738252
tags question: http://stackoverflow.com/q/25723390
tags question: http://stackoverflow.com/q/25808175
tags question: http://stackoverflow.com/q/25756296
tags question: http://stackoverflow.com/q/25763946
tags question: http://stackoverflow.com/q/25811112
tags question: http://stackoverflow.com/q/25832013
tags question: http://stackoverflow.com/q/25855861
tags question: http://stackoverflow.com/q/25840733
tags question: http://stackoverflow.com/q/25737365
tags question: http://stackoverflow.com/q/25856048
tags question: http://stackoverflow.com/q/25815654
tags question: http://stackoverflow.com/q/25864740
tags question: http://stackoverflow.com/q/25777574
tags question: http://stackoverflow.com/q/25845204
tags question: http://stackoverflow.com/q/25840793
tags question: http://stackoverflow.com/q/25838995
tags question: http://stackoverflow.com/q/25843170
tags question: http://stackoverflow.com/q/25811077
tags question: http://stackoverflow.com/q/25774785
tag name: performance
tags question: http://stackoverflow.com/q/25857594
type: Tag
tags question: http://stackoverflow.com/q/25798876
tags question: http://stackoverflow.com/q/25738652
tags question: http://stackoverflow.com/q/25871015

http://stackoverflow.com/comment/40466190
comment on: http://stackoverflow.com/q/25832948
has text: I am using NetBeans IDE 7.4 platform and its clean and build project item to create jar file
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25791843
has answer: http://stackoverflow.com/a/25791875
linked to: http://stackoverflow.com/q/5775866
downvote count: 3
answer count: 3
upvote count: 1
has body: I have a need to take a long and round its value down to the nearest 10s place. Hence: If the # is: Then it should become: ============================================== 243 240 288485 288480 6 0 107 100 1009 1000 1019 1010 I know that RoundingMode can probably help me here, but all the examples I've been able to find use decimals, not whole numbers. Any ideas?
has answer: http://stackoverflow.com/a/25791881
favorite count: 0
has title: "Rounding" whole numbers in Java
type: UnansweredQuestion
tagged with: java
duplicate of: http://stackoverflow.com/q/5775866
type: Question
has answer: http://stackoverflow.com/a/25791901
tagged with: rounding
score: -2
tagged with: math

http://stackoverflow.com/comment/40461313
type: Comment
comment on: http://stackoverflow.com/a/25857778
type: AnswerComment
score: 0
has text: Yeah there might be all sorts of things in the text, like ellipses, non-breaking spaces, carriage returns, line feeds, and a whole slew of other weird characters. Maybe somewhere there is " ." or " !" (an accidental space causing the period or exclamation point to be counted as their own words). Without seeing the text it would be hard to say.

http://stackoverflow.com/comment/40477427
type: QuestionComment
comment on: http://stackoverflow.com/q/25867187
score: 0
has text: Show you code, project structure. How are you trying to access the pages?
type: Comment

http://stackoverflow.com/comment/40273176
type: QuestionComment
has text: This post may help: http://stackoverflow.com/questions/16494916/equivalent-method-for-imshow-in-opencv-java-build
score: 0
comment on: http://stackoverflow.com/q/25754613
type: Comment

http://stackoverflow.com/comment/40369445
type: QuestionComment
type: Comment
has text: An `enum`eration might feel a bit wrong when used for a *single* ton. However, since it’s an established, well-known and accepted pattern, that shouldn’t matter. Hey, we got used to say `print` to transfer data to the standard output stream which is almost never a printer…
score: 0
comment on: http://stackoverflow.com/q/25780764

http://stackoverflow.com/comment/40270707
type: Comment
type: QuestionComment
has text: I am not saying you should change it, I am asking what do you think it does (what results do you think you should get)? Also which part it its documentation makes you think that such results should be expected?
score: 0
comment on: http://stackoverflow.com/q/25753383

http://stackoverflow.com/comment/40363512
type: AnswerComment
type: Comment
score: 2
has text: No, implicit grant flow is not for non-https clients, it is for clients that does not have a backend. There is no flow where token is sent as request parameter. In contrast to implicit grant flow, the authorization code flow, provides the `code` as a query string parameter to the client backend. The client backend then exchange the code with a token (authenticated request with client credentials)
comment on: http://stackoverflow.com/a/25786877

http://stackoverflow.com/q/25724931
downvote count: 0
has title: i want to overwrite the existing zipfile
answer count: 1
has comment: http://stackoverflow.com/comment/40217253
favorite count: 0
tagged with: http://stackoverflow.com/tag/zip
has answer: http://stackoverflow.com/a/25725365
has comment: http://stackoverflow.com/comment/40217129
has comment: http://stackoverflow.com/comment/40217172
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/25725365
type: Question
has body: i want to overwrite the existing zip file(which mean i add new file in existing zip file) but here show this error (java.util.zip.ZipError: zip END header not found) private void updateZip(String fileName, String scenarioDirectory){ System.out.println("File Name : " +fileName); System.out.println("Scenario Directory : " +scenarioDirectory); String scenarioName ="12345"; Path myFilePath = Paths.get(fileName); Path zipFilePath = Paths.get(scenarioDirectory); FileSystem fs; try { fs = FileSystems.newFileSystem(zipFilePath,null); Path fileInsideZipPath = fs.getPath(scenarioName); Files.copy(myFilePath, fileInsideZipPath); fs.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
linked to: http://stackoverflow.com/q/17500856

http://stackoverflow.com/q/25794721
tagged with: automation
has comment: http://stackoverflow.com/comment/40403374
tagged with: java
has comment: http://stackoverflow.com/comment/40345720
type: Question
score: 0
has body: package com.OSCom.CommonMethods; import java.util.Arrays; import java.util.concurrent.TimeUnit; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.Assert; public class CommonMethods { private WebDriver driver; public CommonMethods(WebDriver driver) { this.driver=driver; } public void clickElement(WebElement slocator) { try { slocator.click(); System.out.println(slocator+" clicked"); } catch(Exception e) { System.out.println(slocator+ " NOT clicked"); } } } So I have this simple method that would click on a link in selenium. If I just do: slocator.click(); then everything runs fine. However, when I put them in the try and catch block, it gives me this error: org.openqa.selenium.NoSuchElementException: no such element (Session info: chrome=37.0.2062.120) (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 30.12 seconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03' System info: host: 'Khoi-PC', ip: '192.168.1.133', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_67' Session ID: 9b7e97ea09696dfc78ade8e6503a548a Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{platform=XP, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, chrome={userDataDir=C:\Users\Khoi\AppData\Local\Temp\scoped_dir6056_19855}, rotatable=false, locationContextEnabled=true, version=37.0.2062.120, takesHeapSnapshot=true, cssSelectorsEnabled=true, databaseEnabled=false, handlesAlerts=true, browserConnectionEnabled=false, nativeEvents=true, webStorageEnabled=true, applicationCacheEnabled=false, takesSc…
has comment: http://stackoverflow.com/comment/40385717
has title: selenium try and catch
answer count: 0
type: UnansweredQuestion
tagged with: selenium

http://stackoverflow.com/q/25719924
has answer: http://stackoverflow.com/a/25720084
tagged with: java
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/98823728
score: 2
linked to: http://stackoverflow.com/q/14741027
downvote count: 0
has title: Print HTML File in Java
favorite count: 0
has answer: http://stackoverflow.com/a/25720406
tagged with: printing
tagged with: http://stackoverflow.com/tag/html
has body: I need to print a HTML File from my Java Application. I have tried several methods. Two of them are working, but not as expected. Method 1: Problem: The Print is cut of after three-quarter of the sheet. try { PrinterJob printJob = PrinterJob.getPrinterJob(); PageFormat pageFormat = new PageFormat(); pageFormat.setOrientation(PageFormat.LANDSCAPE); Paper paper = new Paper(); // Set to A4 size. paper.setSize(594.936, 841.536); // Set the margins. paper.setImageableArea(0, 0, 594.936, 841.536); pageFormat.setPaper(paper); XHTMLPanel panel = new XHTMLPanel(); panel.setDocument(new File("./documents/" + "Personalstamm" + ".html")); printJob.setPrintable(new XHTMLPrintable(panel), pageFormat); if (printJob.printDialog()) { printJob.print(); } } catch (Exception x) { x.printStackTrace(); } Method 2: Problem: The printout is without the Stylesheet set in the HTML file. PageFormat pageFormat = new PageFormat(); Paper a4paper = new Paper(); double paperWidth = 8.26; double paperHeight = 11.69; a4paper.setSize(paperWidth * 72.0, paperHeight * 72.0); /* * set the margins respectively the imageable area */ double leftMargin = 0.78; /* should be about 2cm */ double rightMargin = 0.78; double topMargin = 0.78; double bottomMargin = 0.78; a4paper.setImageableArea(leftMargin * 72.0, topMargin * 72.0, (paperWidth - leftMargin - rightMargin) * 72.0, (paperHeight - topMargin - bottomMargin) * 72.0); pageFormat.setPaper(a4paper); pageFormat.setOrientation(PageFormat.LANDSCAPE); DocumentRenderer documentRenderer = new DocumentRenderer(pageFormat, "Report"); try { FileInputStream stringReader = new FileInputStream(new File( "./documents/" + "Personalstamm" + ".html")); HTMLEditorKit htmlKit = new HTMLEditorKit(); HTMLDocument htmlDoc = (HTMLDocument) htmlKit .createDefaultDocument(); htmlKit.read(stringReader, htmlDoc, 0); documentRenderer.print(htmlDoc); } catch (Exception x) { x.printStackTrace(); } Does anybody have an idea how to solve the problem in one of these methods? Or do anybod…
has answer: http://stackoverflow.com/a/25743041
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/comment/40549067
type: Comment
comment on: http://stackoverflow.com/a/25869933
score: 1
has text: I have resolved this problem using TDB transactions: https://jena.apache.org/documentation/tdb/tdb_transactions.html
type: AnswerComment

http://stackoverflow.com/q/25718356
has title: What is the fast way to sort
has comment: http://stackoverflow.com/comment/40205048
has answer: http://stackoverflow.com/a/25728904
answer count: 1
score: 0
tagged with: android
tagged with: sqlite
has comment: http://stackoverflow.com/comment/40205616
has comment: http://stackoverflow.com/comment/40205010
accepted answer: http://stackoverflow.com/a/25728904
has comment: http://stackoverflow.com/comment/40210226
tagged with: android-sqlite
type: Question
has comment: http://stackoverflow.com/comment/40205826
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40206032
has comment: http://stackoverflow.com/comment/40204980
has comment: http://stackoverflow.com/comment/40208876
tagged with: java
has comment: http://stackoverflow.com/comment/40211731
has body: Problem Description I'm writing Android application which is working with big data, I have database (15 mb) and my application shows data from it. I have a queries which are get data from database already sorted for example alphabetic or depending on some parameters which I have provided. Question As I store data in the Array and then show it to user I want to know what is the fast way to sort data, while making a query or just put data in array and then sort it?
has comment: http://stackoverflow.com/comment/40210238

http://stackoverflow.com/q/25779874
linked to: http://stackoverflow.com/q/25738883
downvote count: 0
score: 1
has body: According to Hibernate documentation it is unsafe to use the Session after an exception is thrown by Hibernate. If the Session throws an exception, including any SQLException, immediately rollback the database transaction, call Session.close() and discard the Session instance. Certain methods of Session will not leave the session in a consistent state. No exception thrown by Hibernate can be treated as recoverable. Ensure that the Session will be closed by calling close() in a finally block. In my code I am doing a batch insert. I am using sessionFactory.getCurrentSession() method to obtain the session. My code is like this. try { //some code here.... .... Table1Entity table1Entity = ....... List&lt;Table2Entity&gt; table2Entities = ....... Session currentSession = sessionFactory.getCurrentSession(); for (int i = 0; i &lt; table2Entities; i++) { ............. currentSession.save(table2Entities.get(i)); if(i % batchSize == 0 || i + 1 == table2Entities) { currentSession.flush(); currentSession.clear(); } } } catch (Exception e) { currentSession.getTransaction().rollback(); //currentSession.close(); //According to documentation Session should be closed here table1Entity.setError(true); currentSession.save(table1Entity);//According to documentation Session should not be used here ....... } As documentation says the session should not be used after an exception is thrown. My problem is since I am using the currentSession, how can I save the table1Entity in catch block? Should I open a new session using openSession() method or any other way? Edit: To be more clear simply what I am asking is whether I could retrieve a new currentSession after the existing currentSession is closed.
tagged with: java
tagged with: hibernate
type: Question
tagged with: session
tagged with: bulkinsert
has comment: http://stackoverflow.com/comment/40319546
answer count: 2
upvote count: 1
has title: Using the Current Sesssion after an exception is thrown
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25780573
has comment: http://stackoverflow.com/comment/40320337
tagged with: spring
has answer: http://stackoverflow.com/a/25784524

http://stackoverflow.com/a/25808106
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25808092
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25808092
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/40369331
has body: It's defined in the Runnable interface : public void run ();

http://stackoverflow.com/a/25793274
downvote count: 0
score: 3
answers question: http://stackoverflow.com/q/25793216
upvote count: 3
has body: Character is a wrapper class for char, since char is a primitive type and thus isn't an Object. it fulfills the same role as Integer and Boolean. Edit: It also provide a convenient class to store methods that deal with chars, like isDigit() in your example.
type: Answer

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/25821238
tags question: http://stackoverflow.com/q/25827965
tags question: http://stackoverflow.com/q/25802784
type: Tag
tags question: http://stackoverflow.com/q/25796572
tags question: http://stackoverflow.com/q/25714434
tags question: http://stackoverflow.com/q/25825319
tags question: http://stackoverflow.com/q/25771993
tags question: http://stackoverflow.com/q/25819745
tags question: http://stackoverflow.com/q/25837024
tags question: http://stackoverflow.com/q/25775510

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

http://stackoverflow.com/comment/40334439
type: AnswerComment
score: 0
type: Comment
has text: If the file contains just one line, change the `while` into an `if`. Keep the braces, otherwise you will print null. Just saw another detail.
comment on: http://stackoverflow.com/a/25788489

http://stackoverflow.com/a/25806076
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25806018
has body: In this case: this.x = x &lt; 0? 0 : x; This means that the value of x is dependent on the condition (the one before the question mark x &lt; 0), the value of x is the first (the value before the : which is 0) if the condition evaluates to true, else the second value (the value after the : which is x itself). Also, The value of x is equal to 0 if it is a negative number, other than this case the value is x itself.

http://stackoverflow.com/q/25777055
downvote count: 1
favorite count: 0
has title: How to pass in any Object type into a method? Java
has comment: http://stackoverflow.com/comment/40314910
has answer: http://stackoverflow.com/a/25777141
type: UnansweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/25777490
tagged with: java
has comment: http://stackoverflow.com/comment/40314660
has body: Note: the NPE error has been fixed I need a way to identify an Object when it is passed into a method. It can be by name or anything else unique to the Object, but not by type or value, since there may be other Objects with the same type or value in the HashMap. In TOES.java: import java.util.HashMap; public class TOES{ private HashMap&lt;Object, HashMap&lt;String, Object&gt;&gt; TOES = new HashMap&lt;Object, HashMap&lt;String, Object&gt;&gt;(); public void add(Object foot, String tag, Object data){ HashMap&lt;String, Object&gt; TOE = TOES.get(foot); if(TOE == null){ TOE = new HashMap&lt;String, Object&gt;; } TOE.put(tag, data); TOES.put(foot, TOE); } public Object val(Object foot, String tag){ return TOES.get(foot).get(tag); } } In TOESTest1.java: public class TOESTest1{ public static void main(String[] arg){ TOES Toes = new TOES(); Integer potatoes = 5; Integer eyes = 7; String tagname = "eyes"; Toes.add(potatoes,tagname,eyes); potatoes = 3; System.out.println(potatoes); System.out.println(Toes.val(potatoes, "eyes")); } } When TOESTest1 is run, it shows an error for the last println and the return in the val method. The output should be: 3 7 (Ignore the weird names, TOES is an acronym) I am new to java, but not new to programming (I know C++), so...
type: Question
tagged with: object
has comment: http://stackoverflow.com/comment/40314319
score: -1
has answer: http://stackoverflow.com/a/65503725
has comment: http://stackoverflow.com/comment/40313899
has comment: http://stackoverflow.com/comment/40313784
has comment: http://stackoverflow.com/comment/40314451
linked to: http://stackoverflow.com/q/7700573
answer count: 3

http://stackoverflow.com/a/25731507
has body: Your program looks quite thorough and good. It needs small tweaks. In your main method you need to make following changes inside the for loop List al = new ArrayList(); if (isPalindrome(i) &amp;&amp; areAllDivisorsPalindromic(i, al)) { ... } areAllDivisorsPalindromic() is replacing getDivisors() method. Its just a method renaming because we are adding a different capability. It will have the same logic of getDivisors() but needs a small tweak. boolean allDivisorsPalindromes = true if(i% number ==0 &amp;&amp; i!=number &amp;&amp; !isPalindrome(number)){ allDivisorsPalindromes = false; return allDivisorsPalindromes ; }else{ // add the number to the arrayList } return allDivisorsPalindromes the key concept used is that of Short circuit feature. In addition, I believe you should replace the following condition i!=number in areAllDivisorsPalindromic() to i = number because number may be a prime number.
score: 0
has comment: http://stackoverflow.com/comment/40230446
answers question: http://stackoverflow.com/q/25731207
type: Answer
has comment: http://stackoverflow.com/comment/40229588
has comment: http://stackoverflow.com/comment/40230425
has comment: http://stackoverflow.com/comment/40232940
has comment: http://stackoverflow.com/comment/40231094

http://stackoverflow.com/comment/40222276
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25727578
has text: @msrd0 the problem is that OP wants/need to use this `id` variable but it's not able to do it.
score: 0

http://stackoverflow.com/a/25767139
has comment: http://stackoverflow.com/comment/40320002
has comment: http://stackoverflow.com/comment/40320464
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25760491
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25760491
type: Answer
has body: HWPF is not usable for writing .doc files. It may work for very simple file content, but little extras break it. I fear you are out of luck here - if it is an option for you, you might want to use RTF files and work on those. Word should work correctly, if you rename the rtf extension to .doc (if you need the .doc extension). (I developed a custom and working variant of HWPF for a client and know how difficult things can get there. The standard HWPF library will get in trouble when characters outside the 8-bit encoding exist, when tables are used, when text boxes are used, when graphics are embedded, ... . Some things in .doc files are also different from what is described in the official specification from Microsoft. Making a working HWPF library is "non-trivial" and requires a lot of spec-reading and investigation. If you want to go down the road to fix those bugs, you need to expect at least half a year of development effort.)
downvote count: 0
score: 2

http://stackoverflow.com/comment/40239258
type: AnswerComment
has text: If you do `int[] numArray = {0, 1, 2, 3 ...` all the way to 25, it should work.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25736396

http://stackoverflow.com/q/25728962
type: Question
has body: I am working on an IntelliJ plugin in which I generate the Builder pattern. However, I cannot seem to use the plugin because of something called the PluginException. I reproduced the error in the same five steps as this post, and because no answer is posted there I decided to give some code examples in this question (and I am not allowed to comment on the other question. That has a lot to do with it too). The code can be found here. The test-plugin should generate a field with a getter in the current class, and an inner class of a new type (NumberFactory). The stacktrace I get after installing the plugin is the following one: *cannot create class "be.koen.wellens.MyBuilderGeneratorAction" [Plugin: be.koen.wellens]: cannot create class "be.koen.wellens.MyBuilderGeneratorAction" [Plugin: be.koen.wellens] com.intellij.diagnostic.PluginException: cannot create class "be.koen.wellens.MyBuilderGeneratorAction" [Plugin: be.koen.wellens] at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:287) at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:239) at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.getAction(ActionManagerImpl.java:232) at com.intellij.openapi.actionSystem.DefaultActionGroup.unStub(DefaultActionGroup.java:345) at com.intellij.openapi.actionSystem.DefaultActionGroup.getChildren(DefaultActionGroup.java:303) at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1261) at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1254) at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932) at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.a(ActionManagerImpl.java:1254) at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1248) at com.intellij.codeInsight.generation.actions.GenerateAction.preload(GenerateAction.java:91) a…
score: 3
has answer: http://stackoverflow.com/a/25730170
has comment: http://stackoverflow.com/comment/40225632
has title: IntelliJ Plugin Development: PluginException cannot create class Action
tagged with: intellij-idea
linked to: http://stackoverflow.com/q/10382929
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: plugins
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/40329812
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25785403
has text: the cool thing about readLine is the fact that you read the file line by line - and a line contains all text **but not the line break itself**....
score: 0

http://stackoverflow.com/comment/40415748
type: QuestionComment
comment on: http://stackoverflow.com/q/25833253
score: 1
has text: That has nothing to do with windows file summary, and everything to do with the mp3 file format, which stores information such as the title.
type: Comment

hibernate
tags question: http://stackoverflow.com/q/25810003
tags question: http://stackoverflow.com/q/25856304
tags question: http://stackoverflow.com/q/25769969
tags question: http://stackoverflow.com/q/25737743
tags question: http://stackoverflow.com/q/25760233
tags question: http://stackoverflow.com/q/25738129
tags question: http://stackoverflow.com/q/25729002
tags question: http://stackoverflow.com/q/25834888
tags question: http://stackoverflow.com/q/25869958
tags question: http://stackoverflow.com/q/25733591
tags question: http://stackoverflow.com/q/25729720
tags question: http://stackoverflow.com/q/25850540
tags question: http://stackoverflow.com/q/25798265
tags question: http://stackoverflow.com/q/25792321
tags question: http://stackoverflow.com/q/25854916
tags question: http://stackoverflow.com/q/25856238
tags question: http://stackoverflow.com/q/25837499
tags question: http://stackoverflow.com/q/25782112
tags question: http://stackoverflow.com/q/25743475
tags question: http://stackoverflow.com/q/25779647
tags question: http://stackoverflow.com/q/25763570
tags question: http://stackoverflow.com/q/25770711
tags question: http://stackoverflow.com/q/25755760
tags question: http://stackoverflow.com/q/25736036
tags question: http://stackoverflow.com/q/25821396
tags question: http://stackoverflow.com/q/25801360
tags question: http://stackoverflow.com/q/25742698
tags question: http://stackoverflow.com/q/25723565
tags question: http://stackoverflow.com/q/25829989
tags question: http://stackoverflow.com/q/25738544
tags question: http://stackoverflow.com/q/25779961
tags question: http://stackoverflow.com/q/25817997
tags question: http://stackoverflow.com/q/25766021
tags question: http://stackoverflow.com/q/25768304
tags question: http://stackoverflow.com/q/25714201
tags question: http://stackoverflow.com/q/25845204
tags question: http://stackoverflow.com/q/25841190
tags question: http://stackoverflow.com/q/25772702
tags question: http://stackoverflow.com/q/25845333
tags question: http://stackoverflow.com/q/25722080
tags question: http://stackoverflow.com/q/25867429
tags question: http://stackoverflow.com/q/25788721
tags question: http://stackoverflow.com/q/25718229
tags question: http://stackoverflow.com/q/25718746
tags question: http://stackoverflow.com/q/25725865
tags question: http://stackoverflow.com/q/25869388
tags question: http://stackoverflow.com/q/25778421
tags question: http://stackoverflow.com/q/25808167
tags question: http://stackoverflow.com/q/25851889
tags question: http://stackoverflow.com/q/25788295
tags question: http://stackoverflow.com/q/25793215
tags question: http://stackoverflow.com/q/25855678
tags question: http://stackoverflow.com/q/25764778
tags question: http://stackoverflow.com/q/25714545
tags question: http://stackoverflow.com/q/25789176
tags question: http://stackoverflow.com/q/25797866
tag name: hibernate
tags question: http://stackoverflow.com/q/25771892
tags question: http://stackoverflow.com/q/25869771
tags question: http://stackoverflow.com/q/25773898
tags question: http://stackoverflow.com/q/25724736
tags question: http://stackoverflow.com/q/25864841
tags question: http://stackoverflow.com/q/25851029
tags question: http://stackoverflow.com/q/25779980
tags question: http://stackoverflow.com/q/25717781
tags question: http://stackoverflow.com/q/25821579
tags question: http://stackoverflow.com/q/25797768
tags question: http://stackoverflow.com/q/25863678
tags question: http://stackoverflow.com/q/25795290
tags question: http://stackoverflow.com/q/25784540
tags question: http://stackoverflow.com/q/25863795
tags question: http://stackoverflow.com/q/25751993
tags question: http://stackoverflow.com/q/25768530
tags question: http://stackoverflow.com/q/25723388
tags question: http://stackoverflow.com/q/25845132
tags question: http://stackoverflow.com/q/25831568
tags question: http://stackoverflow.com/q/25720691
tags question: http://stackoverflow.com/q/25767495
tags question: http://stackoverflow.com/q/25816897
tags question: http://stackoverflow.com/q/25724545

http://stackoverflow.com/q/25822178
tagged with: preferences
upvote count: 1
answer count: 1
favorite count: 0
has title: Preferences Libgdx Java
tagged with: android
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25822262
accepted answer: http://stackoverflow.com/a/25822262
score: 1
tagged with: java
has body: I have been trying to implement a high score feature into my Libgdx game, using getPreferences to save the scores. When i run the program as a desktop app it saves the scores after the initial use, however when i close it and re-run it these scores do not remain. Will it remain completely even it the program is terminated when the game is published to android, ios, desktop etc? Here is the code that I am using: Preferences scores = Gdx.app.getPreferences("High Scores"); int currentHighScore = scores.getInteger("currentHighScore", 0); if(currentHighScore &lt; gamescore){ scores.putInteger("currentHighScore", gamescore); int currentHighScore = scores.getInteger("currentHighScore",0);
type: Question
tagged with: libgdx
downvote count: 0

http://stackoverflow.com/comment/40205967
type: QuestionComment
type: Comment
score: 0
has text: done, posted in post
comment on: http://stackoverflow.com/q/25718741

http://stackoverflow.com/comment/54866935
comment on: http://stackoverflow.com/a/33541820
has text: @btrs20 The difference relies in the whitespaces removal.
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/25823552
favorite count: 0
accepted answer: http://stackoverflow.com/a/25825670
linked to: http://stackoverflow.com/q/5479140
type: AnsweredQuestion
tagged with: orm
tagged with: hibernate-criteria
upvote count: 1
type: Question
has title: Hibernate eager loading with query
score: 1
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25825670
tagged with: sql
downvote count: 0
answer count: 1
has body: The model is that a user can have many LoginSessions (LogginSession can be related to only one user). What I am trying to achieve is bring the user with related LoginSession (which's token provided in the query). All of that I am trying to do with only one query, and to do so I want to use eager loading, here is my code: I have this code: LoginSession loginSession = new LoginSession(); loginSession.setToken(sessionToken); //Example loginSessionExample = Example.create(loginSession); Criteria crit = session.createCriteria(User.class); crit.createAlias("userLoginSession", "session"); crit.add(Restrictions.eq("session.token", sessionToken)); crit.setMaxResults(1); crit.setFirstResult(0); crit.setFetchMode("loginSession", FetchMode.JOIN); List&lt;?&gt; usersList = (List&lt;?&gt;) crit.list(); // first query if(usersList.size() == 1) { User user = (User) usersList.get(0); LoginSession loginSession = (LoginSession) user.getUserLoginSession().toArray()[0]; //second query ... The problem is that there are 2 quires that are being executed (see comments in the provided code). What am I doing wrong with my Criteria and how can I make to be a one query? Thanks

http://stackoverflow.com/comment/40451784
type: QuestionComment
has text: Are you running via an IDE? CLI? If CLI, what's your command look like?
score: 0
comment on: http://stackoverflow.com/q/25852915
type: Comment

http://stackoverflow.com/comment/40216041
has text: U want to insert an arrayList into the database right ??? Say if the arraylist has [a,b,c,d], each a b c d shld be inserted into each column ??
comment on: http://stackoverflow.com/q/25723838
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25813971
has body: I've done a lot with IO in Java and after looking for code to convert primitives to byte arrays and back I found source for java.io.Bits on one of the Java source code hosting websites. After a quick glance I realized it's exactly what I need, except it's package-private. So I made a copy which I made public, stored in my project's package and used (only in personal projects, I assure you). I find it very useful. My question is, why is this package-private? I can see it being really useful for people who work with IO and I see no disadvantage from changing it's visibility to public (in rt.jar). Or is there perhaps an equivalent (and please don't mention other libraries)? Here's a link to a randomly chosen website that has Java source for java.io.Bits: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/6-b14/java/io/Bits.java
tagged with: java
has answer: http://stackoverflow.com/a/25814079
upvote count: 10
type: Question
score: 10
tagged with: class-visibility
answer count: 2
accepted answer: http://stackoverflow.com/a/25814079
has title: Why isn't java.io.Bits public?
downvote count: 0
tagged with: public
favorite count: 0
possible better answer: http://stackoverflow.com/a/25814396
tagged with: private
has answer: http://stackoverflow.com/a/25814396
type: AnsweredQuestion

http://stackoverflow.com/q/25818998
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25819007
has body: I created a code that is meant to accept a user-input then add 5 to it, this is the code. When I enter any number, It returns 0. EDIT: I moved the reCalculate down under main, nothing changes package files; import java.util.*; public class CalculatorTest { static Scanner userFirstNumber = new Scanner(System.in); static int numberReCalculated; public static int reCalculate(int a){ int numberReCalculated = a + 5; return numberReCalculated; } public static void main(String[] args){ int bobson; System.out.print("Enter a number, I will do the rest : "); bobson = userFirstNumber.nextInt(); reCalculate(bobson); System.out.println(numberReCalculated); } }
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25819007
tagged with: string
favorite count: 0
tagged with: integer
type: Question
has title: I have an error with a math operation Java?
upvote count: 1
score: 0
tagged with: java

http://stackoverflow.com/q/25816333
upvote count: 1
has comment: http://stackoverflow.com/comment/40386146
downvote count: 1
has body: Recently I got a interview programming question about how to find maximum number M less than N, and some specific digit is not allowed to exist in M. For example, N = 123, digit = 2，then it will output: 119 My ideas is to convert N to string first, and then find the first position of digit from left to right to make this digit decreased by 1. Then I set all the remaining digits in N to 9 to make this number maximized. Does some could point out some corner case which I ignored? and is there some good implementation in Java of this problem for reference?
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/40386975
has answer: http://stackoverflow.com/a/25816575
type: Question
has answer: http://stackoverflow.com/a/25818212
tagged with: string
has answer: http://stackoverflow.com/a/25817134
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/25816588
has title: how to find maximum number M less than N in which some specific digit is not allowed to exist in Java
answer count: 4
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40385435

http://stackoverflow.com/comment/40308037
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25766991
has text: Thanks a lot Sid. I have checked the code of every activity but I can not find the problem. Thank you for your help.
type: Comment

http://stackoverflow.com/comment/40348592
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25793536
has text: Do all your calculations in cents ...
score: 0

http://stackoverflow.com/a/25801485
score: 1
has body: Your code is needs some reordering and simplification. I suggest: public static String hailstones(int n) { String result = ""; while (n != 1) { result += Integer.toString(n) + " "; if (n % 2 == 0) { n /= 2; } else { n = n * 3 + 1; } } result += "1"; return result; }
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25801345
answers question: http://stackoverflow.com/q/25801345

http://stackoverflow.com/comment/40456643
type: QuestionComment
score: 0
has text: The log statement most certainly *can* throw an exception, and that is precisely the only way for that thread to die.
type: Comment
comment on: http://stackoverflow.com/q/25855132

http://stackoverflow.com/comment/40355686
has text: I made an edit to my original post with my current code as of right now. I think I followed everything you said.
type: AnswerComment
comment on: http://stackoverflow.com/a/25799125
score: 0
type: Comment

http://stackoverflow.com/comment/40472805
has text: Are you trying to get the intent load time while changing ActivityA to ActivityB ?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25864376
type: QuestionComment

http://stackoverflow.com/q/25769702
has comment: http://stackoverflow.com/comment/40334244
has comment: http://stackoverflow.com/comment/40300857
tagged with: jtable
score: 0
tagged with: user-interface
favorite count: 0
has comment: http://stackoverflow.com/comment/40301576
has title: How to fire an event when JTable is visible?
type: UnansweredQuestion
tagged with: swing
answer count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40301201
tagged with: java
downvote count: 2
tagged with: componentlistener
has body: I would like to know whether JTable is not responding to ComponentListener. I have a JTable inside a tab of a JTabbedPane, and I have implemented the ComponentListener to the JTable so I can fire an even when the table is visible. But, it is not responding!I also noticed it is not responding to JTabbedPane as well! any ideas about how you can find whether a JTable is visible?
type: Question

http://stackoverflow.com/comment/119522665
has text: Links 2 and 3 are dead
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25804364
type: Comment

http://stackoverflow.com/a/25849998
type: Answer
has body: Instead on AnimateItem(i) method of yours, if your activity implements AnimationListener we can over ride following methods @Override public void onAnimationStart(Animation animation) { // TODO Auto-generated method stub } @Override public void onAnimationEnd(Animation animation) { // TODO Auto-generated method stub if (animation == your desired Animation) { //start your new Animation } } @Override public void onAnimationRepeat(Animation animation) { // TODO Auto-generated method stub }
answers question: http://stackoverflow.com/q/25849725
score: 0
has comment: http://stackoverflow.com/comment/40468471

http://stackoverflow.com/q/25869777
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25872403
has title: Problems intalling dict_en.oxt
type: UnansweredQuestion
has body: I am new to OpenOffice, so, as my Italian friend here say... takaht eeeasy. In trying to install dict-en, I get an error that reads: ..\AppData\Roaming\OpenOffice\4\user\uno_package\cache\uno_packages\sv1mgoq1.tmp_\dict_en.oxt does not exist OO works all hanky dory, with the only exception that I don't have a English Canadian (en-ca) Dictionary/Spell checker. This really sucks, dude, I don't only have to focus on my work, but also on my terrible spelling habits. What is UNO any ways? And no, I am not talking about uno, dos, tres kid of thing, but the "OpenOffice UNO". Thanks kids and keep your eyes on the puck!
tagged with: openoffice.org
tagged with: uno
type: Question
answer count: 1

http://stackoverflow.com/comment/40477540
comment on: http://stackoverflow.com/q/25867293
score: 0
type: Comment
has text: Write a Comparator for your class and pass it as a parameter to the sort() method. It's right there in the javadocs.
type: QuestionComment

http://stackoverflow.com/comment/40398067
type: AnswerComment
has text: <3. Can you just explain why use `this`instead of getBaseContext or getApplicationContext?
type: Comment
comment on: http://stackoverflow.com/a/25823515
score: 0

http://stackoverflow.com/comment/40389098
type: AnswerComment
has text: This is not true. The JSON is perfectly valid.
type: Comment
comment on: http://stackoverflow.com/a/25818177
score: 10

http://stackoverflow.com/comment/40487536
score: 0
type: AnswerComment
type: Comment
has text: @Joehot200 on my test vm here, it's under: `C:\Program Files\Java\jre7\lib\jfxrt.jar` -- so the regular jre directory... but the exact location may depend on your java7 version... javafx is/was considered experimental under java7.
comment on: http://stackoverflow.com/a/25871817

http://stackoverflow.com/comment/40287648
type: QuestionComment
has text: try to always find view in onCreate() instead custom method.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25763142

jena
tags question: http://stackoverflow.com/q/25758708
tag name: jena
tags question: http://stackoverflow.com/q/25835640
tags question: http://stackoverflow.com/q/25850288
tags question: http://stackoverflow.com/q/25782760
tags question: http://stackoverflow.com/q/25737302
tags question: http://stackoverflow.com/q/25865560
type: Tag

http://stackoverflow.com/comment/40215067
comment on: http://stackoverflow.com/q/25723798
type: QuestionComment
has text: possible duplicate of [How to make a countdown Timer in android?](http://stackoverflow.com/questions/10032003/how-to-make-a-countdown-timer-in-android)
score: 0
type: Comment

http://stackoverflow.com/q/25764836
downvote count: 0
score: 1
favorite count: 0
has body: I'm now at my wit's end with this and really struggling. I've installed both JDK 7.0 and 8.0, I've tried both 32bit and 64bit versions of the Eclipse software and I've installed Java 1.6 from the Apple website. I've also restarted my machine and tried this whole process on a new user on my laptop. Before I did some of this I was getting the error message 13 which I discovered was to do with some sort of incompatibility. It was asking me to install JVM 1.6 which I think I did. I'm now getting a message that "Eclipse has unexpectedly had to quit" every time I've opened it. I've been looking at this blog came up and when I looked I didn't have the JavaVM.Framework folder.
tagged with: macos
has answer: http://stackoverflow.com/a/25770725
type: UnansweredQuestion
upvote count: 1
has title: Unable to properly install Eclipse in Mac OS X Mavericks
type: Question
has answer: http://stackoverflow.com/a/25770477
tagged with: java
tagged with: eclipse
answer count: 2

http://stackoverflow.com/q/25822698
has answer: http://stackoverflow.com/a/25822774
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25822724
tagged with: java
has title: Problems implementing a binary search
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40396777
has comment: http://stackoverflow.com/comment/40396670
has body: I'm feeling very very stupid because I've solved much harder stuff than this. This is supposed to be an implementation of ordered binary search. Whenever I trace the 12, a stackoverflow error pops up. Any help please? public class binarySearch { public static void main(String[] args) { int[] arr = { 1, 5, 6, 8, 12, 88 }; System.out.println(binaryHelper(0, arr.length - 1, 12, arr)); } public static int binaryHelper(int first, int last, int target, int[] arr) { if(first &gt; last) return -1; else { int mid = first + last / 2; if(arr[mid] == target) return mid; else if(arr[mid] &gt; target) return binaryHelper(first, mid - 1, target, arr); else return binaryHelper(mid + 1, last, target, arr); } } }
score: 0
has answer: http://stackoverflow.com/a/25822724
possible better answer: http://stackoverflow.com/a/25822774
linked to: http://stackoverflow.com/q/12517764

http://stackoverflow.com/comment/40371019
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25809069
has text: Did you export the external lib when building the jar ?

http://stackoverflow.com/q/25842512
has answer: http://stackoverflow.com/a/25842692
has title: AnnotationConfigApplicationContext has not been refreshed yet
has answer: http://stackoverflow.com/a/54696694
has comment: http://stackoverflow.com/comment/40433180
linked to: http://stackoverflow.com/q/19414734
possible better answer: http://stackoverflow.com/a/25842692
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25842814
type: Question
score: 8
downvote count: 0
favorite count: 0
upvote count: 8
answer count: 3
accepted answer: http://stackoverflow.com/a/25842814
linked to: http://stackoverflow.com/q/130794
has body: I am developing a spring MVC application. When I try to use AnnotationConfigApplicationContext in my controller class I am getting the following error. I have no idea what this statement exactly means. @RequestMapping(value = "/generate", method = RequestMethod.POST) public ModelAndView generateMappingFile(@ModelAttribute Mapping mapping) { AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); MappingFileGenerator mfg = ctx.getBean(MappingFileGenerator.class); } Error Message --> java.lang.IllegalStateException:org.springframework.context.annotation.AnnotationConfigApplicationContext@116b3c0 has not been refreshed yet Can someone explain me what went wrong here ? I am using Spring 4.0.1.. I am new to spring mvc.

http://stackoverflow.com/comment/40430775
comment on: http://stackoverflow.com/a/25839368
score: 0
type: AnswerComment
type: Comment
has text: Just curious, is the content of WEB-INF folder cannot be accessed as web-resources?

http://stackoverflow.com/q/25720002
has comment: http://stackoverflow.com/comment/40208254
has body: why is this actually happening? like on following screenshot : Method is about to just return similiar phone numbers, the full code is : private String makeQueryForAllEqualNumbers (String number){ String num1 = "0", num2 = "0"; String res; if (number.startsWith("+") &amp;&amp; number.length() == 12){ // +7965 num1 = "" + (Integer.parseInt("" + number.charAt(1)) + 1) + number.substring(2); //8965 num2 = "+" + number.substring(2); //+965 } if (number.charAt(0) &gt;= '0' &amp;&amp; number.charAt(0) &lt;=9 &amp;&amp; number.length() == 11) { //means 8965 num1 = "+" + (Integer.parseInt("" + number.charAt(0)) - 1) + number.substring(1); //+7965 num2 = "+" + number.substring(1); } else return number; res = number + "' OR ADDRESS = '" + num1 + "' OR ADDRESS = '" + num2; return res;
has comment: http://stackoverflow.com/comment/40208247
type: Question
has comment: http://stackoverflow.com/comment/40208201
accepted answer: http://stackoverflow.com/a/25720093
has comment: http://stackoverflow.com/comment/40208116
score: -2
has comment: http://stackoverflow.com/comment/40208080
has answer: http://stackoverflow.com/a/25720093
answer count: 1
tagged with: string
favorite count: 0
has title: Cannot declare a string
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40208087
upvote count: 0
has comment: http://stackoverflow.com/comment/40208135
has comment: http://stackoverflow.com/comment/40208258
tagged with: java
has comment: http://stackoverflow.com/comment/40208184
downvote count: 2
has comment: http://stackoverflow.com/comment/40208463

http://stackoverflow.com/comment/40394222
type: Comment
comment on: http://stackoverflow.com/a/25801503
type: AnswerComment
has text: Thank you @Sezin. I knew Connection pooling would help, but was wondering about how can i implement in my code. Ty
score: 0

http://stackoverflow.com/q/25756948
has answer: http://stackoverflow.com/a/25757203
score: -1
has body: So i have an array list of unsorted words. I want to sort this list in alphabetical. My main problem is i'm getting StackOver flow. The other one is when i go around the Stack overflow it does not sort them aphabetically. (The binary search should not sort the whole array just give give the index at which the point should be added). code: public int binarySearch(ArrayList&lt;String&gt; a, String target) { return binarySearch(a, target, 0, a.size() - 1); } private int binarySearch(ArrayList&lt;String&gt; a, String target, int first, int last) { int mid = (first + last) / 2; if (first &gt; last) { return first; } if (a.size() == 0) { return 0; } if (target.equals(a.get(mid))) { return mid; } if (a.get(mid).compareTo(target) &gt; 0) { return binarySearch(a, target, mid - 1, last); } if (a.get(mid).compareTo(target) &lt; 0) { return binarySearch(a, target, mid + 1, last); } else return mid; }
type: Question
has comment: http://stackoverflow.com/comment/40276921
answer count: 2
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25757035
has comment: http://stackoverflow.com/comment/40276874
has comment: http://stackoverflow.com/comment/40276896
tagged with: binary
accepted answer: http://stackoverflow.com/a/25757035
has comment: http://stackoverflow.com/comment/40277438
downvote count: 1
has title: Using binary search to sort and array alphabeticall
tagged with: recursion
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25757203
tagged with: java

http://stackoverflow.com/comment/40428743
comment on: http://stackoverflow.com/q/25839527
score: 0
has text: "Don’t use methods like indexOf or substring" might be a hint that you're supposed to write your own indexOf.
type: Comment
type: QuestionComment

json-rpc
tag name: json-rpc
type: Tag
tags question: http://stackoverflow.com/q/25725184

http://stackoverflow.com/q/25837961
has answer: http://stackoverflow.com/a/25838022
has answer: http://stackoverflow.com/a/25838061
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40424683
has comment: http://stackoverflow.com/comment/40424693
has title: Why is the merge-sort taking too much time to sort?
has comment: http://stackoverflow.com/comment/40424642
possible better answer: http://stackoverflow.com/a/25838061
type: Question
has body: I've been trying to optimize this mergesort version but it takes too long to sort around 3 million of registers. Where am I doing it wrong? I would appreciate some help, thanks. Persona is a class that has a string and an Integer, just in case that you guys want to know in order to help me. public class Mergesort { private ArrayList&lt;Persona&gt; numbers = new ArrayList(); private ArrayList&lt;Persona&gt; helper; private int number; private boolean ascending; public void sort(ArrayList&lt;Persona&gt; values, boolean ascending) { this.numbers = values; this.ascending = ascending; number = values.size(); helper = new ArrayList(); mergesort(0, number - 1); } /** * Determines the middle of the array to sort the left side and the right side * Then it merges both arrays. * @param low * @param high */ private void mergesort(int low, int high) { // check if low is smaller then high, if not then the array is sorted if (low &lt; high) { // Get the index of the element which is in the middle int middle = low + (high - low) / 2; // Sort the left side of the array mergesort(low, middle); // Sort the right side of the array mergesort(middle + 1, high); // Combine them both merge(low, middle, high); } } /** * Merges the arrays. * @param low * @param middle * @param high */ private void merge(int low, int middle, int high) { // Copy both parts into the helper array for (int i = low; i &lt;= high; i++) { helper.add(i, numbers.get(i)); } int i = low; int j = middle + 1; int k = low; // Copy the smallest values from either the left or the right side back // to the original array while (i &lt;= middle &amp;&amp; j &lt;= high) { if ( helper.get(i).id &lt;= helper.get(j).id) { numbers.set(k, helper.get(i)); i++; } else { numbers.set(k,helper.get(j)); j++; } k++; } // Copy the rest of the left side of the array into the target array while (i &lt;= middle) { numbers.set(k,helper.get(i)); k++; i++; } }}
tagged with: java
tagged with: sorting
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25838022

http://stackoverflow.com/comment/46324011
score: 0
type: Comment
comment on: http://stackoverflow.com/a/29040171
has text: nice workaround. Like that java8 constructs! anyhow i cant use that as I need multiple Properties beans not just one. If you see my EDITS my workaround is pretty similar and neat for my use case.
type: AnswerComment

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

http://stackoverflow.com/a/25722738
downvote count: 0
score: 37
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25722718
upvote count: 37
answers question: http://stackoverflow.com/q/25722718
type: Answer
has body: &lt;-- is not a new Java operator (even though it may look like it), but there are 2 normal operators: &lt; and -- while (var2 &lt;-- var1) is the same as while(var2 &lt; (--var1)), which can be translated to plain english as: decrement the var1 variable ( --var is a prefix decrementation, ie. decrement the variable before condition validation) Validate the condition var2 &lt; var1

http://stackoverflow.com/q/25803174
score: 1
has comment: http://stackoverflow.com/comment/40361447
has answer: http://stackoverflow.com/a/25807377
upvote count: 1
type: Question
has body: I have jre7 installed on my pc. In Eclipse Kepler I created a project with compiler compliance level 1.5. The source compatibility setting is 1.5 too. But this setting not works. I can wirte code which using methods that were declared in 1.6 or later. For example: String s = "aaa"; boolean b = s.isEmpty(); The method isEmpty() in java.lang.String is since 1.6. Of course, when running the generated class file with a real jre 1.5 enviroment, i got a NoSuchMethodError exception. Here is my source and settings: How can I fix this? Or is it an Eclipse bug?
accepted answer: http://stackoverflow.com/a/25807377
possible better answer: http://stackoverflow.com/a/25803743
tagged with: java
has answer: http://stackoverflow.com/a/25803743
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40361311
answer count: 2
downvote count: 0
has title: Source code compatibility setting in Eclipse
favorite count: 0
linked to: http://stackoverflow.com/q/15492948
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40361651
has comment: http://stackoverflow.com/comment/40361388

logging
tags question: http://stackoverflow.com/q/25871130
tags question: http://stackoverflow.com/q/25722080
tags question: http://stackoverflow.com/q/25845120
tag name: logging
tags question: http://stackoverflow.com/q/25822465
tags question: http://stackoverflow.com/q/25848256
tags question: http://stackoverflow.com/q/25811788
tags question: http://stackoverflow.com/q/25781168
tags question: http://stackoverflow.com/q/25865350
tags question: http://stackoverflow.com/q/25774099
tags question: http://stackoverflow.com/q/25816761
tags question: http://stackoverflow.com/q/25720294
tags question: http://stackoverflow.com/q/25754933
tags question: http://stackoverflow.com/q/25835812
tags question: http://stackoverflow.com/q/25793747
tags question: http://stackoverflow.com/q/25863575
tags question: http://stackoverflow.com/q/25863602
type: Tag
tags question: http://stackoverflow.com/q/25729467

http://stackoverflow.com/a/25778372
answers question: http://stackoverflow.com/q/25778185
score: 1
upvote count: 1
downvote count: 0
has body: Math signs (+-*/) are only available for String and primitive types in Java. BigDecimal and BigInteger are not primitive types, so you can not use math signs directly with them. Consider using methods of instance instead when you want to do math calculate.
type: Answer

http://stackoverflow.com/q/25762562
has answer: http://stackoverflow.com/a/25762857
tagged with: intellij-idea
downvote count: 0
answer count: 1
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has title: How JAX-RS-jersey-1.12 web server is run as java console application without specified container?
has body: IntelliJ created project for web services basing on JAX-RS-jersey-1.12. It can be fun as console app in IDE. How it is possible without Tomcat or other servlet containers? What kind of architecture does this set up uses? Example code: import com.sun.net.httpserver.HttpServer; import com.sun.jersey.api.container.httpserver.HttpServerFactory; import org.codehaus.jackson.map.ObjectMapper; import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import javax.ws.rs.GET; import javax.ws.rs.Produces; import javax.ws.rs.Path; @Path("/service") public class HelloWorld{ public String getClichedMessage() { return "Hello"; } public static void main(String[] args) throws IOException { HttpServer server = HttpServerFactory.create("http://localhost:8080/"); server.start(); } }
has comment: http://stackoverflow.com/comment/40286547
score: 1
tagged with: java
upvote count: 1
tagged with: web-services
type: Question

http://stackoverflow.com/comment/40455351
comment on: http://stackoverflow.com/a/25854444
type: AnswerComment
has text: some explanations would definitely improve the response!
score: 0
type: Comment

http://stackoverflow.com/comment/40329774
comment on: http://stackoverflow.com/q/25786334
score: 3
type: Comment
type: QuestionComment
has text: And again it is `String` not `Sting`. Your code won't even compile.

http://stackoverflow.com/a/25812951
has comment: http://stackoverflow.com/comment/40379150
has comment: http://stackoverflow.com/comment/40379926
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25812927
upvote count: 6
has body: You're checking whether the value is exactly the distance required. You need to check whether it's reached or exceeded the required distance: while (Math.abs(x) &lt; distance) In general, using == or != with floating point values is a bad idea - after you've performed some operations, you'll often find that a value is close to the expected one, but not exactly right. If you want to check whether one value is "pretty much equal to" another one, you need to define a particular tolerance and check that. I don't think that's required in your situation though.
score: 6
has comment: http://stackoverflow.com/comment/40379043
has comment: http://stackoverflow.com/comment/40378705

http://stackoverflow.com/a/25813448
upvote count: 2
has comment: http://stackoverflow.com/comment/40385017
has comment: http://stackoverflow.com/comment/40385216
has body: If I understand your question, then yes. One way, is to use a Scanner, and hasNextDouble() Scanner scan = new Scanner(System.in); List&lt;Double&gt; al = new ArrayList&lt;&gt;(); while (scan.hasNextDouble()) { // &lt;-- when no more doubles, the loop will stop. al.add(scan.nextDouble()); } System.out.println(al);
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40384979
score: 2
answers question: http://stackoverflow.com/q/25813343

http://stackoverflow.com/comment/40255441
has text: You should look into the cluster docs for Akka (http://doc.akka.io/docs/akka/2.3.6/common/cluster.html, http://doc.akka.io/docs/akka/2.3.6/scala/cluster-usage.html). To answer one of your questions, the cluster can grow and shrink w/o restarting the other nodes in the cluster as the cluster uses gossip to notify nodes about other nodes.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25744749
type: Comment

http://stackoverflow.com/comment/40408001
has text: Yes they are I can sort them to be in the same order every time.
comment on: http://stackoverflow.com/q/25828848
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25742197
downvote count: 0
score: 6
upvote count: 6
answers question: http://stackoverflow.com/q/25742014
type: Answer
has body: First of all, Maps are not ordered so you wont really have a first and last element. However, if you wish to get the first and last element of this anyways you could just get the values and convert this into an array. This isn't really pretty, but it'll work. Map&lt;String, String&gt; result = new HashMap&lt;String, String&gt;(); result = myModel.getSampleResults(); map.values().toArray()[0]; //First result map.values().toArray()[result.size()-1]; //Last result Note: This is not tested with a compiler.

http://stackoverflow.com/a/25761929
score: 4
has comment: http://stackoverflow.com/comment/40285478
has comment: http://stackoverflow.com/comment/40285928
type: Answer
has body: Just change this if(page.contains("of")) to if(page.contains(" of ")) EDIT: Just to consider if the sentence starts or finishes with "of": if(page.contains(" of ") || page.startsWith("of ") || page.endsWith(" of"))
has comment: http://stackoverflow.com/comment/40285987
downvote count: 1
upvote count: 5
answers question: http://stackoverflow.com/q/25761905

http://stackoverflow.com/q/25821874
linked to: http://stackoverflow.com/q/9554636
has answer: http://stackoverflow.com/a/25822440
has comment: http://stackoverflow.com/comment/40395378
linked to: http://stackoverflow.com/q/21461754
has answer: http://stackoverflow.com/a/25823054
answer count: 2
has comment: http://stackoverflow.com/comment/40395455
downvote count: 0
has body: I want to fill values of multiple jTextBox from a jFrame into another, using accessor methods like String getNameVal() { return jTextBox1.getText(); } How to call these methods from another jFrame?
favorite count: 0
accepted answer: http://stackoverflow.com/a/25823054
tagged with: jframe
tagged with: swing
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7017063
score: 1
tagged with: java
upvote count: 1
has title: Unable to get values from another jFrame
possible better answer: http://stackoverflow.com/a/25822440
type: Question

http://stackoverflow.com/comment/40323343
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25782515
has text: You have the spring-mvc.jar in version 3.2 in your classpath?

http://stackoverflow.com/comment/40477802
type: AnswerComment
type: Comment
has text: Thank you @ZInj for taking the time to answer. I know that DefaultHttpClient provides an easier way to read/write data, but the official doc says this : `For Android 2.3 (Gingerbread) and later, HttpURLConnection is the best choice. Its simple API and small size makes it great fit for Android. Transparent compression and response caching reduce network use, improve speed and save battery` http://goo.gl/4zyIki
score: 2
comment on: http://stackoverflow.com/a/25861187

http://stackoverflow.com/comment/40320710
comment on: http://stackoverflow.com/q/25781168
type: Comment
type: QuestionComment
score: 3
has text: Use a Logging framework like Log4J.

http://stackoverflow.com/comment/40310530
comment on: http://stackoverflow.com/q/25775182
score: 0
type: Comment
type: QuestionComment
has text: You have a CSV file with the list of image name and you seem to think passing the URL reference of this file to ImageIcon will magically read the file, know what each column in the file means and read the images for you...find me in the documentation where ImageIcon(URL) does this...

http://stackoverflow.com/comment/40215309
type: Comment
type: QuestionComment
has text: Post real code please. You will cause ArrayIndexOutOfBoundsException on `String money = array[4]` because you create it with only 4 element.
score: 0
comment on: http://stackoverflow.com/q/25723819

http://stackoverflow.com/comment/40355352
comment on: http://stackoverflow.com/a/25799834
has text: [{"role":"RANDOM_FAKE_AUTHORITY"}] is different than {"role":"RANDOM_FAKE_AUTHORITY"}
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40407823
comment on: http://stackoverflow.com/q/25828740
type: QuestionComment
has text: @AafreenSheikh on the contrary, if he'll use an iterator while modifying the list he'll get [ConcurrentModificationException](http://docs.oracle.com/javase/7/docs/api/java/util/ConcurrentModificationException.html)
score: 2
type: Comment

http://stackoverflow.com/comment/40360362
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25801456
has text: Certainly. I being a database guy, said it the way I look at the approach.
type: AnswerComment

http://stackoverflow.com/q/25717341
accepted answer: http://stackoverflow.com/a/25717367
has body: So, as I'm completely new to Android development, I wanted to create a simple application for my new Moto 360 (Google Wear) to display some content pulled from a webpage. Unfortunately, I get this error: android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views. How would I go about moving the part that modifies the text value of the TextView to the main class? public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.round_activity_my); TextView mTextView = (TextView)findViewById(R.id.text); myAsyncTask mTask = new myAsyncTask(); mTask.execute("http://ephemeraltech.com/demo/android_tutorial20.php"); /* final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub); stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() { @Override public void onLayoutInflated(WatchViewStub stub) { mTextView = (TextView) stub.findViewById(R.id.text); } }); */ } and the AsyncTask class is private class myAsyncTask extends AsyncTask&lt;String,Void,Void&gt; { @Override protected void onPreExecute() { } @Override protected Void doInBackground(String... str) { TextView mTextView = (TextView)findViewById(R.id.text); try { HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://ephemeraltech.com/demo/android_tutorial20.php"); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); InputStream webs = entity.getContent(); try { BufferedReader reader = new BufferedReader(new InputStreamReader(webs,"iso-8859-1"),8); mTextView.setText(reader.readLine()); webs.close(); } catch(Exception e){ mTextView.setText("HI"); } } catch (Exception e) { mTextView.setText(e.toString()); } return null; } } protected void onPostExecute(String str) { } }
possible better answer: http://stackoverflow.com/a/25717517
tagged with: android
has answer: http://stackoverflow.com/a/25717517
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25717367
score: 0
answer count: 2
has title: How to Move Code that Modifies View to Main Class
tagged with: textview

algorithm
tags question: http://stackoverflow.com/q/25816333
tags question: http://stackoverflow.com/q/25755458
tags question: http://stackoverflow.com/q/25820101
tags question: http://stackoverflow.com/q/25738561
tag name: algorithm
tags question: http://stackoverflow.com/q/25816429
tags question: http://stackoverflow.com/q/25864740
tags question: http://stackoverflow.com/q/25785291
tags question: http://stackoverflow.com/q/25776844
tags question: http://stackoverflow.com/q/25868255
tags question: http://stackoverflow.com/q/25830463
tags question: http://stackoverflow.com/q/25753271
tags question: http://stackoverflow.com/q/25817980
tags question: http://stackoverflow.com/q/25837732
tags question: http://stackoverflow.com/q/25753361
tags question: http://stackoverflow.com/q/25799235
tags question: http://stackoverflow.com/q/25827804
tags question: http://stackoverflow.com/q/25811077
tags question: http://stackoverflow.com/q/25773589
tags question: http://stackoverflow.com/q/25852643
tags question: http://stackoverflow.com/q/25834996
tags question: http://stackoverflow.com/q/25808492
tags question: http://stackoverflow.com/q/25838995
tags question: http://stackoverflow.com/q/25833115
tags question: http://stackoverflow.com/q/25830497
tags question: http://stackoverflow.com/q/25713404
type: Tag
tags question: http://stackoverflow.com/q/25804431
tags question: http://stackoverflow.com/q/25773103
tags question: http://stackoverflow.com/q/25751327
tags question: http://stackoverflow.com/q/25835325
tags question: http://stackoverflow.com/q/25830932
tags question: http://stackoverflow.com/q/25750240
tags question: http://stackoverflow.com/q/25754961
tags question: http://stackoverflow.com/q/25743753
tags question: http://stackoverflow.com/q/25857329
tags question: http://stackoverflow.com/q/25729872
tags question: http://stackoverflow.com/q/25751909
tags question: http://stackoverflow.com/q/25775663
tags question: http://stackoverflow.com/q/25734738
tags question: http://stackoverflow.com/q/25855106
tags question: http://stackoverflow.com/q/25793856
tags question: http://stackoverflow.com/q/25809769
tags question: http://stackoverflow.com/q/25759408
tags question: http://stackoverflow.com/q/25829540
tags question: http://stackoverflow.com/q/25715899
tags question: http://stackoverflow.com/q/25811373
tags question: http://stackoverflow.com/q/25836313
tags question: http://stackoverflow.com/q/25780189
tags question: http://stackoverflow.com/q/25840739
tags question: http://stackoverflow.com/q/25755899

http://stackoverflow.com/comment/40285552
comment on: http://stackoverflow.com/a/25761808
score: 0
type: Comment
has text: By the way, the question that I found isn't specifically about the `name="someName[]"` notation, and the answer for that question could've just been to set a `name` attribute on his inputs and then get the data by calling `String someData = Form.form().bindFromRequest().get("someName");`, which doesn't work for arrays.
type: AnswerComment

http://stackoverflow.com/q/25825990
tagged with: jersey
tagged with: ejb
tagged with: glassfish
has answer: http://stackoverflow.com/a/26081677
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25838442
has answer: http://stackoverflow.com/a/25838442
accepted answer: http://stackoverflow.com/a/26081677
has body: I have a very weird problem with Jersey REST services. I'm using: Glassfish sh4.0 EJB3.1 JDK1.7 Netbeans8.0 When I persist an object by GET request it normally store in database: @Singleton @Path("/person") public class SampleRest { @EJB PersonFasade personFasade; @GET public Person getPerson1( final @QueryParam("id") String id, final @QueryParam("first") String first, final @QueryParam("last") String last) { final Person person = this.personFasade.create(id, first, last); return person; } } But when I'm using POST: ... @POST public Person getPerson3(Person person) { this.personFasade.create(person); return person; } ... Everything works but Object does not store in database (without any error)!!
has comment: http://stackoverflow.com/comment/40402488
type: AnsweredQuestion
tagged with: java
has title: JTA persist does not work with REST POST service
type: Question

http://stackoverflow.com/q/25718804
tagged with: java
has answer: http://stackoverflow.com/a/25719312
has comment: http://stackoverflow.com/comment/40206471
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40206130
favorite count: 0
has title: How can we get 2 combobox selected items only into 3rd combobox dynamically in java swings?
type: UnansweredQuestion
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/40206319
tagged with: netbeans
has comment: http://stackoverflow.com/comment/40206452
has comment: http://stackoverflow.com/comment/40206250
has body: This is what I have done in android ,Here I am having 3 spinners and selecting 2 separate spinner items and those items must be dynamically displaying in 3rd spinner. and I am trying to do in java swings net beans but I am not getting, how to make please help me. Here in java swings I am using combo boxes instead of spinner. public void onItemSelected(AdapterView&lt;?&gt; p, View arg1, int arg2, long arg3) { switch (p.getId()) { case R.id.spinnerPetition: i = spinPetition.getSelectedItem().toString(); spinnerArray1[0] = i; Log.d("R", "" + Arrays.toString(spinnerArray1)); bind(); break; case R.id.spinnerRespondent: j = spinRespondent.getSelectedItem().toString(); spinnerArray1[1] = j; Log.d("R", "" + Arrays.toString(spinnerArray1)); bind(); break; default: break; } private void bind() { ArrayAdapter spinnerArrayAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_dropdown_item, spinnerArray1); spinAppearingFor.setAdapter(spinnerArrayAdapter); }
score: 1
upvote count: 1
type: Question

http://stackoverflow.com/comment/40788847
has text: The struts are properly configured, yet getting the similar stackoverflow error in another screen as well... (error.jsp)
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25855603

http://stackoverflow.com/a/25717811
downvote count: 0
has body: You would require to implement a custom data source in order to fetch data from List&lt;List &lt;String&gt;&gt;. Here's how your datasource implementation should look like import java.util.ArrayList; import java.util.List; import net.sf.jasperreports.engine.JRDataSource; import net.sf.jasperreports.engine.JRException; import net.sf.jasperreports.engine.JRField; public class RowDataList implements JRDataSource { List&lt;List&lt;String&gt;&gt; superList; int index=-1; Object o; public RowDataList(List&lt;List&lt;String&gt;&gt; list) { // pass your list here superList=list; } public Object getFieldValue(JRField arg0) throws JRException { List&lt;String&gt; stringList=superList.get(index); o=stringList; return o; } public boolean next() throws JRException { index++; return index&lt;superList.size(); } } Now you can fill your report as follows: public void generate(String filePath, List&lt;List&lt;String&gt;&gt; rowDataList) { Map paramMap = new HashMap(); //put params as per your requirement JasperPrint print = JasperFillManager.fillReport(report, paramMap,new RowDataList(rowDataList)); // note here the custom data source is utilized JasperExportManager.exportReportToPdfFile(print, filePath); } And after all you will have to make subtle changes to your .jrxml file. Here's how that would look. ..... &lt;subDataset name="dynamicDataSource"&gt; &lt;field name="paramList" class="java.util.List"/&gt; &lt;/subDataset&gt; &lt;field name="rowDataList" class="java.lang.ArrayList"/&gt; .... &lt;jr:table ....&gt; &lt;datasetRun subDataset="dynamicDataSource"&gt; &lt;dataSourceExpression&gt;&lt;![CDATA[$F{rowDataList}]]&gt;&lt;/dataSourceExpression&gt; &lt;/datasetRun&gt; &lt;jr:columnHeader...&gt; .... &lt;/jr:columnHeader&gt; &lt;jr:detailCell ...&gt; ... &lt;textFieldExpression&gt;&lt;![CDATA[$F{xxxxxx}]]&gt;&lt;/textFieldExpression&gt; &lt;-- Here, how can I print it out? &lt;/jr:detailCell&gt; &lt;/jr:table&gt; And you are ready to go. Hope this helps.
has comment: http://stackoverflow.com/comment/40203929
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/25717189
score: 2

http://stackoverflow.com/q/25857066
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40459585
type: Question
tagged with: recursion
score: -1
tagged with: startswith
has title: Difference between equals() and startsWith() in java
downvote count: 4
has answer: http://stackoverflow.com/a/25857143
answer count: 1
has comment: http://stackoverflow.com/comment/40459449
favorite count: 0
type: UnansweredQuestion
tagged with: equals
has comment: http://stackoverflow.com/comment/40459692
has body: Im practicing recursion for my own amusement using the codingBat exercises. Im doing this exercise: Given a string, compute recursively the number of times lowercase "hi" appears in the string, however do not count "hi" that have an 'x' immedately before them. countHi2("ahixhi") → 1 countHi2("ahibhi") → 2 countHi2("xhixhi") → 0 I tried to do this code but it keep throwing out of bounds exception: public int countHi2(String str){ if(str.length()&lt;2){ return 0; } else if(str.substring(0,3).equals("xhi")){ return countHi2(str.substring(3)); } else if(str.substring(0,2).equals("hi")){ return 1+countHi2(str.substring(2)); } else{ return countHi2(str.substring(1)); } } I changed the substring() and equals to startsWith() else if(str.startsWith("xhi")){ return countHi2(str.substring(3)); And now works perfectly, can someone please point out why my first code wasnt correct? Is there a difference between startsWith() and equals()?

http://stackoverflow.com/comment/40249644
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25741112
type: AnswerComment
has text: No. That is not the solution. You use writeInt() to tell the server how many files are coming. But you should use writeInt also for every file first. You write an int which tells how many bytes the following file will be. Then the server can just read that many bytes, read the next int and so on. So you have to adapt your protocoll. Thats why I asked you to explain first how this all should work.

http://stackoverflow.com/comment/95686647
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25773504
has text: Using `matcher.end(1) - matcher.start(1)` might be more efficient than `matcher.group(1).length()`, as it avoids creating a `String`, just for extracting its length. Further, there’s no reason to box the result into an `Integer`; just using `int` is sufficient.

http://stackoverflow.com/comment/40330281
comment on: http://stackoverflow.com/a/25780610
score: 0
type: Comment
has text: I have updated my question with my exact requirement. Please look into the updated section.
type: AnswerComment

http://stackoverflow.com/q/25780348
upvote count: 1
tagged with: swing
type: Question
has title: Styled Document for JScrollBar?
has comment: http://stackoverflow.com/comment/40319902
tagged with: jscrollbar
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25783205
has body: I want to customize the output of my scrollbar object. The code below works perfectly for JTextPane, what is the equivalent for JScrollBar? private JTextPane textPane; StyledDocument doc = textPane.getStyledDocument(); SimpleAttributeSet keyWord = new SimpleAttributeSet(); StyleConstants.setForeground(keyWord, Color.RED); StyleConstants.setBackground(keyWord, Color.YELLOW); StyleConstants.setBold(keyWord, true);
accepted answer: http://stackoverflow.com/a/25783205
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jtextpane
tagged with: document

http://stackoverflow.com/a/25800007
upvote count: 1
has body: To use stencil functionality, your framebuffer must have a stencil buffer. Since most applications are not using a stencil buffer, you will mostly get a framebuffer without stencil by default. To make sure that you have a stencil buffer, you need to explicitly request it. How a stencil buffer is requested depends on the platform and window system interface. It always needs to be done during initialization, and is part of setting up the context and rendering surface. Typical terminology used in the process of specifying the buffers you need are "pixel format" and "configuration". From reading the documentation, this is specified as part of the PixelFormat class in LWJGL. For creating the PixelFormat: PixelFormat pixFmt = new PixelFormat().withStencilBits(8); This PixelFormat instance can then be passed to one of the create() method overloads of the Display class.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25798964
score: 1

http://stackoverflow.com/comment/40370350
score: 0
type: Comment
has text: @Nekojimi just did that above. His answer is better.
comment on: http://stackoverflow.com/a/25808649
type: AnswerComment

http://stackoverflow.com/comment/40333410
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25786814
has text: Thank you for answering. This make me take the way to develop my own synchronization module cause 1/ I don't want to use standalone server 2/ I don't want to use Spring ! :).
type: AnswerComment

http://stackoverflow.com/comment/40435766
score: 1
type: AnswerComment
has text: You can provide any path you want. Please ask a new question to ask how you can specify a path, e.g. the users home path.
comment on: http://stackoverflow.com/a/25843689
type: Comment

http://stackoverflow.com/comment/40272326
comment on: http://stackoverflow.com/q/25754221
score: 0
type: Comment
type: QuestionComment
has text: editited - not a null pointer exception but a filenotfound exception, since the fileName is null. java.io.FileNotFoundException: public/null (No such file or directory)

http://stackoverflow.com/comment/40278603
score: 0
type: Comment
type: QuestionComment
has text: You can't both not want *and* want something...well, you can but it's pointless. Do you want a double `while` or not, and if not what do you suppose should replace the offending one for a while?
comment on: http://stackoverflow.com/q/25757918

http://stackoverflow.com/comment/40331956
type: Comment
score: 1
has text: also some performance improvments, on the for loop, instead of div < num you can do div <= sqrt(num), this will speed up the program because if a number isnt prime it will have a number that can / it that is <= than his sqrt, also, exept for 2 all prime numbers ar odd numbers, so that can be another speed up
type: AnswerComment
comment on: http://stackoverflow.com/a/25777076

http://stackoverflow.com/q/25799325
has title: How to implement Github library?
has answer: http://stackoverflow.com/a/25799434
has body: I am new to android and I want to add this viewpager library https://github.com/jfeinstein10/JazzyViewPager to my project. For that I first extracted the project. And than I right clicked on my project than Build Path -> configure build path-> than I selected libraries. After that I selected Add external jar and added the library. However, The project mentions that I should make changes in my Imagedadapter. Which I did.. However, I am getting yellow bulb with red cross and I it says JazzyViewPager cannot be resolved to a variable..I believe I am doing minor mistake..but can't figure out..Please help ..Thanks in advance Following is my Imageadapter.java import android.content.Context; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.LayerDrawable; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; public class ImageAdapter extends PagerAdapter { Context context; private int[] GalImages = new int[] { R.drawable.one, R.drawable.two, R.drawable.three, R.drawable.four, R.drawable.five }; ImageAdapter(Context context){ this.context=context; } @Override public int getCount() { return GalImages.length; } @Override public boolean isViewFromObject(View view, Object object) { return view == ((ImageView) object); } @Override public Object instantiateItem(ViewGroup container, int position) { ImageView imageView = new ImageView(context); int padding = context.getResources().getDimensionPixelSize(R.dimen.padding_small); imageView.setPadding(padding, padding, padding, padding); imageView.setScaleType(ImageView.ScaleType. FIT_XY ); Resources r = context.getResources(); Bitmap bmp = BitmapFactory.decodeResource(r, GalImages[position]); int width=200;//set your width int height=2…
answer count: 2
tagged with: android-viewpager
tagged with: github
linked to: http://stackoverflow.com/q/15845093
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/25799430
type: UnansweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/q/25820449
type: Question
has comment: http://stackoverflow.com/comment/40392967
has answer: http://stackoverflow.com/a/25820501
score: 0
has answer: http://stackoverflow.com/a/25820463
answer count: 3
tagged with: android
accepted answer: http://stackoverflow.com/a/25820501
possible better answer: http://stackoverflow.com/a/25820463
type: AnsweredQuestion
has body: I'm going through a tutorial that's teaching me about Android App development. I've been going through it all just fine but for some reason when I run this activity the app closes and says that it has stopped working. As far as I can tell I have copied the person's code correctly, but his works. I found that the problem is with the line inside onCreate that says tryCmd.setOnClickListener(this); If I comment out that single line, the activity works fine(but just doesn't do anything when I click the button, obviously). The app works fine with the togglebutton's onClickListener statement. Can anyone tell me what is wrong? Thanks. Here is all the code from my activity.java: package com.example.testapp; import java.util.Random; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.text.InputType; import android.view.Gravity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; import android.widget.ToggleButton; public class Text extends Activity implements View.OnClickListener{ EditText input; Button tryCmd; ToggleButton passTog; TextView display; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.text); //Call the method to assign variables to the elements. assignVariables(); //Initialize the button and ToggleButton to work with the onClick method. passTog.setOnClickListener(this); tryCmd.setOnClickListener(this); } private void assignVariables() { // TODO Auto-generated method stub input = (EditText) findViewById(R.id.etCommands); Button tryCmd = (Button) findViewById(R.id.bResults); passTog = (ToggleButton) findViewById(R.id.tbPassword); display = (TextView) findViewById(R.id.tvResults); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()){ case R.id.bResults: String check = input.getText().toString(); if (ch…
tagged with: onclicklistener
has title: Android app closes due because of button.setOnClickListener(this)
has answer: http://stackoverflow.com/a/25820475
tagged with: java

http://stackoverflow.com/a/25829729
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25829652
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/25829652
has comment: http://stackoverflow.com/comment/40409475
has body: You should actually be using convertRowIndexToModel - Maps the index of the row in terms of the view to the underlying TableModel. If the contents of the model are not sorted the model and view indices are the same. You have your selected rows, which are the selected indices in the view. So you need to convert those indices to the model indices before deleting. When you use convertRowIndexToView, you're actually doing the opposite, trying to convert the model index to the table index. " Is the above correctly implemented?" First thing, when you want to remove rows this way, you should be traversing the indices backwards, from the last row up. The reason is that when you remove a row, the indices change. So you loop should go backwards like int [] selectedRows = table.getSelectedRows(); for (int i = selectedRows.length - 1; i &gt;= 0; i--) { int viewIndex = selctedRows[i]; int modelIndex = table.convertRowIndexToModel(viewIndex); model.removeRow(modelIndex); } The point is you want to remove the highest index first and work your way down to the lower indices.

counter
tags question: http://stackoverflow.com/q/25765559
tag name: counter
type: Tag

http://stackoverflow.com/comment/40394611
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25821371
type: QuestionComment
has text: Oh ... ok layer 8 problem ... Thank for the fast help :-)

http://stackoverflow.com/a/25743446
has comment: http://stackoverflow.com/comment/40251706
answers question: http://stackoverflow.com/q/25743279
has body: In addition to catch(InputMismatchException e){ System.out.println("Input Mismatch Error"); } Add another after that: catch(Exception e){ System.out.println("Other Error"); } Instead of input.nextLine(), use input.next() Then check again
score: 0
type: Answer

http://stackoverflow.com/comment/40372543
comment on: http://stackoverflow.com/q/25809538
type: Comment
type: QuestionComment
score: 1
has text: @Aeshang: There are various ways... I suggest the OP tries for themselves, and asks a specific question if they get stuck.

http://stackoverflow.com/a/25857611
type: Answer
has comment: http://stackoverflow.com/comment/40461641
has body: import com.jayway.restassured.RestAssured.*; import com.jayway.restassured.matcher.RestAssuredMatchers.*; import org.hamcrest.Matchers.*; public class TestRest { public void doTest() { String json = given().port(3000).get("/ping").toString(); System.out.println(json); } } To import library into maven: com.jayway.restassured rest-assured 2.3.3 test Edit To do this without static references: import com.jayway.restassured.RestAssured; public class testAPI { public void doTest() { String json = RestAssured.given().port(3000).get("/ping").toString(); System.out.println(json); } }
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40461916
has comment: http://stackoverflow.com/comment/40460841
has comment: http://stackoverflow.com/comment/40460611
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25857231
has comment: http://stackoverflow.com/comment/40462243
has comment: http://stackoverflow.com/comment/40460691
answers question: http://stackoverflow.com/q/25857231

http://stackoverflow.com/q/25864367
has title: How to make a java proxy object to java.nio.ByteBuffer instance?
has comment: http://stackoverflow.com/comment/40477158
has answer: http://stackoverflow.com/a/25866169
has comment: http://stackoverflow.com/comment/40473510
has comment: http://stackoverflow.com/comment/40472669
favorite count: 0
linked to: http://stackoverflow.com/q/23732236
tagged with: javassist
has answer: http://stackoverflow.com/a/25891736
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40477354
has answer: http://stackoverflow.com/a/25866851
tagged with: byte-buddy
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40473541
upvote count: 1
tagged with: proxy-classes
type: Question
has body: I have a public abstract class java.nio.ByteBuffer instance which is actually an instance of private class java.nio.HeapByteBuffer and I need to make a proxy object which would call some invocation method handler to check access permissions and then call the invoked method on the actual instance. The problem is that the java.nio.ByteBuffer class has only private constructors and also has some final methods, thus I can not create proxy instances with javassist.util.proxy.ProxyFactory class. So, how can I make a proxy object to control the invocation of a java.nio.ByteBuffer instance including those final methods invocation?
downvote count: 0
tagged with: cglib
answer count: 3

http://stackoverflow.com/comment/97497244
type: AnswerComment
has text: I think I have similar problem . I have installed tomcat in opt folder. Where did you place your application file ? Should I change folder attributes too ?
type: Comment
comment on: http://stackoverflow.com/a/28609421
score: 0

http://stackoverflow.com/q/25866915
type: AnsweredQuestion
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25866991
possible better answer: http://stackoverflow.com/a/25866973
type: Question
has answer: http://stackoverflow.com/a/25866973
has answer: http://stackoverflow.com/a/25869936
answer count: 3
has body: My code is reading data from property file. which may have following entries rahul.myServer2.ip=192.168.0.4 I used following regex to fetch ip rahul\.(\w+)\.ip but my regex failed when i got rahul.myServer-1.ip=192.168.0.3 now I need to write regex that will accept some special character also. and it will return the values of ip and myServername whatever we will provide
has title: Regex in java which will accept following pattern
has answer: http://stackoverflow.com/a/25866991
tagged with: regex
has comment: http://stackoverflow.com/comment/40476913

http://stackoverflow.com/q/25794417
has comment: http://stackoverflow.com/comment/40345253
has answer: http://stackoverflow.com/a/25794557
has body: This defining property of stacks is called "Last In, First Out," or LIFO considering the following snippet of the code Stack&lt;String&gt; theStack = new Stack&lt;String&gt;(); theStack.push ("A"); theStack.push ("B"); theStack.push ("C"); theStack.remove (1); // removes B print the output System.out.println(theStack); produces the output [A, C] Since Stack is part of List interface the remove method is available, "hence it violates the LIFO property of the stack" Is this purposefully designed in Java collection Framework ?
has comment: http://stackoverflow.com/comment/40344998
has comment: http://stackoverflow.com/comment/40345862
has comment: http://stackoverflow.com/comment/40345025
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/40345277
has comment: http://stackoverflow.com/comment/40346825
favorite count: 0
has comment: http://stackoverflow.com/comment/40345441
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40347244
downvote count: 0
has title: Why stack uses List interface java collection
tagged with: java
has comment: http://stackoverflow.com/comment/40346357
type: Question
has answer: http://stackoverflow.com/a/25794487
score: 3

http://stackoverflow.com/a/38795588
score: 0
type: Answer
has body: Adding Eclipse Java 8 Support helped me to resolve the issue! Ref : Eclipse + Java 8 support?
answers question: http://stackoverflow.com/q/25763717

http://stackoverflow.com/q/25781927
has answer: http://stackoverflow.com/a/25783138
type: Question
possible better answer: http://stackoverflow.com/a/30787210
has title: How to read pdf stream in angularjs
has comment: http://stackoverflow.com/comment/68898637
has answer: http://stackoverflow.com/a/43550972
tagged with: angularjs
accepted answer: http://stackoverflow.com/a/25808659
has comment: http://stackoverflow.com/comment/40324517
tagged with: http://stackoverflow.com/tag/pdf
has answer: http://stackoverflow.com/a/35652355
favorite count: 0
score: 30
has comment: http://stackoverflow.com/comment/40323259
upvote count: 31
has comment: http://stackoverflow.com/comment/40324066
answer count: 5
downvote count: 1
has body: I got the following PDF stream from a server: How can this stream be read in AngularJS? I tried to open this as a PDF file in a new window by using the following code: .success(function(data) { window.open("data:application/pdf," + escape(data)); }); But I'm unable to see the content in opened window.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25808659
has answer: http://stackoverflow.com/a/30787210
tagged with: java
linked to: http://stackoverflow.com/q/21628378
tagged with: inputstream

http://stackoverflow.com/comment/40408872
score: 0
type: AnswerComment
has text: @RyanBrady : Haha, make the Java Collection API your friend to become efficient. `HashSet` and `HashMap` are really useful. You should read their doc as well as `ArrayList`, `LinkedList`, `TreeSet`. Then, depending on your needs, there are some other interesting classes such `ArrayDeque`, `PriorityQueue`...
type: Comment
comment on: http://stackoverflow.com/a/25829285

http://stackoverflow.com/q/25777145
has answer: http://stackoverflow.com/a/25777753
tagged with: javabeans
has body: I am new to Java spring framwork. I am using the spring framework do the the functional test. As a part of testing, I have file that need to pass to API and validate from the DB, that the file data is goes into DB. I have using spring to store the test file with associated data data. . My test has to call API with multiple files . How can from the spring file properties DifferentValuesInBeanForFile1 ( see spring file ) = Some bean that has data associated with file 1. DifferentValuesInBeanForFile2 = Some bean that has data associated with file 2. So test can validate API correctly processed input file 1 by validatitng data <util:map> <entry InputFile="fileWithDeal123.avro" value="DifferentValuesInBeanForFile1" /> <entry InputFile="fileWithDeal999.avro" value="DifferentValuesInBeanForFile1" /> </util:map>
has title: Spring Config file to have different bean data populated based on input
tagged with: spring
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25777753
type: Question
tagged with: java
score: 0
answer count: 1

http://stackoverflow.com/q/25849605
has title: HibernateTemplate bulkUpdate using IN - clause
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40477804
has comment: http://stackoverflow.com/comment/40477311
tagged with: spring
has comment: http://stackoverflow.com/comment/40475709
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40445826
type: Question
has body: How to perform bulkUpdate operation using hibernateTemplate. The following code throws Caused by: org.hibernate.QueryParameterException: Position beyond number of declared ordinal parameters. Remember that ordinal parameters are 1-based! Position: 2 HibernateTemplate.bulkUpdate("update Address address set address.city = 'Oakland' where address.user in (:users)", users); How to achieve this batch update operation by passing list of users as a parameter???
answer count: 2
has comment: http://stackoverflow.com/comment/40445989
has answer: http://stackoverflow.com/a/42785609
tagged with: bulkupdate
has answer: http://stackoverflow.com/a/32517749
linked to: http://stackoverflow.com/q/5368522
upvote count: 1
favorite count: 0

http://stackoverflow.com/q/25793068
has comment: http://stackoverflow.com/comment/40342438
tagged with: web-services
answer count: 4
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/59099968
score: 16
has answer: http://stackoverflow.com/a/60087765
has answer: http://stackoverflow.com/a/59099968
downvote count: 1
upvote count: 17
type: Question
has answer: http://stackoverflow.com/a/45143556
has body: Getting error when trying to test Jersey web services java.lang.NoClassDefFoundError: groovy/lang/GroovyObject Caused by: java.lang.ClassNotFoundException: groovy.lang.GroovyObject . import static com.jayway.restassured.RestAssured.expect; import static com.jayway.restassured.RestAssured.get; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.nullValue; import org.junit.Test; public class SimpleTest { @Test public void testUserFetchesSuccess() { expect(). body("id", equalTo("1")). when(). get("/service"); } } What does it mean? How to fix it? UPDATE I downloaded and installed groovy-all. Now I am getting: java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling at com.jayway.restassured.internal.ResponseParserRegistrar.&lt;init&gt;(ResponseParserRegistrar.groovy) at com.jayway.restassured.RestAssured.&lt;clinit&gt;(RestAssured.java:346) at SimpleTest.testUserFetchesSuccess(SimpleTest.java:10) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.ju…
tagged with: groovy
tagged with: junit
has answer: http://stackoverflow.com/a/25793187
has title: java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
favorite count: 0
accepted answer: http://stackoverflow.com/a/25793187

http://stackoverflow.com/comment/40365388
has text: @JoopEggen Are you saying they might have the JDK on a server? would NetBeans even work without JDK? Can i somehow get the Path to the JDK within Netbeans or Eclipse?
comment on: http://stackoverflow.com/q/25805688
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40436848
type: Comment
comment on: http://stackoverflow.com/q/25844196
has text: Trying it out the inputverifier gets called after stopCellEditing by the super(StopCellEditing()). I need to validate the field prior to this.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/105065958
comment on: http://stackoverflow.com/a/59439447
type: Comment
has text: Not sure, I did not have this problem. I am working with the package I downloaded
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40238774
type: Comment
has text: I totally agree with your answer yet the OP has other issues as well
comment on: http://stackoverflow.com/a/25736146
type: AnswerComment
score: 0

http://stackoverflow.com/q/25804102
tagged with: maven
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25809056
tagged with: java
score: 4
has body: I have a Selenium TestNG project created with maven. `` There is no main class for this prject Using TestNg.xml file and the same is configured in pom.xml file. Ran 'maven test' from eclispe and the test runs successfully based on the classes defined in testng.xml. no issues here Tried the same from command prompt using mvn test from the project folder and it ran succesfully. no issues here too. My requirement : Now i want to package this project either to executable jar or are there are any option to make a executable file so that i can schedule the run using a batch file. To do this I ran the 'mvn package' command and it generated the jar file in the target folder. Now when i try to run this as java -jar myproj-0.0.1-SNAPSHOT.jar i get the message as "no main manifest attribute, in myproj-0.0.1-SNAPSHOT.jar". This is expected behavior since there is no main class in my case. So i created a main class with just one line to print "text" and added the mainClass below entry in pom.xml org.apache.maven.plugins maven-jar-plugin 2.3.2 mainPackage.MainOne Then i ran mvn package and it generated the new jar. Then went to target folder of my project and ran the command as java -jar myProj.jar mainPackage.MainOne, it ran and just printed "text". MY TestNG tests did not run. It just ran main class :(.. What should i do?
type: Question
upvote count: 4
answer count: 2
has answer: http://stackoverflow.com/a/25804481
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25804481
has answer: http://stackoverflow.com/a/25809056
linked to: http://stackoverflow.com/q/2146580
has title: executable jar for selenium testng maven project which dont have a main class
tagged with: selenium

http://stackoverflow.com/q/25731346
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jsoup
has answer: http://stackoverflow.com/a/25731426
has body: I'm trying to read a robot.txt file using jsoup. I want to read this file line by line and identify whether a line is disallowed/allowed/useragent/sitemap. Using Jsoup I do the following: robotfile = Jsoup.connect(u).get(); robotfile.text(); However, the latter gives me: 80legs User-agent: 008 Disallow: / User-Agent: bender Disallow: /my_sh.. etc Even if I do .html(), I can not see any linebreaks (e.g. tags), so I am not able to replace all those values with a simple linebreak. Is there a way to read this file line by line? Thank you!
tagged with: robots.txt
score: 0
answer count: 1
tagged with: parsing
accepted answer: http://stackoverflow.com/a/25731426
has title: Reading robot.txt with jsoup line-by-line

http://stackoverflow.com/comment/40426679
comment on: http://stackoverflow.com/a/25838975
score: 0
type: AnswerComment
type: Comment
has text: Thanks for reply, I am something new with Java, when I call "orderByName(estudiantes);", I get an error, It says "The method orderByName(ArrayList<Person>) in the type Principal is not applicable for the arguments (ArrayList<Student>)" :(

http://stackoverflow.com/comment/40441014
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25843823
type: QuestionComment
has text: @Abhin - Thanks - using slf4j version 1.7.3 - and all other exceptions print with stack traces fine.

http://stackoverflow.com/a/25866874
answers question: http://stackoverflow.com/q/25865587
has comment: http://stackoverflow.com/comment/40504082
has comment: http://stackoverflow.com/comment/43325419
type: Answer
has body: First of all onCharacteristicRead will fire if you have read a characteristic by: mBluetoothGatt.readCharacteristic(characteristic); Reading a characteristic and setting up notifications are two different things. What is the type of your characteristic you want to get data from? Is it: read notify indicate If it is read you can read the characteristic using the mBluetoothGatt.readCharacteristic(characteristic); method but if its notify or indicate first you will have to read the characteristic's descriptor by calling: mBluetoothGatt.readDescriptor(ccc); Once you read it, it should return data by calling the onDescriptorRead callback. Here you can set up (subscribe) to the charactersitic through either notification or indication by calling: mBluetoothGatt.setCharacteristicNotification(characteristic, true) once it returns true you will need to write to the descriptor again (the value of notification or indication) BluetoothGattDescriptor clientConfig = characteristic.getDescriptor(CCC); clientConfig.setValue(BluetoothGattDescriptor.ENABLE_NOTIFICATION_VALUE); // or //clientConfig.setValue(BluetoothGattDescriptor.ENABLE_INDICATION_VALUE); mBluetoothGatt.writeDescriptor(clientConfig); Once this is done you will get notifications throuhg onCharacteristicChanged callback every time the characteristic changes. you can read more about Bluetooth connection on Android here and about Bluetooth Characteristics here
upvote count: 26
accepted answer of: http://stackoverflow.com/q/25865587
score: 26
has comment: http://stackoverflow.com/comment/43290702
has comment: http://stackoverflow.com/comment/43293270
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25784705
upvote count: 4
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25784985
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/25838317
has body: I am currently learning JAVA EE. I use an oracle Java EE 7 tutorial for that. According to this tutorial, section 34.1.4, they used some non-EJB helper classes for the tutorial example. http://docs.oracle.com/javaee/7/tutorial/doc/ejb-basicexamples001.htm I'm wondering in what cases I should make a class EJB, and in what cases I should use a usual helper class. I have read what the benefits of using EJB are. But are there cases when it's better to use POJOs?
accepted answer: http://stackoverflow.com/a/25838317
has title: When should I use POJO (instead of EJB) in a Java EE application?
has answer: http://stackoverflow.com/a/25784985
tagged with: ejb
score: 4

http://stackoverflow.com/comment/40312513
type: Comment
type: QuestionComment
has text: I analyzed that example and it is quite irrelevant. It handles dragging of local files which already exist on the local system. I need to be notified about the drop destination so I can "generate" the file asked for and put to the destination folder via Java application acting as a download manager.
comment on: http://stackoverflow.com/q/25771371
score: 0

http://stackoverflow.com/q/25835577
has comment: http://stackoverflow.com/comment/40420015
type: Question
has answer: http://stackoverflow.com/a/29499445
has comment: http://stackoverflow.com/comment/40420167
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40420068
tagged with: layout-manager
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/40421357
score: 2
has comment: http://stackoverflow.com/comment/40420095
has comment: http://stackoverflow.com/comment/40420325
has comment: http://stackoverflow.com/comment/40421654
upvote count: 2
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40420143
has comment: http://stackoverflow.com/comment/40420077
has comment: http://stackoverflow.com/comment/40420667
has body: I'm trying to create a Java Program that does this, A Frame with NORTH ;Description:Two Button Listener CENTRE:Description: Click Button1 to change solidcolor circle and Button2 to change gradient circle SOUTH: I want 2 buttons ,Button 1 and Button 2 WEST: A Circle with a gradient colour EAST:A circle with a solid colour It's fairly Simple , when I click a button the respective circle's colour should change The code is as follows .. import javax.swing.*;//for the frame etc import java.awt.*;//for paintComponent(),Grapics Object etc import java.awt.event.*;//for listeners class CircleGradientColor extends JPanel { public void paintComponent(Graphics g) { Graphics2D g2d=(Graphics2D)g;//cast int r1=(int)(Math.random()*255); int g1=(int)(Math.random()*255); int b1=(int)(Math.random()*255); int r2=(int)(Math.random()*255); int g2=(int)(Math.random()*255); int b2=(int)(Math.random()*255); Color startcolor=new Color(r1,g1,b1); Color endcolor=new Color(r2,g2,b2); GradientPaint gradient=new GradientPaint(10,10,startcolor,70,70,endcolor); g2d.setPaint(gradient);//here it aint set color for a Graphics2D object g2d.fillOval(10,10,60,60);//fills with the Current PaintBrushColor } } class CircleSolidColor extends JPanel//this class will contain code for the circle { public void paintComponent(Graphics g) { int r=(int)(Math.random()*255);//generate random float between 0 & 255 int b=(int)(Math.random()*255);//generate random float between 0 & 255 int gr=(int)(Math.random()*255);//generate random float between 0 & 255 Color randcolor=new Color(r,gr,b);//name clashed with Graphics g g.setColor(randcolor); g.fillOval(10,10,60,60); } } public class TwoButtonGui { JFrame frame; CircleSolidColor circlesolidcolor; CircleGradientColor circlegradientcolor; JButton b1; JButton b2; JLabel toplabel; JLabel centerlabel; public static void main(String[] args) { TwoButtonGui twobuttongui=new TwoButtonGui(); twobuttongui.go(); } public void go() { frame=new JFrame(); toplabel=new JLabel("Example …
tagged with: swing
has comment: http://stackoverflow.com/comment/40420213
has title: JFrame's Border Layout Positioning Not as Expected
tagged with: java
has comment: http://stackoverflow.com/comment/40420374

http://stackoverflow.com/q/25729689
type: UnansweredQuestion
tagged with: java
tagged with: swing
type: Question
tagged with: gridbaglayout
score: -1
has body: I'm trying to get GridBagLayout to place 4 panels in a frame, one panel in each quadrant of the frame. I'm sure that I'm misunderstanding something basic with the layout manager but I'm not sure what. Here's the code that I have for my GUI: import java.awt.ScrollPane; import java.awt.Color; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.Insets; import java.awt.GridBagLayout; import java.awt.GridBagConstraints; import javax.swing.border.*; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.ListSelectionModel; import javax.swing.SwingConstants; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; /** * GUI to interact with BookList */ public class GUI extends JPanel implements ActionListener { //// Main Panel //// //////////////////// private JPanel mainPanel; //// Border //// //////////////// private Border loweredBorder; //// Input Panel //// ///////////////////// private JPanel inputPanel; private JLabel titleLabel; private JTextField titleField; private JLabel authorLabel; private JTextField authorField; private JLabel genreLabel; private JTextField genreField; private JLabel priceLabel; private JTextField priceField; private JLabel reviewLabel; private JTextField reviewField; private JButton addBookButton; //// Search Panel //// ////////////////////// private JPanel searchPanel; private JLabel searchLabel; private JTextField searchField; private JButton searchButton; //// Output Panel //// ////////////////////// private JPanel outputPanel; private JLabel titleDisplayLabel; private JLabel titleOutputLabel; private JLabel authorDisplayLabel; p…
tagged with: jtable
tagged with: jscrollpane
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25729883
favorite count: 0
has comment: http://stackoverflow.com/comment/40226299
has title: Components not appearing as intended with GridBagLayout
upvote count: 0

http://stackoverflow.com/comment/40366648
has text: If you can't fit your object in memory, then avoid cases that requires you to store it in memory. Work with it as stream.
comment on: http://stackoverflow.com/q/25806441
score: 5
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40273789
type: Comment
comment on: http://stackoverflow.com/q/25755048
type: QuestionComment
has text: It will loop forever. the in.nextInt() must be inside the loop statement.
score: 0

http://stackoverflow.com/comment/40480099
score: 0
type: Comment
type: QuestionComment
has text: How do you handle transactions? .. i think that resturant is detached when you save Manager and CASCADE.ALL persist again Resturat that have ID = 1 "Duplicate primary key". Can you add your configuration? .. one possible test is add on resturant entity @GeneratedValue(strategy=GenerationType.AUTO), if persist another one is as i say
comment on: http://stackoverflow.com/q/25863678

http://stackoverflow.com/comment/113374526
has text: Hello, this reply is correct but it is basically duplicating previous answers: [6-year old](https://stackoverflow.com/a/25873705/13279831), [5-year-old](https://stackoverflow.com/a/31579156/13279831) etc.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/64113385
score: 2

http://stackoverflow.com/a/25780277
type: AcceptedAnswer
downvote count: 0
has body: Possible duplicate: In Eclipse, how do I change perspectives after terminating a process? Short answer: there's no way eclipse can decide when to switch back.
has comment: http://stackoverflow.com/comment/40320542
type: Answer
has comment: http://stackoverflow.com/comment/40320791
accepted answer of: http://stackoverflow.com/q/25780011
score: 1
answers question: http://stackoverflow.com/q/25780011
upvote count: 1

http://stackoverflow.com/q/25852634
type: Question
has answer: http://stackoverflow.com/a/25852699
tagged with: inheritance
tagged with: class
score: 0
possible better answer: http://stackoverflow.com/a/25852699
has title: Why B b = new A() is invalid and A a = new B() is valid when B extends A?
upvote count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/25852669
accepted answer: http://stackoverflow.com/a/25852669
answer count: 4
downvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/78677149
has answer: http://stackoverflow.com/a/42710973
has comment: http://stackoverflow.com/comment/40451233
tagged with: java
has body: I am new to JAVA and want to know that why A a = new B(); is valid and B b = new A(); is invalid Considering that: class A; class B extends A;

http://stackoverflow.com/q/25825780
score: 1
tagged with: java
tagged with: swing
type: Question
tagged with: jtree
has title: Hiding files and hidden directories in a Swing JTree
tagged with: filesystems
has answer: http://stackoverflow.com/a/25825986
accepted answer: http://stackoverflow.com/a/25825986
upvote count: 1
answer count: 1
favorite count: 0
has body: I've used this code from the Java2s.com to display a file tree of my home directory. I'd like to have the user select directories that are going to contain information that my program will use. I've made numerous attempts (too many to list here) to get the tree to display only non-hidden directories. Files and hidden directories are not to be shown on the tree. Is there a way to do this? I've spent quite a lot of time on this but have not succeeded. Is there a way to intercept what the final display will look like? Maybe the a renderer could interrogate the tree and remove nodes that fall under isHidden()? public class FileTreeDemo { static File root; static FileTreeModel model; public static void main(String[] args) { // Figure out where in the filesystem to start displaying if (args.length &gt; 0) { root = new File(args[0]); } else { root = new File(System.getProperty("user.home")); } // Create a TreeModel object to represent our tree of files model = new FileTreeModel(root); // Create a JTree and tell it to display our model JTree tree = new JTree(); tree.setModel(model); // The JTree can get big, so allow it to scroll JScrollPane scrollpane = new JScrollPane(tree); // Display it all in a window and make the window appear JFrame frame = new JFrame("FileTreeDemo"); frame.getContentPane().add(scrollpane, "Center"); frame.setSize(400, 600); frame.setVisible(true); } /** * The methods in this class allow the JTree component to traverse the file * system tree and display the files and directories. * */ static class FileTreeModel implements TreeModel { // We specify the root directory when we create the model. protected File root; public FileTreeModel(File root) { this.root = root; } // The model knows how to return the root object of the tree public Object getRoot() { return root; } // Tell JTree whether an object in the tree is a leaf @Override public boolean isLeaf(Object node) { return ((File)node).isFile(); } // Tell JTree how many children a node has public int g…
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/25789485
type: Answer
has comment: http://stackoverflow.com/comment/40335945
has body: The below fragment in your code: File parent = file.getParentFile(); if (parent != null) { parent.mkdirs(); } where does this create the parent directories? Because I tried your code and it's not creating in the destination directory but rather in my Eclipse's project directory. Looking at your code, the destination directory is nowhere used, right? The code actually extracts the contents of the zip file but not where I expected it.
score: 0
has comment: http://stackoverflow.com/comment/40335766
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25788582
accepted answer of: http://stackoverflow.com/q/25788582

http://stackoverflow.com/comment/40409285
type: AnswerComment
comment on: http://stackoverflow.com/a/25828955
type: Comment
has text: @Dareen - Or to put it another way, if you were my boss, and you were snooping on my email like this, I would be tempted to resign on the spot.
score: 0

http://stackoverflow.com/comment/40357241
score: 0
has text: What's the requirement?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25800990

http://stackoverflow.com/comment/40423183
comment on: http://stackoverflow.com/a/25837064
type: Comment
has text: Sorry, but it doesn't update constantly but it only updates per click
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40389473
type: Comment
comment on: http://stackoverflow.com/a/25818451
type: AnswerComment
has text: same thing bro :( nothing just the zoom buttons and the google sign .. pleaaase heeelp
score: 0

http://stackoverflow.com/q/25777452
answer count: 3
downvote count: 2
has answer: http://stackoverflow.com/a/25777580
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25777475
tagged with: java
has answer: http://stackoverflow.com/a/25777498
has title: Unused String Variable
type: Question
possible better answer: http://stackoverflow.com/a/25777498
upvote count: 0
score: -2
has body: import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println("Enter the name of your favorite insect: "); String userString = input.next(); String lyric = ""; String endlyric = ""; String OneThree = "I'm " +lyric+ "my baby " +userString; String Two = "Won't my Mommy be so proud of me"; int count = 5; while (count != 0) { if (count == 5) { lyric = "bringing home "; endlyric = "OUCH!! It stung me!!"; count = count - 1; } else if (count == 4) { lyric = "squishin' "; endlyric = "ICK!! I feel sick!!"; count = count - 1; } else if (count == 3) { lyric = "barfin "; endlyric = "OH!! What a mess!!"; count = count - 1; } else if (count == 2) { lyric = "wipin' "; endlyric = "OOPS!! Mommy's new towel!!"; count = count - 1; } else if (count == 1) { lyric = "wringin' "; endlyric = "Bye-Bye baby "+userString+ "!!"; count = count - 1; } System.out.println(OneThree); System.out.println(Two); System.out.println(OneThree); System.out.println(endlyric); System.out.println(""); } } } For some odd reason the lyric variable will not print... I get an error that states that it is unused. I have initialized the variable. the other variables work fine but that one please help...
favorite count: 0
accepted answer: http://stackoverflow.com/a/25777475

http://stackoverflow.com/a/26308121
has body: Make sure you are using the latest version, as of the day of posting, use v2.13 In your web.xml, make sure that the following is added to the servlet tag true
score: 7
has comment: http://stackoverflow.com/comment/95122685
answers question: http://stackoverflow.com/q/25828425
has comment: http://stackoverflow.com/comment/52904077
upvote count: 8
type: Answer
has comment: http://stackoverflow.com/comment/41361264
downvote count: 1
has comment: http://stackoverflow.com/comment/41293065

http://stackoverflow.com/a/25822214
accepted answer of: http://stackoverflow.com/q/25822063
answers question: http://stackoverflow.com/q/25822063
has comment: http://stackoverflow.com/comment/40396914
has body: Try this way,hope this will help you to solve your problem. Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_TEXT,message); try { context.startActivity(Intent.createChooser(i, "Share")); } catch (android.content.ActivityNotFoundException ex) { ex.printStackTrace(); }
has comment: http://stackoverflow.com/comment/40396595
has comment: http://stackoverflow.com/comment/40396358
has comment: http://stackoverflow.com/comment/40397455
has comment: http://stackoverflow.com/comment/40396726
has comment: http://stackoverflow.com/comment/40397310
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40397431
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40397633

http://stackoverflow.com/a/25836611
downvote count: 0
has body: I would like to have a window, with a text pane on the left side taking exactly 50% of the window. Then you should be using a panel with a GridLayout for those two components. On the right side of the windows (the other 50%) another text pane and below that (but only taking minimum required size) a label. Then maybe a BorderLayout with the text pane added to the "CENTER" and the label added to the "PAGE_END".
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25836533
answers question: http://stackoverflow.com/q/25836533
type: Answer
score: 3

http://stackoverflow.com/q/25761474
tagged with: php
has answer: http://stackoverflow.com/a/25761633
tagged with: java
type: Question
answer count: 3
has title: Run java from PHP script
score: 0
has answer: http://stackoverflow.com/a/30519106
has answer: http://stackoverflow.com/a/25761730
has body: I try to run java from PHP but I can't even if I use absolute path to java executable (C:\Windows\System32\java.exe). I found that the problem is PHP can't access this file, for some reason. I try: &lt;?php var_dump(file_exists('C:\Windows\System32\java.exe')); // returns false. File actually exists and I (user under who I run php script) has permission to read and execute it. It is very strange because I can execute notepad.exe and &lt;?php var_dump(file_exists('C:\Windows\System32\notepad.exe')); // returns true. Any ideas? php -v PHP 5.3.27 (cli) (built: Jul 10 2013 20:36:59) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies with Xdebug v2.2.2, Copyright (c) 2002-2013, by Derick Rethans java -version java version "1.7.0_40" Java(TM) SE Runtime Environment (build 1.7.0_40-b43) Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode) OS Windows 7 64bit PHPinfo: phpinfo() PHP Version => 5.3.27 System =&gt; Windows NT IT8 6.1 build 7601 (Windows 7 Business Edition Service Pack 1) i586 Build Date =&gt; Jul 10 2013 20:35:35 Compiler =&gt; MSVC9 (Visual C++ 2008) Architecture =&gt; x86 Configure Command =&gt; cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" "--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" "--with-enchant=shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" Server API =&gt; Command Line Interface Virtual Directory Support =&gt; disabled Configuration File (php.ini) Path =&gt; C:\Windows Loaded Configuration File =&gt; C:\Program Files (x86)\PHP\php.ini Scan this dir for additional .ini files =&gt; (none) Additional .ini files parsed =&gt; (none) PHP API =&gt; 2009…
type: UnansweredQuestion

http://stackoverflow.com/a/25769143
type: Answer
has body: I found the solution. I included file log4j.properties in src/main/resources and changed my pom.xml log4j.properties: log4j.rootLogger=WARN, A1 log4j.category.org.displaytag.tags.TableTag=ERROR, A1 pom.xml: src/main/resources ${basedir}/target true log4j.properties That's it!!!
answers question: http://stackoverflow.com/q/25767618
score: 0

http://stackoverflow.com/a/25722404
has comment: http://stackoverflow.com/comment/106681414
downvote count: 1
score: 0
type: Answer
has body: You can check this link, He use the wikipedia to have a corpora (set of documents) to train your model.
upvote count: 1
answers question: http://stackoverflow.com/q/25722262

http://stackoverflow.com/comment/40212613
comment on: http://stackoverflow.com/q/25720973
score: 0
type: Comment
type: QuestionComment
has text: I would rather suggest to have Color Enum in a separate class file. This makes your Code Coverage cleaner. Further , the second implementation looks better since it contains the attributes to the color. If you have sep. file for Enum - when writing JUNIT test case for Printers - u dont have to write JUNIT Test cases for Color.

http://stackoverflow.com/q/25742889
answer count: 2
has body: I don´t understand the following filter configuration for the maven war plugin. Could somebody explain me please, what they are doing? I have marked the code with First Example and Second Example maven-war-plugin /src/main/webapp true **/*.xml **/*.xhtml ${basedir}/src/main/webapp false **/*.xml **/*.xhtml
upvote count: 3
has answer: http://stackoverflow.com/a/50151781
has title: Filtering in Maven War Plugin
tagged with: maven-war-plugin
downvote count: 0
type: UnansweredQuestion
tagged with: maven
score: 3
tagged with: java
favorite count: 0
has answer: http://stackoverflow.com/a/25743169
type: Question

http://stackoverflow.com/q/25864069
tagged with: swing
tagged with: excel
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40472267
has title: Decimalformat in exported xls file differs from JTable
tagged with: export
tagged with: jtable
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40473799
has comment: http://stackoverflow.com/comment/40492125
has answer: http://stackoverflow.com/a/25889879
has body: I'm trying to Export Jtable Data into the Excel Sheet using HSSFWorkbook. I'm getting all the data from the JTable but the decimal format differs from the JTable. Please can anyone help me... For example: JTable -> 4,555 Exported xls -> 4,55479080958 Here the Command used for Taking content of the JTable: try { for (int i = 0; i &lt; tableModel.getRowCount(); i++) { fRow1 = workbookSheet.createRow((short) i); for (int j = 0; j &lt; tableModel.getColumnCount(); j++) { HSSFCell cell = fRow1.createCell((short) j); cell.setCellValue(tableModel.getValueAt(i, j).toString()); } } FileOutputStream fileOutputStream; fileOutputStream = new FileOutputStream("C:\\file.xls"); BufferedOutputStream bos = new BufferedOutputStream(fileOutputStream); hssfWorkbook.write(bos); bos.close(); fileOutputStream.close(); } catch (Exception e) { for (int i = 0; i &lt; tableModel.getColumnCount(); i++) { fRow1 = workbookSheet.createRow((short) i); for (int j = 0; j &lt; tableModel.getColumnCount(); j++) { HSSFCell cell = fRow1.createCell((short) j); cell.setCellValue(tableModel.getValueAt(i, j).toString()); System.out.println(tableModel.getColumnName(j)); } } } And here's the code for the JTable: public class FileModel extends AbstractTableModel implements FilenameFilter { List&lt;Object[]&gt; data = new ArrayList&lt;&gt;(); String titles[] = new String[] { "File Name", "Pages", "Media Box Height", "Media Box Width", "Trim Box Height", "Trim Box Width", "Path" }; Class&lt;?&gt; types[] = new Class[] { String.class, Integer.class, Float.class, Float.class, Float.class, Float.class, String.class }; public FileModel() { this("C:\\"); } public FileModel(String directory) { File inputFiles = new File(directory); setFileStats(inputFiles); } // Implement the methods of the TableModel interface Only getRowCount(), getColumnCount() and getValueAt() are // required. // @Override public int getRowCount() { return this.data.size(); } @Override public int getColumnCount() { return this.titles.length; } @Ov…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25889879

http://stackoverflow.com/q/25734828
has comment: http://stackoverflow.com/comment/40236254
tagged with: arrays
has comment: http://stackoverflow.com/comment/40237018
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40236221
has comment: http://stackoverflow.com/comment/40236298
has body: So far I have tried to create the method below, but when I run it, the new array leaves zeros for the empty spaces. If a find all method is created to work with this how can it be implemented with a binary search instead of a linear search package bp; import java.util.Arrays; public class SortedList implements IUnsortedList { /** * The max size of the List. */ public static final int MAX_SIZE = 10000; /** * The max value of each occurence. */ public static final int MAX_VALUE = 10; /** * Flag for the amount of items on the list. */ private int sizeOfList = 0; /** * Variable to define true or false for duplicates. */ private boolean duplicatesAllowed = true; /** * Array saves the occurences in the list. */ private final int[] listItems = new int[MAX_SIZE]; /** * Variable for the value to find or delete. */ private int searchKey; /** * Variable for counter in a loop. */ private int f; @Override public int getSizeOfList() { return sizeOfList; } @Override public boolean areDuplicatesAllowed() { return duplicatesAllowed; } @Override public void setDupliatesAllowed(boolean pDuplicatesAllowed) { duplicatesAllowed = pDuplicatesAllowed; } @Override public void clear() { sizeOfList = 0; } @Override public void insert(int pValueToInsert) { //Loop finds the position of the Item for (f = 0; f &lt; sizeOfList; f++) if (listItems[f] &gt; pValueToInsert) break; //Loop moves the items after the position up for (int n = sizeOfList; n &gt; f; n-- ) listItems[n] = listItems[n - 1]; //Insert the Value in the right position listItems[f] = pValueToInsert; //Increment List size sizeOfList++; } @Override public void delete(int pValueToDelete) { int destroyHAHAHA = find(pValueToDelete); //If it doesnt find it the item if (destroyHAHAHA==sizeOfList) System.out.println("I let you down boss, Can't find " + pValueToDelete); //If it does, kill it with fire else { for (int n = destroyHAHAHA; n &lt;sizeOfList; n++) listItems[n] = listItems[n + 1]; sizeOfList--; } } @Override public void deleteAll(i…
has comment: http://stackoverflow.com/comment/40236306
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40237127
linked to: http://stackoverflow.com/q/8777217
has comment: http://stackoverflow.com/comment/40236327
has answer: http://stackoverflow.com/a/25737367
tagged with: java
has title: how to delete all the same occurences from an array
has comment: http://stackoverflow.com/comment/40236464
has comment: http://stackoverflow.com/comment/40236161
type: Question
has comment: http://stackoverflow.com/comment/40236435
has answer: http://stackoverflow.com/a/25736699
has comment: http://stackoverflow.com/comment/40236245

http://stackoverflow.com/comment/40433840
comment on: http://stackoverflow.com/q/25840940
has text: yes, like in that link. In your `persistence.xml`, you configure a direct JDBC connection via properties, as opposed to the ` jdbc/bvcallbackbmt ` in your linked example.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/64591648
has body: Had the same issue and in addition to deleting the .iml file as in the previous answer, delete the .idea folder as well and restart the IDE or import the project by pom file. new .iml file is created with all maven dependencies
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25769094
score: 4

http://stackoverflow.com/a/25736190
has comment: http://stackoverflow.com/comment/40238782
type: Answer
has comment: http://stackoverflow.com/comment/40238804
has body: Also, you're going to get an index out of bounds when you fix those other errors: for( int y = 0; y &lt; 11; y++ ) grades[x][y] = Integer.parseInt( stuff[x][y] ); All your array indexes go to 10, which in Java means 0 through 9. y here will go to 10, so boom out of bounds. Considering the syntax errors pointed out in the comments, please in the future copy and paste the EXACT code you are using. It'll be no good if we are debugging different code than what you are actually using.
score: 0
has comment: http://stackoverflow.com/comment/40238839
answers question: http://stackoverflow.com/q/25736126

http://stackoverflow.com/q/25774172
score: -3
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/40308112
tagged with: java
type: Question
tagged with: arrays
has comment: http://stackoverflow.com/comment/40308114
has body: I am using Java version 1.7 I have a String: String customerList="'C1','C2','C3','C4','C5'"; I would like to parse each customer into individual Strings, like String C1, C2, C3, C4 and C5 How do I do this?
has title: Parsing a WHERE clause string in java
answer count: 2
downvote count: 3
has answer: http://stackoverflow.com/a/25774938
has answer: http://stackoverflow.com/a/25774241
accepted answer: http://stackoverflow.com/a/25774241
favorite count: 0
possible better answer: http://stackoverflow.com/a/25774938

http://stackoverflow.com/comment/40315792
score: 0
type: Comment
type: QuestionComment
has text: The "diamond-containing class" that you mentioned is actually called [Java Generics](http://docs.oracle.com/javase/tutorial/java/generics/), and it can be intimidating for new programmer. But I'm not sure I can solve it as I don't have experience in StrongLoop. I feel something is wrong with the code when compared to the [`UserRepository` API doc](http://apidocs.strongloop.com/loopback-sdk-android/api/com/strongloop/android/loopback/UserRepository.html), but not sure how to address all the issues.
comment on: http://stackoverflow.com/q/25777524

http://stackoverflow.com/comment/40314560
comment on: http://stackoverflow.com/q/25776903
has text: Look this :) http://www.mkyong.com/hibernate/hibernate-errorinitial-sessionfactory-creation-failed-java-lang-noclassdeffounderror-commchangev2c3p0datasources/
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40198172
score: 0
type: Comment
has text: Sir, I think you said nothing about JRE
comment on: http://stackoverflow.com/a/25714746
type: AnswerComment

http://stackoverflow.com/a/27955335
accepted answer of: http://stackoverflow.com/q/25812757
upvote count: 3
answers question: http://stackoverflow.com/q/25812757
score: 3
has body: It has been some time since this thread was opened, but I think the problem described in here was due to bugs in partial fetch implementation of IMAP server. As described in this link http://www.oracle.com/technetwork/java/faq-135477.html#fetch and in these notes https://javamail.java.net/docs/NOTES.txt . There is a workaround to solve it, add the following property: props.setProperty("mail.imap.partialfetch", "false");
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/25764851
favorite count: 0
has answer: http://stackoverflow.com/a/25765289
has title: Join enums in java
has comment: http://stackoverflow.com/comment/40291323
has comment: http://stackoverflow.com/comment/40291902
has comment: http://stackoverflow.com/comment/40290585
has comment: http://stackoverflow.com/comment/40291991
has comment: http://stackoverflow.com/comment/40291270
upvote count: 3
downvote count: 1
accepted answer: http://stackoverflow.com/a/25765289
type: Question
has body: I have these enums : public interface MyEnum { } public enum Foo implements MyEnum{ A("Foo_a"), B("Foo_b"), C("Foo_c") private String name = ""; Foo(String name) { this.name = name; } @Override public String toString() { return name; } } public enum Bar implements MyEnum { A("Bar_a"), B("Bar_b"), C("Bar_c") private String name = ""; Bar(String name) { this.name = name; } @Override public String toString() { return name; } } I would have to use a method to join my enums like this : join(Foo, A, B) or otherwise (and better) : Foo.join(A, B) that returns : "Foo_a, Foo_b" I tried this : static String join(MyEnum table, Object ... words) { String joined = words[0].toString(); for(int i = 1 ; i&lt;words.length ; i++) { for(MyEnum.class t : MyEnum.values()) { if (t == words[i]) { joined += ", " + words[i].toString(); } } } return joined; } but it seems I can't do for(MyEnum.class t : MyEnum.values()). Do you have any idea to implement this method ?
score: 2
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25766015
answer count: 2
has comment: http://stackoverflow.com/comment/40291805
possible better answer: http://stackoverflow.com/a/25766015

http://stackoverflow.com/comment/40411392
comment on: http://stackoverflow.com/q/25830800
has text: Can you narrow it down? When you googled this, what links did you turn up, and what questions do you have about those links?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/25793575
type: Question
has comment: http://stackoverflow.com/comment/40343188
has comment: http://stackoverflow.com/comment/40344358
answer count: 1
has comment: http://stackoverflow.com/comment/40343342
has title: Checking the class of a Java Reflection Type
has comment: http://stackoverflow.com/comment/40343378
score: 0
has body: I've been going through the answers I've seen on SO and thus far I can't find any solutions that work correctly for me. Essentially I'm just using reflection to get a method, and then get all its parameter types like this: Type[] parameters = method.getGenericParameterTypes(); From there I am iterating through the parameters to get their respective classes so I can pass the correct data. I've tried the following: Type currentType = parameters[index]; Class&lt;?&gt; clazz = Class.forName(currentType.getClass().getName()); if (clazz.isAssignableFrom(Number.class)) { //do stuff that is number specific //EG drill down farther into specific subclass like int, //double, etc for more exact parsing } else if (clazz.isAssignableFrom(String.class)) { //Do stuff that is specific to string } else { //Nope, no love here. } But it doesn't correctly detect when it should be a Number or String and always falls into the last else statement. There must be something really simple that I'm overlooking, but for the life of me I cannot determine what it could be. Thanks to all in advance. Update: Here is a really simple example of a method stub I'm parsing. It isn't anything complicated. public void methodWithInt(int integer){ //do something } public void methodWithString(String string){ //do something else } Update: Based on Sotirios Delimanolis answer I've made some progress. if (currentType instanceof Class) { Class&lt;?&gt; currentClazz = (Class&lt;?&gt;) currentType; if (currentClazz.isAssignableFrom(Number.class)) { // This isn't getting reached for either int or Integer } else if (currentClazz.isAssignableFrom(String.class)) { // This IS working correctly for strings } else { // Both int and Integer fall here } } else { // Are primitives supposed to be handled here? If so int isn't // being sent here, but is falling in the the else from the // condition previous to this one. }
has answer: http://stackoverflow.com/a/25793650
accepted answer: http://stackoverflow.com/a/25793650
has comment: http://stackoverflow.com/comment/40343299
has comment: http://stackoverflow.com/comment/40343205
has comment: http://stackoverflow.com/comment/40343411
type: AnsweredQuestion
tagged with: reflection
tagged with: java

http://stackoverflow.com/q/25729225
favorite count: 0
has answer: http://stackoverflow.com/a/25730057
has comment: http://stackoverflow.com/comment/40225376
has comment: http://stackoverflow.com/comment/40226442
tagged with: callable-statement
tagged with: oracle-database
upvote count: 6
has comment: http://stackoverflow.com/comment/40225178
type: AnsweredQuestion
tagged with: java
score: 6
has body: I've got, what started as a fairly complex stored procedure boils down to a very simple use case that doesn't seem to be working as i'm expecting. The stored procedure now looks like this for my test: CREATE OR REPLACE PROCEDURE proc_test( v_someString varchar2 ) as BEGIN dbms_output.put_line('test'); END; I can call this stored procedure from java using the callable statement API java.sql.CallableStatement stmt = conn.prepareCall("call proc_test(?)"); stmt.setObject(1,null); stmt.execute(); The above works as expeted. The method executes and completes successfully. Nows where it gets tricky. We've created a set of oracle object types to allow us to pass more complicated structures around similar to the following CREATE OR REPLACE type SOMETYPE_TYPE force UNDER BASE_TYPE (value varchar2(255), CONSTRUCTOR FUNCTION SOMETYPE_TYPE RETURN SELF AS RESULT) NOT FINAL; if i simply change the procedure to accept these types as parameters, like this: CREATE OR REPLACE PROCEDURE proc_test( v_someString SOMETYPE_TYPE ) as BEGIN dbms_output.put_line('test'); END; Oracle will break with PLS-00306: wrong number or types of arguments in call to 'CNV_CREATE_PERSON' What gives? If i call this procedure from another procedure with null as the value, it works fine. Only calling it from the java API does it break. I've been scouring the documentation for any solution and can't find one. Perhaps one of you wise and learned fellows could point me in the right direction. Thanks
accepted answer: http://stackoverflow.com/a/25730057
type: Question
has title: Oracle from Java. CallableStatement and Null for object parameter?
answer count: 1
downvote count: 0

http://stackoverflow.com/q/25799106
score: -1
has body: I am trying to see what the problem here is. Basically, after ctr = 10, 100, 1000, and 10000, the program is supposed to subtract sumOfCutoff from sumOfRand and also subtract sumOfRounded from sumOfRand and then print both. But for some reason, its not printing both lines, or doing the correct subtraction. The addition parts of the problem is right, but the subtraction part is where I am having trouble. Does anyone see anything wrong? int ctr; for(ctr = 0; ctr &lt;= 10000; ctr++); { Random rand = new Random(); double A1 = rand.nextDouble(); double A2 = Math.floor(A1 * 1e3) / 1e3; double A3 = (double)Math.round(A1* 1000) / 1000; double A4 = Math.floor(A1 * 1e4) / 1e4; double A5 = (double)Math.round(A1* 10000) / 10000; double A6 = Math.floor(A1 * 1e5) / 1e5; double A7 = (double)Math.round(A1* 100000) / 100000; double A8 = Math.floor(A1 * 1e6) / 1e6; double A9 = (double)Math.round(A1* 1000000) / 1000000; System.out.println("The accumlators are:"); System.out.println(A1); System.out.println(A2); System.out.println(A3); System.out.println(A4); System.out.println(A5); System.out.println(A6); System.out.println(A7); System.out.println(A8); System.out.println(A9); System.out.println(); double sumOfRand = (A1 + rand.nextDouble()); double sumOfCutoff = (A2 + A4 + A6 + A8); double sumOfRounded = (A3 + A5 + A7 + A9); System.out.println("The residuals after the 10th time are:"); if(ctr == 10) System.out.println(sumOfRand - sumOfCutoff); System.out.println(sumOfRand - sumOfRounded); System.out.println(); System.out.println("The residuals after the 100th time are:"); if(ctr == 100) System.out.println(sumOfRand - sumOfCutoff); System.out.println(sumOfRand - sumOfRounded); System.out.println(); System.out.println("The residuals after the 1000th time are:"); if(ctr == 1000) System.out.println(sumOfRand - sumOfCutoff); System.out.println(sumOfRand - sumOfRounded); System.out.println(); System.out.println("The residuals after the 10000th time are:"); if(ctr == 10000) System.out.println…
has title: Printing Error with Subtractions
tagged with: printing
tagged with: random
answer count: 1
has answer: http://stackoverflow.com/a/25799125
tagged with: subtraction
favorite count: 0
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25799125
tagged with: java
tagged with: loops
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40354496
upvote count: 0

http://stackoverflow.com/comment/40417994
comment on: http://stackoverflow.com/a/25834254
type: Comment
score: 1
has text: @soulcheck, well it makes it so broad that one could throw it "when code which isn't supposed to run is run", which is exactly what was asked for!
type: AnswerComment

http://stackoverflow.com/q/25849166
has comment: http://stackoverflow.com/comment/40494759
answer count: 1
has comment: http://stackoverflow.com/comment/40494491
favorite count: 0
has comment: http://stackoverflow.com/comment/40494704
has title: Java BounceBall Ball Move
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40445898
linked to: http://stackoverflow.com/q/25816205
tagged with: swing
has comment: http://stackoverflow.com/comment/40494828
has answer: http://stackoverflow.com/a/25893036
has body: I have a question. I'm not getting make the balls escape from the mouse pointer. All balls go to the left corner when the mouse pointer enters the screen. What am I doing wrong? Any tips?? My full code: Java BounceBall mouse event Or http://ideone.com/vTGzb7 Method with problem: public void move(Ball ball, Point mouse) { try { Point p = ball.getLocation(); Point speed = ball.getSpeed(); Dimension size = ball.getSize(); int vx = speed.x; int vy = speed.y; int x = p.x; int y = p.y; // ---------------------- if (mouse != null) { int xDistance = Math.abs(x + size.width - mouse.x); int yDistance = Math.abs(y + size.height - mouse.y); if (xDistance &lt; yDistance) { if (x + size.width &lt; mouse.x) { if (vx &gt; 0) { vx *= -1; } } else { if (vx &gt; 0) { vx *= -1; } } } else { if (y + size.height &lt; mouse.y) { if (vy &gt; 0) { vy *= -1; } } else { if (vy &gt; 0) { vy *= -1; } } } } // ---------------------- if (x + vx &lt; 0 || x + size.width + vx &gt; getParent().getWidth()) { vx *= -1; } if (y + vy &lt; 0 || y + size.height + vy &gt; getParent().getHeight()) { vy *= -1; } x += vx; y += vy; ball.setSpeed(new Point(vx, vy)); ball.setLocation(new Point(x, y)); } catch (Exception e) { e.printStackTrace(); } } For some balls it works fine. They hit in the mouse pointer and change your direction. But the majority goes to the corner of the screen. Thank You.
accepted answer: http://stackoverflow.com/a/25893036
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40445126
tagged with: java
has comment: http://stackoverflow.com/comment/40478951
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/40444778

http://stackoverflow.com/q/25755760
downvote count: 1
answer count: 1
favorite count: 0
tagged with: maven
has body: I have the dependency defined in my pom.xml org.hibernate hibernate-commons-annotations 3.3.0.ga I have the above jar in C:/User/.m2/repository/org/hibernate/hibernate-commons-annotations/3.3.0.ga I've got a session-factory and datasource configured in a hibernate.cfg.xml and while trying to build the configuration in my main method: Configuration configuration = new Configuration().configure(); StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()); SessionFactory sessionFactory = configuration.buildSessionFactory(builder.build()); Session session = sessionFactory.openSession(); I get: Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider I've tried adding the hibernate-commons-annotion jar straight in my Build Path as well as my WEB-INF/lib, but no luck yet This is setup the same way and running properly on another application I've built, which didn't need the annotations jar imported. Any ideas?
score: 11
upvote count: 12
has title: NoClassDefFoundError: org/hibernate/annotations/common/reflection/MetadataProvider
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40275653
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/25756178
type: Question
has comment: http://stackoverflow.com/comment/40275426
has answer: http://stackoverflow.com/a/25756178
has comment: http://stackoverflow.com/comment/40275580

http://stackoverflow.com/q/25740161
score: 4
has title: History, Diff and reverts of persisted objects
possible better answer: http://stackoverflow.com/a/25742725
answer count: 3
has comment: http://stackoverflow.com/comment/40363183
has answer: http://stackoverflow.com/a/25843034
tagged with: jpa
downvote count: 0
favorite count: 0
tagged with: spring
upvote count: 4
has answer: http://stackoverflow.com/a/25742725
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
tagged with: spring-data
has answer: http://stackoverflow.com/a/25899542
type: Question
accepted answer: http://stackoverflow.com/a/25899542
has body: In a Spring MVC / Spring Data project I need to implement a mechanism to track history, present differences and revert the changes to an entity object. Let's say I have an entity with relationships with others like this: @Entity public Class ModelA{ @OneToOne(cascade = CascadeType.ALL) private ModelB modelB; @OneToOne(cascade = CascadeType.ALL) private ModelC modelC; } I want to have the list of changes, the ability to compare and revert them. I know that using Ruby there are libs that provide this kind of functionality, but I'm not aware if such thing exist in Java. Spring has a historiography API and Hibernate Envers had been incorporated in Core functionality, although I still can't find a simple example or some guidance how to implement it. If it's relevant the used database is PostgreSQL and Oracle 11g, but I want to keep it database independent.

http://stackoverflow.com/comment/40374038
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25810466
has text: The method has to be called. is thr anyway i can do this?

http://stackoverflow.com/comment/67829436
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/38685359
score: 0
has text: I got it working just by copy/pasting the full command line from your post, and editing the paths to match the ones on my system.

http://stackoverflow.com/a/42457442
answers question: http://stackoverflow.com/q/25720396
downvote count: 0
type: Answer
has body: If you are using yml format to declare Spring Boot properties, you can use: spring: jpa: properties: hibernate.format_sql: true
score: 24
upvote count: 24

http://stackoverflow.com/comment/40406587
score: 1
type: Comment
type: QuestionComment
has text: just use the native Date type for the database you are using... usually it's in the format: 13-Sept-2014... when you query it back out, you can always change the format to whatever is useful for your app.
comment on: http://stackoverflow.com/q/25828115

http://stackoverflow.com/comment/40415122
comment on: http://stackoverflow.com/q/25832838
score: 0
has text: @mangusta I dont get an exception, I just dont know how to read the file.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40376268
has text: for me, it makes a big difference! Now I deploy without error. For fun I have retried to insert a line break after provider's tag and I reproduce the error!
type: Comment
comment on: http://stackoverflow.com/a/25793254
score: 0
type: AnswerComment

http://stackoverflow.com/a/25821183
accepted answer of: http://stackoverflow.com/q/25819980
score: 0
answers question: http://stackoverflow.com/q/25819980
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40851851
type: Answer
has comment: http://stackoverflow.com/comment/40400827
has body: After reviewing the classes you based things on and your second split I am going to assume that split means to take the node in question out of the current tree and return a new tree with node in question as its root. If that is what you are after then a few things need fixing. First of all your split function does: TreeNode&lt;T&gt; tP = parent; while (tP.isRoot() == false) { tP = tP.parent; } Problem is that if your current node (this) doesn't have a parent you will get a Null exception thrown (so try splitting the root node and you should get an error). I think you meant: TreeNode&lt;T&gt; tP = this; This change will avoid the loop accessing a parent that may be null. Next, you need to delete all the elementsIndex at each level from the parent and above. You then have to remove the children from your direct parent (if you have a parent). I think the code you might be looking for is below (assuming I haven't missed something): public TreeNode&lt;T&gt; split() { // Create a new root node for the tree we split off TreeNode&lt;T&gt; tn = new TreeNode&lt;T&gt;(data); tn.children = children; tn.elementsIndex = elementsIndex; // For each level of the tree above us make sure we remove // ourselves from the elementsIndex at EACH LEVEL until we // finish at the root. TreeNode&lt;T&gt; tP = this; while (tP.isRoot() == false) { tP = tP.parent; tP.elementsIndex.remove(this); } // If this node has a parent remove this node as one of // our parent's children. We aren't the child of any of the // levels above our parent if (parent != null) this.parent.children.remove(this); // Return the root of the newly split tree return tn; }

http://stackoverflow.com/q/25758591
score: 0
has comment: http://stackoverflow.com/comment/40279699
has comment: http://stackoverflow.com/comment/40279815
has comment: http://stackoverflow.com/comment/40280284
has comment: http://stackoverflow.com/comment/40282284
tagged with: java
type: Question
tagged with: mac-address
answer count: 1
has answer: http://stackoverflow.com/a/25758734
has comment: http://stackoverflow.com/comment/40280489
has comment: http://stackoverflow.com/comment/40279725
has body: I need to find client MAC address who is accessing my website. I have tried with java code. try { Enumeration&lt;NetworkInterface&gt; networkInterfaces = NetworkInterface.getNetworkInterfaces(); while(networkInterfaces.hasMoreElements()) { NetworkInterface network = networkInterfaces.nextElement(); System.out.println("network : " + network); byte[] mac = network.getHardwareAddress(); if(mac == null) { System.out.println("null mac"); } else { System.out.print("MAC address : "); StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; mac.length; i++) { sb.append(String.format("%02X%s", mac[i], (i &lt; mac.length - 1) ? "-" : "")); } val = sb.toString(); System.out.println(sb.toString()); break; } } } catch (SocketException e){ e.printStackTrace(); } But it display as "network : name:eth0 (eth0) MAC address : EC-A8-6B-77-A9-AD" for all client system. how can i do this?
has title: how to find client system mac address in web application
has comment: http://stackoverflow.com/comment/40279742
linked to: http://stackoverflow.com/q/8046725
has comment: http://stackoverflow.com/comment/40280042
has comment: http://stackoverflow.com/comment/40280352
has comment: http://stackoverflow.com/comment/40280345
type: UnansweredQuestion

http://stackoverflow.com/a/25723965
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25723830
has comment: http://stackoverflow.com/comment/40215427
has comment: http://stackoverflow.com/comment/40215291
has comment: http://stackoverflow.com/comment/40215731
has comment: http://stackoverflow.com/comment/40215200
upvote count: 2
has body: Try with this public static void main(String[] args) { Map&lt;Date, Integer&gt; m = new HashMap&lt;Date, Integer&gt;(); DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); try { m.put(dateFormat.parse("31-05-2011").getTime(), 67); m.put(dateFormat.parse("01-06-2011").getTime(), 89); m.put(dateFormat.parse("10-06-2011").getTime(), 56); m.put(dateFormat.parse("25-05-2011").getTime(), 34); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } Map&lt;Date, Integer&gt; m1 = new TreeMap(m, new Comparator&lt;Date&gt;() { @Override public int compareTo(Date a, Date b) { return -a.compare(b); } }); DateFormat df = new SimpleDateFormat("dd/MM/yyyy"); for (Map.Entry&lt;Date, Integer&gt; entry : m1.entrySet()) { System.out.println(df.format(entry.getKey())); } }
type: Answer
has comment: http://stackoverflow.com/comment/40215304
has comment: http://stackoverflow.com/comment/40215385

http://stackoverflow.com/q/25801401
type: Question
score: 5
has answer: http://stackoverflow.com/a/25801456
upvote count: 5
downvote count: 0
has body: I have to design a tool which having text area where user can enter the their query and by giving submitting results will be shown. My requirement is such a way that it should accept only select queries but not update, insert, delete. If it is select results should be shown, otherwise error should be thrown. I have tried as below to make DB connection read only. Connection.setReadOnly(true) which is not recommendable and its throwing an error. 'setReadOnly' is not supported on WebSphere java.sql.Connection implementation. Can some one please help me in getting Read only connection for Database or if any design changes are needed
answer count: 3
tagged with: oracle-database
tagged with: sql
has title: How to create Read only Connection in Java for Oracle Database
has answer: http://stackoverflow.com/a/25801555
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13310808
tagged with: java
has answer: http://stackoverflow.com/a/25801592
has comment: http://stackoverflow.com/comment/40358071

http://stackoverflow.com/a/25843472
has body: generate random number Random rand = new Random(); int x = rand.nextInt(100000); before storing to database you have to check that number is already stored or not. after checking that you can insert. why do you insert random number as a unique id?.you can auto increment your primary key.then you can easily insert unique number for you primary key.and no need to create random number.
type: Answer
answers question: http://stackoverflow.com/q/25843199
score: 0

http://stackoverflow.com/comment/40256651
comment on: http://stackoverflow.com/a/25744961
type: AnswerComment
has text: There _IS_ "meaning" in adding elements to a Set, the trouble is that there's no predicting "where" the insert is going to happen wrt the current "position" of the iterator in the set. (+1 nonetheless for being first)
type: Comment
score: 3

http://stackoverflow.com/comment/40419578
comment on: http://stackoverflow.com/q/25835325
type: Comment
type: QuestionComment
has text: @Dici would you please explain i am not getting you
score: 0

http://stackoverflow.com/q/25860866
score: 4
favorite count: 0
tagged with: arraylist
answer count: 3
possible better answer: http://stackoverflow.com/a/25860903
has comment: http://stackoverflow.com/comment/40466396
type: Question
type: AnsweredQuestion
has title: Sorting ArrayList of Objects Java
has answer: http://stackoverflow.com/a/25861549
tagged with: java
has answer: http://stackoverflow.com/a/25860903
has comment: http://stackoverflow.com/comment/40467594
has answer: http://stackoverflow.com/a/25874898
accepted answer: http://stackoverflow.com/a/25874898
upvote count: 4
downvote count: 0
has body: I have an ArrayList of Objects that I'd like to sort by their value. Basically I have 9 different mathematical functions (i.e., f1(n) = log n, f2(n) = n, f3(n) = n log n, etc). I plugged the value of 1 into all 9 functions and I placed their results in an ArrayList of Objects with their label attached to them as shown in the code below. I'd like to sort the entire list of results. ArrayList&lt;Object&gt;val1 = new ArrayList&lt;Object&gt;(); val1.add("f\u2081(1) = " + log(funcValues[0])); val1.add("f\u2082(1) = " + funcValues[0]); val1.add("f\u2083(1) = " + exponent(funcValues[0])); val1.add("f\u2084(1) = " + f4(funcValues[0])); val1.add("f\u2085(1) = " + squared(funcValues[0])); val1.add("f\u2086(1) = " + cubed(funcValues[0])); val1.add("f\u2087(1) = " + twoN(funcValues[0])); val1.add("f\u2088(1) = " + factorial(funcValues[0])); val1.add("f\u2089(1) = " + f9(funcValues[0])); Basically, wherever you see log, funcValues, exponent, f4, squared, etc those are all functions that compute the answers to the mathematical functions. The output of this ArrayList is: f₁(1) = 0.0 f₂(1) = 1 f₃(1) = 1.0 f₄(1) = 0.0 f₅(1) = 1 f₆(1) = 1.0 f₇(1) = 2.0 f₈(1) = 1 f₉(1) = 0.0 I'd like to sort only the numbers. I was trying to do it this way: class ValuesSorted implements Comparator&lt;Object&gt; { @Override public int compare(Object v1, Object v2) { if () return 0; } } I am stuck on the if statement because I can't do something like if (v1.getValue > v2.getValue) because I am using 9 different function calls to pull each of those values.
tagged with: sorting

http://stackoverflow.com/comment/40438192
has text: @AmanArora Do not just give the answer like that. It defeats the entire point of the Q&A. At least provide an explanation.
score: 3
comment on: http://stackoverflow.com/q/25845443
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40336871
type: AnswerComment
score: 0
type: Comment
has text: You might also look at a shutdown hook, suggested [here](http://stackoverflow.com/a/13720481/230513).
comment on: http://stackoverflow.com/a/25774214

http://stackoverflow.com/comment/40261120
type: Comment
has text: Alright thank you! I'm still very new to programming in general and this is very handy to know. I restructured my code and it's working wonders for me :)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25747656

http://stackoverflow.com/a/25800475
has comment: http://stackoverflow.com/comment/40356547
upvote count: 2
has body: Thats because double totalItem2 still holds a double even if you cast the result that you're assigning it to an int You have to: int totalItemTemp2 = (int) totalItem2
score: 2
has comment: http://stackoverflow.com/comment/40356409
answers question: http://stackoverflow.com/q/25800457
downvote count: 0
has comment: http://stackoverflow.com/comment/40356393
has comment: http://stackoverflow.com/comment/40356416
type: Answer

http://stackoverflow.com/a/25864848
has body: If you download http://github.com/square/picasso and use this code it should work for you and all the image downloading work is done by picasso String url = "http://m.c.lnkd.licdn.com/mpr/pub/image-Zo8GfnPFe2SPJa2kv-bwRRP7GivkI_DrZ_bw2xHFJLOvI4T0No8wCrLzo95B7jMdzre/suneet-choudhary.jpg"; FeedUser FeedUser_data[] = new FeedUser[] { new FeedUser(url, "Usename1", "What the hell man."), new FeedUser(url, "Username2", "Why not sunny leone."), }; FeedUserAdapter adapter = new FeedUserAdapter(this, R.layout.listview_item_row, FeedUser_data); lv = (ListView)findViewById(R.id.list); lv.setAdapter(adapter); } public class FeedUser { public String iconUrl; public String title; public String review; } public FeedUser(String url, String title, String review) { this.iconUrl = url; this.title = title; this.review = review; } } public class FeedUserAdapter extends ArrayAdapter{ Context context; int layoutResourceId; FeedUser data[] = null; public FeedUserAdapter(Context context, int layoutResourceId, FeedUser[] data) { super(context, layoutResourceId, data); this.layoutResourceId = layoutResourceId; this.context = context; this.data = data; } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; FeedUserHolder holder = null; if(row == null) { LayoutInflater inflater = ((Activity)context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new FeedUserHolder(); holder.imgIcon = (ImageView)row.findViewById(R.id.imgIcon); holder.txtTitle = (TextView)row.findViewById(R.id.UserName); holder.txtReview = (TextView)row.findViewById(R.id.ReviewText); row.setTag(holder); } else { holder = (FeedUserHolder)row.getTag(); } FeedUser FeedUser = data[position]; holder.txtTitle.setText(FeedUser.title); Picasso.with(context).load(FeedUser.iconUrl).fit().noFade().into(holder.imgIcon); holder.txtReview.setText(FeedUser.review); return row; } static class FeedUserHolder { ImageView imgIcon; TextView txtTitle; TextVie…
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25864320
upvote count: 1

http://stackoverflow.com/q/25719208
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/40206988
tagged with: spring-security
has title: Redirect url in Spring security
score: 0
has answer: http://stackoverflow.com/a/25719444
has comment: http://stackoverflow.com/comment/40206891
tagged with: spring
has body: Good morning, I´ve been looking my Spring security configuration, I´m wondering how I could redirect to a specific url all paths that are pointing to for example /foo/*. I need to do something similar as we do when there´s no session, and we redirect to the login page. In my case I need that whatever url that is pointing to /foo/* would be redirect to a in_development_page.html. I would like to use the intercept pattern if would be possible, something like this. &lt;intercept-url pattern="/foo/*" redirect="in_development_page.html"/&gt; Do you know if something like this it´s possible?. Regards.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25719444
tagged with: java

http://stackoverflow.com/comment/53018823
type: QuestionComment
type: Comment
score: 1
has text: Were you able to solve the issue?
comment on: http://stackoverflow.com/q/25768576

http://stackoverflow.com/comment/40264572
comment on: http://stackoverflow.com/a/25749556
score: 0
type: AnswerComment
type: Comment
has text: good it means that you call update before fragment `oncreatview` is called. or you did not change adapter data . post your activity completely.

bulkinsert
type: Tag
tag name: bulkinsert
tags question: http://stackoverflow.com/q/25779874

http://stackoverflow.com/a/25735524
score: 1
has comment: http://stackoverflow.com/comment/40238096
answers question: http://stackoverflow.com/q/25735035
downvote count: 0
has body: Finally, I managed to make it work. The problem was that there was not enough space for the ad to be shown. The height of my CardListView fragment was 500dp. It was too much. I reduced it to 300dp and I can now see my Adview proprely.
has comment: http://stackoverflow.com/comment/40237833
type: Answer
has comment: http://stackoverflow.com/comment/40237631
upvote count: 1

http://stackoverflow.com/a/25841864
downvote count: 0
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25781226
has comment: http://stackoverflow.com/comment/40443797
score: 2
has body: This is what I use as a rule of thumb - mean that it can be adapted for special use cases ... inside one single transaction (and I have one single write transaction per request) : pessimistic locking because all such transactions are short (they really have to be) and so the delay for obtaining the lock is acceptable and better than having to rollback and retry in case of exception (*) between two different request processing (the GET to show a form and the POST/PUT that submits it) : optimistic locking, because I do not want to keep true database locks for a long period of time It is quite simple, coherent, and I only rethink about that if things really go wrong. The only use case for optimistic locking inside one single transaction is if you have a really high number of concurrent requests, and each user updates it own data so the risk of contention if small - but you only gain the time of the lock phase, because the probability of waiting for the lock is equally low. (*) if you get an optimistic lock exception, you have to rollback the transaction, and either you can allow to simply report an error, or you have to retry it a number of times. EDIT: If I have correctly understood, your problem is that you have one long running batch operation and short web service requests. IMHO there are three ways to solve that, but there is currently not enough information to choose which is the best for your use case use many short transactions in your batch. That way you can use either optimistic locks (with retry) if the probability of simultaneous updates is low or pessimistic locks if you do not have too much simultaneous web service requests. It is the simplest way, but may not be usable if your business rules require that the batch uses one single transaction. use pessimistic locks in batch and web service requests, but with a short timeout for web service part. That way if you acquire the lock in a web service, you are sure no batch is modifying same value and can safely…
has comment: http://stackoverflow.com/comment/40474348
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40437226
answers question: http://stackoverflow.com/q/25781226

http://stackoverflow.com/q/25727296
upvote count: 2
tagged with: java
possible better answer: http://stackoverflow.com/a/25727458
has answer: http://stackoverflow.com/a/25727458
type: Question
has answer: http://stackoverflow.com/a/25727462
has answer: http://stackoverflow.com/a/25728585
has body: As a more descriptive interface, I would like to create the following: @FunctionalInterface public interface Dial extends Function&lt;Double,Double&gt; {} However, when I try composing Dial instances like this: public class DialExample { public Dial dialMult (double mult) { return (i -&gt; i * mult); } public void myTest () { // Yes Function&lt;Double,Double&gt; f1 = dialMult(3.0).andThen(dialMult(4.0)); // No Dial d1 = dialMult(3.0).andThen(dialMult(4.0)); } } The code under the // No comment gives me the following compilation error: Error:(22, 40) java: incompatible types: no instance(s) of type variable(s) V exist so that java.util.function.Function conforms to lambdas.Dial Certainly the code under the // Yes comment works, but it defeats the purpose of having a descriptive Dial interface in the first place. I have a few questions: What is it in the design/implementation of Java generics and lambdas that leads to this issue? Is there a workaround? Is it even a good practice to subclass Function&lt;Double,Double&gt; as a descriptive interface like mine or should I be avoiding this in the first place?
has comment: http://stackoverflow.com/comment/40221668
answer count: 3
downvote count: 0
has title: Java 8 / Lambdas / Streams : Subclassing Function<T,R> leads to issues with andThen() method
favorite count: 0
accepted answer: http://stackoverflow.com/a/25728585
has comment: http://stackoverflow.com/comment/40222035
tagged with: java-8
type: AnsweredQuestion
score: 2
tagged with: java-stream

http://stackoverflow.com/comment/40511027
type: QuestionComment
type: Comment
has text: @Luksprog .. You're right, but for instance, I would like to select from 20th to 25th. setEnabled(false) for the previous elements would do half the trick, but I could still go for other random elements, such as 28th, 31st
comment on: http://stackoverflow.com/q/25872395
score: 0

http://stackoverflow.com/q/25864320
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25864848
linked to: http://stackoverflow.com/q/541966
has title: Android Set ListView Image From URL
has comment: http://stackoverflow.com/comment/40472732
tagged with: android
has answer: http://stackoverflow.com/a/25864511
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25864623
type: Question
has comment: http://stackoverflow.com/comment/40473130
has comment: http://stackoverflow.com/comment/40473080
tagged with: java
tagged with: listview
linked to: http://stackoverflow.com/q/6407324
has body: I have a Newsfeed(ListView) containing images. I want to load images from web and use in my activity. So I have this in my OnCreate() of MainActivity: String url = "http://m.c.lnkd.licdn.com/mpr/pub/image-Zo8GfnPFe2SPJa2kv-bwRRP7GivkI_DrZ_bw2xHFJLOvI4T0No8wCrLzo95B7jMdzre/suneet-choudhary.jpg"; Drawable x = LoadImageFromWebOperations(url); FeedUser FeedUser_data[] = new FeedUser[] { new FeedUser(x, "Usename1", "What the hell man."), new FeedUser(x, "Username2", "Why not sunny leone."), }; FeedUserAdapter adapter = new FeedUserAdapter(this, R.layout.listview_item_row, FeedUser_data); lv = (ListView)findViewById(R.id.list); lv.setAdapter(adapter); public static Drawable LoadImageFromWebOperations(String url) { try { InputStream is = (InputStream) new URL(url).getContent(); Drawable d = Drawable.createFromStream(is, "src name"); return d; } catch (Exception e) { return null; } } Here's my FeedUser.java public class FeedUser { public Drawable icon; public String title; public String review; public FeedUser(){ super(); } public FeedUser(Drawable x, String title, String review) { super(); this.icon = x; this.title = title; this.review = review; } } And below is the FeedUser Adapter: public class FeedUserAdapter extends ArrayAdapter&lt;FeedUser&gt;{ Context context; int layoutResourceId; FeedUser data[] = null; public FeedUserAdapter(Context context, int layoutResourceId, FeedUser[] data) { super(context, layoutResourceId, data); this.layoutResourceId = layoutResourceId; this.context = context; this.data = data; } @Override public View getView(int position, View convertView, ViewGroup parent) { View row = convertView; FeedUserHolder holder = null; if(row == null) { LayoutInflater inflater = ((Activity)context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new FeedUserHolder(); holder.imgIcon = (ImageView)row.findViewById(R.id.imgIcon); holder.txtTitle = (TextView)row.findViewById(R.id.UserName); holder.txtReview = (TextView)row.find…

http://stackoverflow.com/a/25803579
type: Answer
answers question: http://stackoverflow.com/q/25803212
score: 0
has body: Use This: &lt;ImageView android:id="@+id/img_overlay" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:alpha="0.5" android:scaleType="matrix" android:src="@drawable/body_xray" android:visibility="invisible" android:layout_toStartOf="@id/temp_image" /&gt; when you set your image-view's width or height to wrap_content it will stretch as your image.

http://stackoverflow.com/q/25861618
tagged with: java
has title: Difference in output between similar while loop and do while loop?
tagged with: loops
type: Question
tagged with: do-while
has answer: http://stackoverflow.com/a/25861684
possible better answer: http://stackoverflow.com/a/25861671
has answer: http://stackoverflow.com/a/25861671
has comment: http://stackoverflow.com/comment/40467886
has body: For my Java class, I was asked to create a while loop and then convert it to a do-while loop and then compare the output. This is the question: Replace the while loop in question 4 with a do while loop. What is the possible difference between the output from question 4 and this question? I can't find a difference in the output, possible or not. Here is the code and output for both below. while loop package fordemo; import java.util.Scanner; public class ForDemo { public static void main(String[] args) { System.out.println("Input a number:"); Scanner user_input = new Scanner (System.in); int number = user_input.nextInt(); int n = -1; while (n &lt; number){ n=n+2; System.out.print(n + " "); } } } run: Input a number: 15 1 3 5 7 9 11 13 15 BUILD SUCCESSFUL (total time: 1 second) do-while loop package fordemo; import java.util.Scanner; public class ForDemo { public static void main(String[] args) { Scanner user_input = new Scanner (System.in); System.out.println("Input a number:"); int number = user_input.nextInt(); int n = -1; do { n+=2; System.out.print(n + " "); } while (n &lt; number); } } run: Input a number: 11 1 3 5 7 9 11 BUILD SUCCESSFUL (total time: 1 second)
has comment: http://stackoverflow.com/comment/40468075
score: 0
tagged with: while-loop
has answer: http://stackoverflow.com/a/25861738
has comment: http://stackoverflow.com/comment/40467728
tagged with: compare
answer count: 5
has answer: http://stackoverflow.com/a/25861663
accepted answer: http://stackoverflow.com/a/25861663
has answer: http://stackoverflow.com/a/25861741
has comment: http://stackoverflow.com/comment/40467841
has comment: http://stackoverflow.com/comment/40467904
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40467744

http://stackoverflow.com/a/25855601
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25855536
type: Answer
has body: The empty HashSet isn't a null. Add a test by using the HashSet.size() if (test.get("1") == null || test.get("1").size() == 0) { or use HashSet.isEmpty(), if (test.get("1") == null || test.get("1").isEmpty()) { Alternatively, you could comment out // test.put("1", new HashSet&lt;String&gt;()); System.out.println(test); Then test.get("1") is null.

android-edittext
tags question: http://stackoverflow.com/q/25857184
tags question: http://stackoverflow.com/q/25804550
tags question: http://stackoverflow.com/q/25817947
type: Tag
tags question: http://stackoverflow.com/q/25763788
tag name: android-edittext

http://stackoverflow.com/comment/40302077
type: AnswerComment
comment on: http://stackoverflow.com/a/25770155
type: Comment
has text: Follow your input.nextInt() with an input.nextLine().
score: 0

http://stackoverflow.com/comment/40352007
comment on: http://stackoverflow.com/q/25798107
type: QuestionComment
has text: Also please format your code with proper indenting and finish providing the rest of your code, especially the `initUiElements()` method if it is pertinent to your question.
score: 0
type: Comment

http://stackoverflow.com/comment/40410255
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25830103
has text: Are you sure your actual code has that `uniform` call in it, rather than just printing `M`?
score: 0

http://stackoverflow.com/a/25853824
upvote count: 1
answers question: http://stackoverflow.com/q/25852629
score: 1
has body: You can do it in this way also public class ConnectionProvider { public static Connection getConnection() throws SQLException { Connection connection = null; connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/cloudbase" ,user,passwd); return connection; } public void authenticate(Connection connection,String usrname,String pwd) throws SQLException { String query = "select firstName from users where email=? and password = ?"; try { PreparedStatement stm = connection.prepareStatement(query); stm.setString(1, usrname); stm.setString(2, pwd); ResultSet result = stm.executeQuery(); if (resultSet.next()) { do { System.out.println("Welcome, "+resultSet.getString("firstName")); } while(resultSet.next()); } else{ System.out.println("Username or id doesnot exist"); } } catch (SQLException e) { System.out.println("Error :" + e.getMessage()); } finally{ connection.close(); } } Then in your Servlet protected void doPost(...) throws ServletException, IOException { String email = request.getParameter("email"); String passwd = request.getParameter("pwd"); Connection connection = ConnectionProvider.getConnection(); new ConnectionProvider().authenticate(connection,email ,passwd); }
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25852629

http://stackoverflow.com/comment/40267851
comment on: http://stackoverflow.com/q/25751993
type: Comment
type: QuestionComment
has text: Don't open or close session in DAO .. make it in another layer.. for example in service layer.. and when your business logic ends in the service close session
score: 1

http://stackoverflow.com/comment/40438231
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25845443
has text: @Jivings Here is what I tried earlier: teller = 0; int j = 0; while (j < 0){ j++; teller = teller +1; }

nosql
tags question: http://stackoverflow.com/q/25783242
tag name: nosql
tags question: http://stackoverflow.com/q/25728532
tags question: http://stackoverflow.com/q/25723369
tags question: http://stackoverflow.com/q/25777805
type: Tag
tags question: http://stackoverflow.com/q/25817458

http://stackoverflow.com/q/25794602
score: 3
tagged with: java
tagged with: bibtex
has answer: http://stackoverflow.com/a/32190794
has comment: http://stackoverflow.com/comment/40346494
accepted answer: http://stackoverflow.com/a/32190794
answer count: 1
downvote count: 0
has title: How to read the contents of (.bib) file format using Java
favorite count: 0
has body: I need to read .bib file and insert it tags into an objects of bib-entries the file is big (almost 4000 lines) , so my first question is what to use (bufferrReader or FileReader) the general format is @ARTICLE{orleans01DJ, author = {Doug Orleans and Karl Lieberherr}, title = {{{DJ}: {Dynamic} Adaptive Programming in {Java}}}, journal = {Metalevel Architectures and Separation of Crosscutting Concerns 3rd Int'l Conf. (Reflection 2001), {LNCS} 2192}, year = {2001}, pages = {73--80}, month = sep, editor = {A. Yonezawa and S. Matsuoka}, owner = {Administrator}, publisher = {Springer-Verlag}, timestamp = {2009.03.09} } @ARTICLE{Ossher:1995:SOCR, author = {Harold Ossher and Matthew Kaplan and William Harrison and Alexander Katz}, title = {{Subject-Oriented Composition Rules}}, journal = {ACM SIG{\-}PLAN Notices}, year = {1995}, volume = {30}, pages = {235--250}, number = {10}, month = oct, acknowledgement = {Nelson H. F. Beebe, University of Utah, Department of Mathematics, 110 LCB, 155 S 1400 E RM 233, Salt Lake City, UT 84112-0090, USA, Tel: +1 801 581 5254, FAX: +1 801 581 4148, e-mail: \path|beebe@math.utah.edu|, \path|beebe@acm.org|, \path|beebe@computer.org| (Internet), URL: \path|http://www.math.utah.edu/~beebe/|}, bibdate = {Fri Apr 30 12:33:10 MDT 1999}, coden = {SINODQ}, issn = {0362-1340}, keywords = {ACM; object-oriented programming systems; OOPSLA; programming languages; SIGPLAN}, owner = {Administrator}, timestamp = {2009.02.26} } As you can see , there are some entries that have more than line, entries that end with } entries that end with }, or }}, Also , some entries have {..},{..}.. in the middle so , i am a little bit confused on how to start reading this file and how to get these entries and manipulate them. Any help will be highly appreciated.
has comment: http://stackoverflow.com/comment/40345261
has comment: http://stackoverflow.com/comment/40345335
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/40346447
linked to: http://stackoverflow.com/q/7583982
type: Question

http://stackoverflow.com/a/26259604
score: 0
has body: Try building it without proguard first and test. If that works then its proguard configuration file issue.
type: Answer
answers question: http://stackoverflow.com/q/25800465

http://stackoverflow.com/a/27183264
has body: I had same issue and I solved it by adding elasticsearch-hadoop jars to hadoop's class path. Try something like this: export HADOOP_CLASSPATH=/home/tariq/java/library/elasticsearch-hadoop-mr-2.0.2.jar:/home/tariq/java/library/elasticsearch-hadoop-2.0.2.jar
type: Answer
accepted answer of: http://stackoverflow.com/q/25722958
answers question: http://stackoverflow.com/q/25722958
has comment: http://stackoverflow.com/comment/43548087
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40452811
has text: sure e.x. "need for speed hot pursuit" with max character range specified as say 16 ... I need the string to be split based on word boundary so the output should be "need for speed " and "hot pursuit" but currently with the implementation that i have i get "need for speed h" and "ot pursuit "
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25853393
type: QuestionComment

http://stackoverflow.com/comment/40269721
comment on: http://stackoverflow.com/q/25752930
score: 0
type: QuestionComment
type: Comment
has text: You might look at a few [examples](http://stackoverflow.com/search?tab=votes&q=%5bjava%5d%20AffineTransform), for [example](http://stackoverflow.com/a/3420651/230513).

http://stackoverflow.com/comment/40304949
type: Comment
type: AnswerComment
has text: if i remove do while loop then option pane will appear the number of times i entered a wrong digits,,, not helping :(
comment on: http://stackoverflow.com/a/25772400
score: 0

http://stackoverflow.com/comment/40333100
type: Comment
comment on: http://stackoverflow.com/a/25783360
score: 0
type: AnswerComment
has text: What I call not connected is a protocol like HTTP. where each request use a new TCP connection and has no persistent session.

http://stackoverflow.com/q/25812216
tagged with: java
tagged with: hibernate
tagged with: hibernate-criteria
tagged with: criteria-api
upvote count: 1
tagged with: hql
type: Question
has comment: http://stackoverflow.com/comment/40377218
has title: How can I retrieve an entity that has a member collection that has a specific value?
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40377082
has body: So, I have this schema @Entity class A { @OneToMany(mappedBy="a", cascade=CascadeType.ALL) @MapKey("mapKey") Map&lt;Integer, B&gt; bMap; } @Entity class B { @ManyToOne A a; int mapKey; @ElementCollection @CollectionTable(name = "B_Cs", joinColumns = @JoinColumn(name = "B_id", nullable = false)) @Column(name = "c", nullable = false) Set&lt;String&gt; cSet; } and I want to retrieve all the As that have a Map that has a B that has a given String in the cSet. I tried to look in the Hibernate documentation but got lost in all the things explained there, so I tried to find an example somewhere else on the net, but I had no luck. What's a good way to retrieve my As?
answer count: 0

http://stackoverflow.com/comment/40362418
type: Comment
comment on: http://stackoverflow.com/q/25803372
score: 0
type: QuestionComment
has text: can you post the log of your server?

http://stackoverflow.com/a/25818120
has body: Break the big task into smaller tasks , like @user2864740 said , write the algorithm (not code) on a paper then start translating that to code u reached the part where u created a scanner to read input , now read the input and ....figure out the rest . To learn how to read user input read this. To learn how to make an integer out of Strings ur scanning read this the rest is basic math really , read your textbook , and good luck ;) edit : at least come out with some algorithm then maybe we'll help with the code
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25818028
has comment: http://stackoverflow.com/comment/40388739

http://stackoverflow.com/q/25835607
score: -5
accepted answer: http://stackoverflow.com/a/25835755
tagged with: java
downvote count: 5
answer count: 2
upvote count: 0
has title: I want to print an Array ...Was Just checking for sorting but not able to print too?
has comment: http://stackoverflow.com/comment/40420251
favorite count: 0
has answer: http://stackoverflow.com/a/25835755
has body: import java.util.*; class Sort { public static void main(String..s) { int a[]=new a[5]; Scanner sc=new Scanner(System.in); System.out.println("Enter 5 Numbers"); for(int i=0;i&lt;5;i++) { a[i]=sc.nextInt(); } for(int i=0;i&lt;5;i++) { System.out.println("Before Sorting"+ a[i]); } } }
possible better answer: http://stackoverflow.com/a/25835753
has comment: http://stackoverflow.com/comment/40420264
has answer: http://stackoverflow.com/a/25835753
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40420241

equals
tags question: http://stackoverflow.com/q/25791518
tags question: http://stackoverflow.com/q/25805719
type: Tag
tags question: http://stackoverflow.com/q/25779995
tags question: http://stackoverflow.com/q/25747409
tags question: http://stackoverflow.com/q/25857066
tags question: http://stackoverflow.com/q/25767032
tag name: equals

http://stackoverflow.com/comment/40268800
comment on: http://stackoverflow.com/a/25752358
type: AnswerComment
score: 0
type: Comment
has text: nice! thanks! I find these APIs to be a little cumbersome sometime.

http://stackoverflow.com/comment/40355493
has text: @Thusitha Thillina Dayaratne: I'm not actually removing, I'm just not reading the ones that are flagged.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25799919
type: Comment

http://stackoverflow.com/comment/40250654
comment on: http://stackoverflow.com/a/25742786
score: 0
type: Comment
has text: A very offtopic question. What does this statement means, do you know? (Zone.List) getIntent().getSerializableExtra(EXTRAS_ZONES) Does two methods getIntent() and getSerializableExtra (EXTRAS_ZONES) are called at same time with this statement? Java supports such way to call two methods with just one statement?
type: AnswerComment

http://stackoverflow.com/comment/40293793
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25753445
has text: I forgot to mention that i'm using GlazedLists to populate the table and show the changes when the List updates

http://stackoverflow.com/comment/40407994
type: AnswerComment
score: 0
type: Comment
has text: there is not private constructor .. I have checked the same class in eclipse .. and there is not
comment on: http://stackoverflow.com/a/25828915

http://stackoverflow.com/comment/40217083
score: 1
has text: What [Thomas](http://stackoverflow.com/users/540873/thomas-jungblut) says (+1). Pro tip: to print your array contents, you're better off with `Arrays.toString(names)` instead of indexed iteration.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25724937

http://stackoverflow.com/q/25771892
has body: Scenario : I have 3 tables, Offer, Channel and Offer_Channels. Basically Channel is a lookup table, i.e, the values in that table can neither be inserted nor updated by the application. An offer can contain one or many channels. I use the Channel table values to populate dynamic checkboxes. Anyways, so here is what I have : @Entity @Table(name = "OFFER") @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) public class Offer implements Serializable { // Offer Id @Id @GeneratedValue(strategy = GenerationType.AUTO, generator = "offer_seq_gen") @Column(name = "OFFER_ID") private long OfferId; @ManyToMany(cascade = CascadeType.ALL) @JoinTable(name = "OFFER_CHANNELS", joinColumns = { @JoinColumn(name = "OFFER_ID") }, inverseJoinColumns = { @JoinColumn(name = "CHANNEL_ID") }) private Set&lt;Channel&gt; channels = new HashSet&lt;Channel&gt;(); //Other fields and corresponding getters and setters } Here is the Channel entity : @Entity @Table(name = "CHANNEL") public class Channel implements Serializable { private static final long serialVersionUID = 1L; @NotNull @Id @Column(name = "CHANNEL_ID", insertable=false, updatable=false) private Long channelId; @Column(name = "CHANNEL_NAME", insertable=false, updatable=false) private String channelName; //getters and setters } Now, when a user creates an offer, I need to insert row in Offer table and Offer_Channels tables and do nothing(No updates/inserts) for Channel table. Initially, all three would happen, so to achive the "do nothing to Channel table" part, I put insertable=false and updateable=false on the Channel table columns and that worked like a charm. Now I used plain Hibernates for this. I mean I wrote a standalone java application and a main class to add an offer useing hibernate's session.save(offer). It ran the following queries : Hibernate: insert into OFFER Hibernate: insert into OFFER_CHANNELS Alright, now, I have a rest service where I am using the Spring's JPA repository to save the information and I hav…
has comment: http://stackoverflow.com/comment/40491694
tagged with: spring
has answer: http://stackoverflow.com/a/72668997
has comment: http://stackoverflow.com/comment/40309326
linked to: http://stackoverflow.com/q/4912567
score: 0
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40490649
answer count: 1
has title: @Column insertable, updateble don't go well with Spring JPA?
has comment: http://stackoverflow.com/comment/40309954
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40313448
tagged with: spring-data-jpa
has comment: http://stackoverflow.com/comment/40309912
tagged with: jpa-2.0
type: Question

http://stackoverflow.com/a/25775362
accepted answer of: http://stackoverflow.com/q/25774561
has comment: http://stackoverflow.com/comment/40317227
has body: RadioGroup.OnCheckedChangeListener is an interface, and you are creating an annonymouse inner class on your: //Take a note at the key word new setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener{//overriden methods here}); That's how it gets instantiated in your code. Hope it helps. Update Reference to observer pattern Custom action listener example
score: 0
has comment: http://stackoverflow.com/comment/40312357
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25774561

http://stackoverflow.com/comment/40334671
comment on: http://stackoverflow.com/q/25789047
type: Comment
type: QuestionComment
score: 1
has text: Nothing in your code you've posted actually adds the buttons to a `Container`.

http://stackoverflow.com/comment/40459375
type: AnswerComment
type: Comment
has text: And what About those of use who don't ...
score: 2
comment on: http://stackoverflow.com/a/25841532

http://stackoverflow.com/comment/40446558
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25816108
has text: in my data-config <entity> tag i have trasformer="imageMetaDataExtractorTransformer".I'm expecting the user_id field to change from DB value to "test_transformer", but till now nothing append. Am I missing something?
type: Comment

http://stackoverflow.com/comment/40207171
type: Comment
comment on: http://stackoverflow.com/a/25719506
score: 0
has text: Just make the calls to Selenium from a JUnit class and it will get run as part of your test phase in Maven. The JMeter website has an example of writing JUnit tests
type: AnswerComment

http://stackoverflow.com/a/34685142
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25835348
answers question: http://stackoverflow.com/q/25835348
type: Answer
upvote count: 4
downvote count: 0
has body: if you need an offline solution you can use any of these features Get hardware details but always the best answer is to keep part of the application inside your own server , when installing the application you can complete it only for this particular this machine . Two Ways Way No.1 build your own Web service which completes your applications functionalities , and when the application uses this web service ,you need to make sure this is the same machine (by the IP , mac address , ) Way No.2 when installing collect the hardware information &amp; send it to your server to save it there. then when using any offline feature you need to request from the server the permission to do so , by regenerating the machine information put in your mind that someone can reverse engineering your code , so I prefer always the first way
score: 4

http://stackoverflow.com/a/25749160
has comment: http://stackoverflow.com/comment/40262506
has comment: http://stackoverflow.com/comment/40262875
has comment: http://stackoverflow.com/comment/40262473
has comment: http://stackoverflow.com/comment/40262938
has comment: http://stackoverflow.com/comment/40262639
has comment: http://stackoverflow.com/comment/40262394
has comment: http://stackoverflow.com/comment/40264034
has comment: http://stackoverflow.com/comment/40262813
has comment: http://stackoverflow.com/comment/40262359
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25748216
has body: @Retention and @Inherited serve different purposes. The javadoc of @Retention states that it Indicates how long annotations with the annotated type are to be retained. The javadoc of @Inherited states that it Indicates that an annotation type is automatically inherited. An annotation type cannot be inherited if it doesn't exist. If the annotation exists at SOURCE level, then @Inherited will also work at SOURCE level. If the annotation exists at CLASS level, then @Inherited will also work at CLASS level. If the annotation exists at RUNTIME level, then @Inherited will also work at RUNTIME level.

http://stackoverflow.com/a/25840450
accepted answer of: http://stackoverflow.com/q/25749147
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25749147
has body: I'm not sure exactly what ended up fixing this issue, but I was also getting some other errors as I tried different things, and I finally got everything working as specified in this post: java.lang.NoClassDefFoundError: org/apache/cxf/jaxrs/impl/UriBuilderImpl. I ended up removing those pom file entries above. One thing I did have to do was to download a new version of Maven as the one that came in my VM was giving me problems.

http://stackoverflow.com/comment/40376713
type: QuestionComment
comment on: http://stackoverflow.com/q/25798200
has text: I can give a more detailed answer later but for now check out the java tutorial on audio I/O (there's multiple pages) http://docs.oracle.com/javase/tutorial/sound/accessing.html
score: 0
type: Comment

http://stackoverflow.com/comment/40388654
has text: What do you think your change does? Please use a debugger and step through the code to see what you are doing wrong.
comment on: http://stackoverflow.com/q/25817953
type: Comment
score: 1
type: QuestionComment

http://stackoverflow.com/comment/40472915
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25864493
has text: `g2.drawImage(image, 0, 0, component);` does not really do anything useful - `g2` belongs to the image, so you're drawing an (empty) image on top of itself.

http://stackoverflow.com/comment/40219192
comment on: http://stackoverflow.com/q/25725675
type: QuestionComment
has text: There's a good HOWTO at http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html
score: 0
type: Comment

http://stackoverflow.com/q/25757394
has comment: http://stackoverflow.com/comment/56091839
favorite count: 0
tagged with: bash
type: Question
score: 1
has title: Hadoop query, dates, loops, BASH or Java
upvote count: 1
tagged with: hive
has answer: http://stackoverflow.com/a/26038589
tagged with: java
type: UnansweredQuestion
tagged with: hadoop
has comment: http://stackoverflow.com/comment/40617086
has body: I'm pretty new to Hadoop, Linux, and haven't coded in Java for over 15 years, so am typically only using Hue to run queries. My issue is that I'm trying to run a basic select query over 12 months worth of data, however, due to the dataset huge size and read thresholds being applied this query will always fail. Therefore I need to run this same query per week/month, insert the results into a pre-existing table, and then aggregate them to my final 12 month period. Original query: - SELECT col1, col2, col3 FROM foo WHERE local_date &gt;= '2013-09-01' AND local_date &lt; '2014-09-01' Possible new script (PLSQL format): - DECLARE dtStart DATE; DECLARE dtEnd DATE; SET dtStart = (CURRENT_DATE - 1 YEAR) + 1 DAYS - DAY(CURRENT_DATE); SET dtEnd = CURRENT_DATE + 1 DAYS - DAY(CURRENT_DATE); WHILE dtStart &lt; dtEnd THEN DO INSERT INTO test SELECT col1, col2, col3 FROM foo WHERE local_date &gt;= dtStart AND local_date &lt; dtStart + 7 DAYS; IF dtStart = dtEnd THEN SET dtStart = dtStart + 1 DAYS; ELSEIF dtEnd - dtStart &lt; 7 THEN SET dtStart = dtStart + (dtEnd - dtStart) DAYS; ELSE SET dtStart = dtStart + 7 DAYS; END IF; END WHILE; SELECT col1, col2, SUM(col3) FROM test GROUP BY col1, col2; I've been told that this is not possible in Hue. Is that correct? Can this be done within BASH or do I need to create some Java code? As you can see I'd also like the dates to be dynamic, however, I believe the date functions within Hadoop are unable to do this. Any help would be appreciated, particularly examples in BASH or Jave which would do something like and/or advice on further reading.
tagged with: hue
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40554821

polymorphism
tags question: http://stackoverflow.com/q/25847322
tags question: http://stackoverflow.com/q/25828224
tags question: http://stackoverflow.com/q/25793028
tags question: http://stackoverflow.com/q/25813866
tags question: http://stackoverflow.com/q/25805789
type: Tag
tags question: http://stackoverflow.com/q/25830601
tag name: polymorphism
tags question: http://stackoverflow.com/q/25842976
tags question: http://stackoverflow.com/q/25778347
tags question: http://stackoverflow.com/q/25865910
tags question: http://stackoverflow.com/q/25728055
tags question: http://stackoverflow.com/q/25728007
tags question: http://stackoverflow.com/q/25839675
tags question: http://stackoverflow.com/q/25734667

http://stackoverflow.com/comment/40362154
comment on: http://stackoverflow.com/a/25803743
has text: I know, that using the appropriate jre is the correct solution. But 1 thought that the "source compatibility" setting will solve this issue
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25745543
answers question: http://stackoverflow.com/q/25745445
upvote count: 3
has body: You probably want to use DatabaseMetaData.getSQLKeywords(). You would of course need to combine this with a static list of the SQL 2003 keywords (which i'm sure is readily available somewhere). To be safe, i would treat all of these words as case insensitive.
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25745445
type: Answer

http://stackoverflow.com/comment/40429001
score: 0
type: Comment
type: QuestionComment
has text: If the `JEditorPane` is maintained by HTML, then you need to insert an "img" tag into the existing code, via the `Document` interface...
comment on: http://stackoverflow.com/q/25839668

gzip
tags question: http://stackoverflow.com/q/25777561
tag name: gzip
type: Tag

http://stackoverflow.com/q/25787711
has title: How to store a very large integer in java
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/25788054
accepted answer: http://stackoverflow.com/a/25787726
has comment: http://stackoverflow.com/comment/40331990
upvote count: 2
downvote count: 1
type: AnsweredQuestion
score: 1
has body: My input is of 10^19 ; How can i store this number. int input ; // Of order 10^19; int answer = input%(10^10+3) How to perform above operations and what if i want to have an array A[input][input] // showing me an error
tagged with: java
possible better answer: http://stackoverflow.com/a/25787748
has answer: http://stackoverflow.com/a/25787726
has answer: http://stackoverflow.com/a/25787748
linked to: http://stackoverflow.com/q/849813
type: Question
has comment: http://stackoverflow.com/comment/40331911
duplicate of: http://stackoverflow.com/q/849813

http://stackoverflow.com/q/25725014
favorite count: 0
accepted answer: http://stackoverflow.com/a/25725179
score: 11
has comment: http://stackoverflow.com/comment/40218052
possible better answer: http://stackoverflow.com/a/75335414
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25725179
has answer: http://stackoverflow.com/a/75335414
downvote count: 0
tagged with: java
tagged with: swing
type: Question
tagged with: jbutton
linked to: http://stackoverflow.com/q/5751311
upvote count: 11
has comment: http://stackoverflow.com/comment/40218346
has body: I've got a simple Swing GUI with JButtons being run on a Surface tablet with a touchscreen. The buttons have ActionListeners. When these buttons are clicked from a mouse they visually depress correctly. However when they are tapped on the touchscreen they remain visually the same but still fire off an actionPerformed(). If they are double tapped then they visually depress correctly but fire off 2 actionPerformed()s. Is there a way to get this button animation change to take place when the button is pressed, rather than clicked? I've tested it and I could use a MouseListener and put all my logic in mouseClicked() but it's not very elegant to ask touchscreen users to double tap a button.
answer count: 2
tagged with: touchscreen
has title: How to make Java JButton visually depress with touch screen?

http://stackoverflow.com/q/25802970
has body: I need to encrypt my Android API Call. I need to use the SHA-256. I have tried to you this example from jokecamp.com but it does not seem to work with Android I also imported the Jar file from commons.apache.org Here is my code: package com.example.api_tester; import javax.crypto.Mac; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Hex; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.Window; import android.widget.TextView; public class MainActivity extends ActionBarActivity { public static final String TAG = MainActivity.class.getSimpleName(); APICall api; ApiSecurity hash_security; TextView url; TextView api_result; TextView url_call; private String hardCodedUrl = " MY API URL"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Hide Action Bar min target apit set to 11 getWindow().requestFeature(Window.FEATURE_ACTION_BAR); getActionBar().hide(); setContentView(R.layout.activity_main); Log.i(TAG, "onCreate"); ... test(); }//end - onCreate private void test(){ try { String secret = "acbdef"; String message = "api_key=abcd123&amp;access_token=123abc"; Mac sha256_HMAC = Mac.getInstance("HmacSHA256"); SecretKeySpec secret_key = new SecretKeySpec(secret.getBytes(), "HmacSHA256"); sha256_HMAC.init(secret_key); String hash = Hex.encodeHexString(sha256_HMAC.doFinal(message.getBytes())); Log.e(TAG, "Result=&gt; " + hash); } catch (Exception e) { Log.e(TAG, "Error=&gt; " + e); } }//end test ... And here is the Eror I am getting: 09-12 13:39:42.676: E/AndroidRuntime(13531): java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Hex.encodeHexString Thanks guys.
type: UnansweredQuestion
has title: How to use SHA-256 with Android
tagged with: sha
tagged with: http
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25803081
type: Question
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25803281
tagged with: android
tagged with: hex

http://stackoverflow.com/a/25793153
has body: The textarea has not the focus. Add textarea.requestFocus(); before you select the text: } else { textarea.requestFocus(); textarea.select(Index, Index + searchstr.length()); }
score: 0
answers question: http://stackoverflow.com/q/25790702
type: Answer

http://stackoverflow.com/comment/40440406
comment on: http://stackoverflow.com/q/25845103
type: Comment
type: QuestionComment
score: 2
has text: Look at your getColumnClass() method. It's supposed to return what the class of elements of a given column is. But it doesn't use the column at all. It should return String.class, Integer.class or Double.class depending on the column.

http://stackoverflow.com/comment/40240393
comment on: http://stackoverflow.com/q/25736801
has text: @SotiriosDelimanolis Yes, I'm putting in `/user/imray`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40220899
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25726598
has text: Please edit your question including your updates and **full exception stack trace**. Nobody can guess what is happening now. @SurajAli

http://stackoverflow.com/comment/40206185
comment on: http://stackoverflow.com/q/25718950
has text: Check Java version for both machines.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25724350
type: Question
answer count: 1
score: 0
has body: I'm trying to create an application using Java with PayPal. Scenario: There is a webshop, a buyer and my application. I want to create the application such that the buyer and the webshop firstly give the app permissions to pay and receive money respectively. Then in the future when the buyer buys something from the webshop, my application has all the information needed to execute this action without involvement of the buyer or webshop. Now there are two things that are not clear (and I can't find it in the PayPal documentation): Using the Permissions API you must select the GroupIDs to get permissions for the different API sets. I don't know which one to select for the buyer or for the webshop. Then, using the authorization header, you can perform the API call. In the case of the buyer, I want to perform a PayPal payment (NOT using a credit card). How do I do this? Which API call do I need to call? (something in Adaptive Payments maybe?) Thanks in advance.
type: UnansweredQuestion
tagged with: paypal
has title: Using PayPal Permissions API to do PayPal payments
tagged with: java
tagged with: paypal-permissions
has answer: http://stackoverflow.com/a/25736286

http://stackoverflow.com/q/25750959
type: Question
tagged with: weka
has title: Java Naive Bayes Classifier evaluation
downvote count: 0
has body: i am new to weka data mining and evaluation.So far i have read data set.I want to predict my data based on data set.As a example i have used weather data set provided by weka tool.So i have used Naive Bayes Classifier for classification.Now i got probability values for my attributes.Now i want to predict data using data-set. As example when i give sunny,70,85,TRUE then i want to get probability of class value.So far i have done this part.Can anyone tell me how to used Naive Bayes classifier for data evaluation. public static void ArfLoader(){ ArffLoader loader = new ArffLoader(); try { loader.setFile(new File("sampleData.txt")); Instances structure = loader.getStructure(); structure.setClassIndex(structure.numAttributes() - 1); NaiveBayesUpdateable nb = new NaiveBayesUpdateable(); nb.buildClassifier(structure); Instance current; while ((current = loader.getNextInstance(structure)) != null){ nb.updateClassifier(current); } System.out.print(nb); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } Then this is my data set. @relation weather @attribute outlook {sunny, overcast, rainy} @attribute temperature real @attribute humidity real @attribute windy {TRUE, FALSE} @attribute play {yes, no} @data sunny,85,85,FALSE,no sunny,80,90,TRUE,no overcast,83,86,FALSE,yes rainy,70,96,FALSE,yes rainy,68,80,FALSE,yes rainy,65,70,TRUE,no overcast,64,65,TRUE,yes sunny,72,95,FALSE,no sunny,69,70,FALSE,yes rainy,75,80,FALSE,yes sunny,75,70,TRUE,yes overcast,72,90,TRUE,yes overcast,81,75,FALSE,yes rainy,71,91,TRUE,no
has answer: http://stackoverflow.com/a/25802113
answer count: 1
favorite count: 0
upvote count: 2
tagged with: classification
type: UnansweredQuestion
score: 2
tagged with: java

http://stackoverflow.com/q/25840850
tagged with: stringtokenizer
has title: Returning StringTokenizer to be able to setText on a Textarea
has comment: http://stackoverflow.com/comment/40430409
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/40430436
has body: Dunno what to do, what is the best way to do this. this code is in my actionlistner for a button if clicked text = stringtokenizer(text); ta2.setText(text); ta2 is a textarea this is the method for stringtokenizer public static StringTokenizer stringtokenizer(String text) { StringTokenizer tx = new StringTokenizer(text); while (tx.hasMoreElements()) { System.out.println(tx.nextElement()); } return tx; } how can i be able to return the elements and print it in the textarea.
tagged with: jlabel
has comment: http://stackoverflow.com/comment/40430390
accepted answer: http://stackoverflow.com/a/25841169
has comment: http://stackoverflow.com/comment/40430338
has comment: http://stackoverflow.com/comment/40430253
has comment: http://stackoverflow.com/comment/40430206
score: 0
tagged with: java
type: Question
type: AnsweredQuestion
tagged with: jtextarea
has answer: http://stackoverflow.com/a/25841169

http://stackoverflow.com/comment/40202939
comment on: http://stackoverflow.com/q/25717336
score: 0
type: Comment
type: QuestionComment
has text: Please post the logcat error, so that we can help you

http://stackoverflow.com/comment/40469793
score: 0
type: Comment
has text: @carlspring Yes, I have specified a server in settings.xml. Deploying the Commons Jar to the server works, but packaging the Foo Jar on the server doesn't work. The problem is that the server tries to connect to itself remotely to access the Commons Jar.
type: QuestionComment
comment on: http://stackoverflow.com/q/25850273

http://stackoverflow.com/q/25720788
has title: Simple Netty Echo Server/Client not receiving messages
downvote count: 0
has body: I'm trying to write a simple echo server with Netty. I'm reading Netty in Action MEAP v8 to get down some theory and learn the core basics of Netty. The client connects successfully, but no messages get through from the client. I am able to telnet a message to the server and receive the response, so I guess the issue is on the client, I just have no idea what is wrong, due to me being new to Netty. Here is the client: public class Client { private final String host; private final int port; public Client(String host, int port) { this.host = host; this.port = port; } public void start() throws Exception { EventLoopGroup group = new NioEventLoopGroup(); try { Bootstrap b = new Bootstrap(); b.group(group).channel(NioSocketChannel.class) .remoteAddress(new InetSocketAddress(host, port)) .handler(new ChannelInitializer&lt;SocketChannel&gt;() { @Override public void initChannel(SocketChannel ch) throws Exception { ch.pipeline().addLast(new EchoClientHandler()); } }); ChannelFuture f = b.connect().sync(); f.channel().closeFuture().sync(); } finally { group.shutdownGracefully().sync(); } } public static void main (String [] args) throws Exception { new Client("127.0.0.1", 11235).start(); } } And the Client handler: (I did try appending '\r\n' to the sent message, but that did not make a difference, which I found here: Netty Client to Server message) @Sharable public class EchoClientHandler extends SimpleChannelInboundHandler&lt;ByteBuf&gt; { public void channelActive(ChannelHandlerContext ctx) { System.out.println("Connected"); ctx.write(Unpooled.copiedBuffer("Netty MAY rock!", CharsetUtil.UTF_8)); } protected void channelRead0(ChannelHandlerContext ctx, ByteBuf in) throws Exception { System.out.println( "Client received: " + in.toString(CharsetUtil.UTF_8)); } public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { cause.printStackTrace(); ctx.close(); } } The server: public class EchoServer { private final int port; public EchoServer(int port) { this.port …
has answer: http://stackoverflow.com/a/25722508
answer count: 1
favorite count: 0
tagged with: netty
score: 6
accepted answer: http://stackoverflow.com/a/25722508
upvote count: 6
type: AnsweredQuestion
tagged with: tcp
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/13923032
tagged with: client-server

http://stackoverflow.com/comment/40323125
type: QuestionComment
has text: @user3797031 post `activity_main.xml`
comment on: http://stackoverflow.com/q/25782407
score: 0
type: Comment

http://stackoverflow.com/a/25805304
answers question: http://stackoverflow.com/q/25805231
type: Answer
upvote count: 1
downvote count: 1
has body: Because when you created an instance of the Subclass it invokes the constructor of its super class AClass, and at this point, x was not yet set that's why it gets the default value of 0.
score: 0

http://stackoverflow.com/a/25743740
has comment: http://stackoverflow.com/comment/40252583
downvote count: 0
has comment: http://stackoverflow.com/comment/40253181
has comment: http://stackoverflow.com/comment/40256219
type: Answer
has comment: http://stackoverflow.com/comment/40252470
score: 7
upvote count: 7
has body: There is no need to declare unchecked exceptions in the throws ... clause of a method. As stated in the Java Language Specification, "It is permitted but not required to mention unchecked exception classes in a throws clause". It is common practice to list unchecked exceptions in your Javadoc if you anticipate that users of your API might encounter them. A common example of this is to list why an IllegalArgumentException might be thrown. If you wrap one method with another, apply the Effective Java principle of throwing exceptions suitable to the level of abstraction (Item 61). This should be applied to both checked exceptions and expected unchecked exceptions.
has comment: http://stackoverflow.com/comment/40253273
answers question: http://stackoverflow.com/q/25743574

http://stackoverflow.com/comment/40358230
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25800466
has text: This change still doesn't make sense and suffers from the core problem as the original: it will tell the user they defeated the monster after entering an invalid attack (eg. 4), but it won't tell them when they *actually* defeated the monster. However, formatting the code like this does make the issue much more apparent.
type: Comment

http://stackoverflow.com/q/25748048
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25748184
has title: cvc-complex-type.2.4.a:Invalid content was found starting with element 'bean'
has body: I've tried solving this issue for hours. When I run my code I get an error saying: cvc-complex-type.2.4.a:Invalid content was found starting with element 'bean' One of '{"http://www.springframework.org/schema/context":include-filter, "http://www.springframework.org/schema/context":exclude-filter}' is expected. I've looked around alot for answers, some suggestions were that one should make sure the right versions are used. I use the same version in my xml as in my pom file. (I'm using maven with eclipse btw). Any suggestions on what the problem might be? &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.7.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.7.xsd"&gt; &lt;context:component-scan base-package="org.mywebbapp.filemanagement"&gt; &lt;bean class="org.springframework.beans.factory.config.ServiceLocatorFactoryBean" id="FileStoreFactory"&gt; &lt;property name="FileStore" value="org.mywebbapp.filemanagement.FileStoreFactory"&gt; &lt;/property&gt; &lt;/bean&gt; &lt;alias alias="FH" name="FileHandler" /&gt; &lt;/context:component-scan&gt; &lt;/beans&gt;
accepted answer: http://stackoverflow.com/a/25748184
answer count: 1
downvote count: 0
favorite count: 0
tagged with: spring
tagged with: xsd
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/40202028
comment on: http://stackoverflow.com/a/25716484
type: Comment
has text: @zephos2014 What exactly are you prompts? You didn't include them, but you could certainly keep a map or a list of prompts. If you have two methods that get input with a `Scanner` around `System.in` and you close it in one, the other method will never get input.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25808433
score: 4
has comment: http://stackoverflow.com/comment/40457671
possible better answer: http://stackoverflow.com/a/35715384
answer count: 5
has answer: http://stackoverflow.com/a/35715384
has comment: http://stackoverflow.com/comment/40452941
has answer: http://stackoverflow.com/a/30759949
has title: Hidden Field Value Blank Thymeleaf
type: Question
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: java
upvote count: 4
tagged with: thymeleaf
downvote count: 0
accepted answer: http://stackoverflow.com/a/30759949
has answer: http://stackoverflow.com/a/64058924
has body: I have a thymeleaf form which has 2 hidden fields. I specify the value of the hidden fields using th:value, and I bind these fields to an object. Next Question I want to bind the quizID and sequenceNo fields with the respective fields in the object. Line 6 and 7 correctly resolve the value of sequence number/quiz id and display it. However, the same value is not resolved in the th:value tag inside the form. The value is empty and nothing gets bound to the object fields. Request your help here. EDIT: The code works when I remove the th:field attribute from the hidden element. But I want to bind it to an object variable, so that the server can process it. `
has comment: http://stackoverflow.com/comment/40444435
has answer: http://stackoverflow.com/a/78787154
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/40454648
has answer: http://stackoverflow.com/a/48966845
favorite count: 0

http://stackoverflow.com/q/25820395
has title: What would be the flow order if I include multiple struts config file in the project
favorite count: 0
tagged with: struts2
has answer: http://stackoverflow.com/a/25826586
has comment: http://stackoverflow.com/comment/40399445
upvote count: 3
accepted answer: http://stackoverflow.com/a/25826586
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: xml-configuration
tagged with: struts
possible better answer: http://stackoverflow.com/a/25823855
type: Question
has answer: http://stackoverflow.com/a/25823855
answer count: 2
has body: I am using Struts2. Below is my Action Class (TutorialAction). public class TutorialAction { public String execute() { System.out.println("Hello from Execute!"); return "failure"; } } I am returning "failure" in execute method of this Action class. Below are my 2 struts config files : ======================== struts.xml ================================ <?xml version="1.0" encoding="UTF-8"?> /ErrorPage.jsp In above config file I am including another struts config file(struts2.xml) for same namespace : ======================== struts2.xml ================================ <?xml version="1.0" encoding="UTF-8"?> /SuccessPage.jsp My project is running fine. I am just curious to know if included file in struts.xml (which is struts2.xml) is run after main struts.xml or before ? Or what would be the output: /SuccessPage.jsp or /ErrorPage.jsp?
downvote count: 0
tagged with: jsp

http://stackoverflow.com/q/25744252
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/40253445
has body: I am adding non proxy hosts in standalone.conf.bat of getting portal server by -Dhttp.proxyHost=10.111.1.00 -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=localhost|127.0.0.1|172.16.31.* " and when i am starting the server getting following error. c:\jboss-jpp-6.1.0\jboss-jpp-6.1\bin&gt;standalone.bat Calling "c:\jboss-jpp-6.1.0\jboss-jpp-6.1\bin\standalone.conf.bat" '127.0.0.1' is not recognized as an internal or external command, operable program or batch file.
type: AnsweredQuestion
tagged with: java
has title: Bypassing non proxy hosts in JAVA_OPTS
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/31062162
has comment: http://stackoverflow.com/comment/40253202
tagged with: gatein
has comment: http://stackoverflow.com/comment/40284996
has answer: http://stackoverflow.com/a/31062162
answer count: 1
downvote count: 0

http://stackoverflow.com/a/25829442
answers question: http://stackoverflow.com/q/25829421
type: Answer
upvote count: 2
score: 2
has comment: http://stackoverflow.com/comment/40409286
downvote count: 0
has body: If I understand your question, you could do it with something like this, int fahrenheit = 100; System.out.println(fahrenheit + "\u00b0F --&gt; "); On my system that outputs 100°F --&gt; You can also use formatted output, something like, System.out.printf("%d\u00b0F --&gt; %n", fahrenheit); For the same output as above.

http://stackoverflow.com/q/25829292
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25829391
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40408700
has title: How to use a variable in a lambda, when the variable was assigned as a result of calling the method the lambda was supplied to?
type: Question
score: 3
has comment: http://stackoverflow.com/comment/40416479
has answer: http://stackoverflow.com/a/25829323
has answer: http://stackoverflow.com/a/25830589
downvote count: 0
has answer: http://stackoverflow.com/a/25829377
has body: I have a method TaskManager.newRepeatingTask(Runnable r, long delay, long interval) and it returns a UUID. I assign a UUID variable to what that method returned, and I want to use that variable inside of the Runnable. How would I accomplish this effectively, or alternatively, to what I'm trying to accomplish here? UUID id = TaskManager.newRepeatingTask(() -&gt; { for (int i = 0; i &lt; profileButtons.length; i++) { GuiButton button = profileButtons[i]; button.move(-1, 0); } toMove--; if (toMove == 0) { // id: "The variable may not have been initialized" TaskManager.cancelTask(id); } }, 30L, 0L);
favorite count: 0
accepted answer: http://stackoverflow.com/a/25830589
tagged with: lambda
tagged with: java-8
possible better answer: http://stackoverflow.com/a/25829391
answer count: 4

http://stackoverflow.com/comment/40457921
has text: Why the downvote without a reason? If this isn't a constructive question to the community in it's current state, I'd be more than willing to revise it.
type: Comment
comment on: http://stackoverflow.com/q/25856048
score: 0
type: QuestionComment

http://stackoverflow.com/comment/140089265
type: Comment
has text: I needed to append `/bin/java` to the location `echo $JAVA_HOME` provided
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/33477302

http://stackoverflow.com/comment/40333613
comment on: http://stackoverflow.com/q/25788352
has text: @AlexR ok fine.but is there any other solution for this?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40411028
score: 0
type: Comment
type: QuestionComment
has text: @Code-Apprentice so, if I write ArrayAdapter<String>, it will always have to return string objects, but not in arrayadapter only? Also say me which is efficient or true approach?
comment on: http://stackoverflow.com/q/25830552

http://stackoverflow.com/a/25793187
has comment: http://stackoverflow.com/comment/78301105
has comment: http://stackoverflow.com/comment/78335404
type: Answer
has comment: http://stackoverflow.com/comment/78328648
has comment: http://stackoverflow.com/comment/78300885
downvote count: 2
answers question: http://stackoverflow.com/q/25793068
score: 33
has comment: http://stackoverflow.com/comment/130013297
upvote count: 35
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25793068
has body: Download the groovy-all.jar and add it to the classpath. With Maven, add this to your dependencies (browse groovy-all on mvnrepository.com): org.codehaus.groovy groovy-all 2.4.5

http://stackoverflow.com/q/25756494
tagged with: for-loop
has body: I have a builder constructor. I was looking for a way to shorten several not dissimilar declarations that would otherwise take up a lot of lines of code and this is an example of what I came up with. Element is a separate enum set and the idea is to loop through it and to add the values to the HashMap&lt;Element, Double&gt; multipliers outside of the method. It complies fine but I get the titled runtime exception for multipliers.put(e, 1.0) . The Element enum definitely exists and is within the same file. A question with a similar name simply answers "goes crazy if something goes wrong in the static block" this seems abstract and unhelpful. The map here would only apply to instances of the class the Builder is assigned to, which is why I included it in the constructor. What am I missing? These are all meant as examples that hopefully help replicating the problem: public enum Element { ALPHA("Alpha"), BETA("Beta"), GAMMA("Gamma"), DELTA("Delta") public final String name; Element(String name) { this.name = name; } } The Type class import java.util.HashMap; public class Type { String name; HashMap&lt;Element, Double&gt; multipliers; Type(Builder p) { name = p.name; multipliers = p.multipliers; } static class Builder { final String name; HashMap&lt;Element, Double&gt; multipliers; public Builder(Element element) { this.name = element.name; // Default values for (Element e : Element.values()) { multipliers.put(e, 1.0); } } public Builder nullify(Element... elements) { for (Element e : elements) { multipliers.put(e, 0.0); } return this; } public Type generate() { return new Type(this); } } } and in TypeChecker, declared outside of main I have lines similar to: static Type premier = new Type.Builder(Element.ALPHA) .nullify(Element.GAMMA, Element.DELTA) .generate();
has comment: http://stackoverflow.com/comment/40276645
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25757130
favorite count: 0
has comment: http://stackoverflow.com/comment/40276287
tagged with: dictionary
type: AnsweredQuestion
tagged with: builder
score: 1
tagged with: java
upvote count: 1
has title: Exception in Initializer Error with Builder pattern
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/40276547
has answer: http://stackoverflow.com/a/25757130

http://stackoverflow.com/q/25738683
has comment: http://stackoverflow.com/comment/40250068
has answer: http://stackoverflow.com/a/25742521
accepted answer: http://stackoverflow.com/a/25742521
has comment: http://stackoverflow.com/comment/40248589
favorite count: 0
upvote count: 5
downvote count: 0
tagged with: spring
has title: Spring 4 @AutoWired Failed
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/37639533
tagged with: java
has comment: http://stackoverflow.com/comment/40248839
type: Question
answer count: 2
score: 5
tagged with: websocket
has body: I am trying websocket sample and here I am getting error. `@Configuration @EnableWebSocketMessageBroker @EnableScheduling @Component public class WebSocketConfig implements WebSocketMessageBrokerConfigurer { @Autowired private SimpMessagingTemplate template; private TaskScheduler scheduler = new ConcurrentTaskScheduler(); @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/simplemessages").withSockJS(); } /** * Configure message broker options. */ @Override public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/topic/", "/queue/"); config.setApplicationDestinationPrefixes("/app"); } @PostConstruct private void broadcastTimePeriodically() { scheduler.scheduleAtFixedRate(new Runnable() { public void run() { template.convertAndSend("/topic/simplemessagesresponse", "Updated text "+new Date()); } }, 1000); } @Override public void configureClientInboundChannel(ChannelRegistration registration) { } @Override public void configureClientOutboundChannel(ChannelRegistration registration) { registration.taskExecutor().corePoolSize(4).maxPoolSize(10); } @Override public boolean configureMessageConverters(List&lt;MessageConverter&gt; arg0) { // TODO Auto-generated method stub return false; } @Override public void configureWebSocketTransport(WebSocketTransportRegistration arg0) { } } ` Here is my Spring context 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" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd 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/con…
has answer: http://stackoverflow.com/a/37639533

android-activity
tags question: http://stackoverflow.com/q/25735788
tags question: http://stackoverflow.com/q/25762200
tags question: http://stackoverflow.com/q/25849636
tags question: http://stackoverflow.com/q/25739734
tags question: http://stackoverflow.com/q/25755503
tags question: http://stackoverflow.com/q/25764282
tags question: http://stackoverflow.com/q/25796003
tags question: http://stackoverflow.com/q/25831683
tags question: http://stackoverflow.com/q/25761931
tags question: http://stackoverflow.com/q/25832701
tag name: android-activity
tags question: http://stackoverflow.com/q/25791792
tags question: http://stackoverflow.com/q/25827856
tags question: http://stackoverflow.com/q/25832032
tags question: http://stackoverflow.com/q/25837885
tags question: http://stackoverflow.com/q/25786908
tags question: http://stackoverflow.com/q/25825386
tags question: http://stackoverflow.com/q/25821020
tags question: http://stackoverflow.com/q/25781314
tags question: http://stackoverflow.com/q/25784549
tags question: http://stackoverflow.com/q/25836860
tags question: http://stackoverflow.com/q/25864376
tags question: http://stackoverflow.com/q/25766991
tags question: http://stackoverflow.com/q/25797419
tags question: http://stackoverflow.com/q/25722590
tags question: http://stackoverflow.com/q/25727476
type: Tag
tags question: http://stackoverflow.com/q/25751712

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

http://stackoverflow.com/comment/40446893
type: QuestionComment
score: 0
has text: You are trying to add image to the RadioButton and not JLabel as it looks from your code.
comment on: http://stackoverflow.com/q/25849496
type: Comment

http://stackoverflow.com/comment/40567219
comment on: http://stackoverflow.com/q/25810093
score: 0
type: QuestionComment
has text: Thanks for the replays! It seems that I need to create a plugin but there are many details (perhaps they are very obvious!) that are not explained in those links. could you please tell me the steps with some more detail to create a plugin that create a specific project automatically?
type: Comment

http://stackoverflow.com/q/25783717
downvote count: 0
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40326173
has comment: http://stackoverflow.com/comment/40325933
has title: Not able to pass -javaagent as JVM arg to Jetty 9
has comment: http://stackoverflow.com/comment/40344446
has comment: http://stackoverflow.com/comment/40325650
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: jetty
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40356529
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40326271
tagged with: jetty-9
has comment: http://stackoverflow.com/comment/40326383
has comment: http://stackoverflow.com/comment/40326408
has comment: http://stackoverflow.com/comment/40325795
has body: I wanted to use jamm in our project. For that to be used, I have to pass '-javaagent:&lt;..path...>/jamm-0.2.5.jar' as JVM args. I am able to pass this argument in tomcat by adding the jar to tomcat/lib folder and modified startup.bat as follows: set JAVA_OPTS=-Xms1024m -Xmx1024m -XX:MaxPermSize=256m -javaagent:"%CATALINA_HOME%\lib\jamm-0.2.5.jar" call "%EXECUTABLE%" jpda start %CMD_LINE_ARGS% But I am not able to achieve the same in Jetty9. As done in Tomcat, I have copied the jamm-0.2.5.jar to jetty-distribution-9.2.3.v20140905/lib and added the following in startup.ini --exec -Xms1024m -Xmx1024m -XX:MaxPermSize=256m -Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=n -javaagent:E:\jetty-distribution-9.2.3.v20140905\lib\jamm-0.2.5.jar It is not working. Also I tried removing this and adding it in jetty.sh ##################################################### # Add jetty properties to Java VM options. ##################################################### JAVA_OPTIONS+=("-Djetty.home=$JETTY_HOME" "-Djetty.base=$JETTY_BASE" "-Djava.io.tmpdir=$TMPDIR" "-javaagent:$JETTY_HOME/lib/jamm-0.2.5.jar") But it did not work. Where should I pass these jvm args in jetty? Can't I refer to JETTY_HOME the same way as I have done with TOMCAT_HOME in tomcat? Note: I am working on Windows 8. Here is the output of java -jar start.jar --list-config: Java Environment: ----------------- java.home = C:\Program Files\Java\jre7 java.vm.vendor = Oracle Corporation java.vm.version = 23.0-b21 java.vm.name = Java HotSpot(TM) 64-Bit Server VM java.vm.info = mixed mode java.runtime.name = Java(TM) SE Runtime Environment java.runtime.version = 1.7.0_04-b22 java.io.tmpdir = C:\Users\PGULLA~1\AppData\Local\Temp\ user.dir = E:\jetty-distribution-9.2.3.v20140905 user.language = en user.country = US Jetty Environment: ----------------- jetty.version = 9.2.3.v20140905 jetty.home = E:\jetty-distribution-9.2.3.v20140905 jetty.base = E:\jetty-distribution-9.2.3.v20140905 Config Search Orde…

http://stackoverflow.com/comment/43052615
has text: It is provided by library org.jboss.resteasy:resteasy-multipart-provider:3.0.8.Final.
comment on: http://stackoverflow.com/a/25913330
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40344611
type: QuestionComment
comment on: http://stackoverflow.com/q/25792082
has text: @EngineerDollery At the JVM level, what other way is there to specify Java dependencies besides classpath? What is it a subset of?
score: 0
type: Comment

java-7
tags question: http://stackoverflow.com/q/25809019
tag name: java-7
tags question: http://stackoverflow.com/q/25835786
type: Tag
tags question: http://stackoverflow.com/q/25862198
tags question: http://stackoverflow.com/q/25804948

constant-expression
tags question: http://stackoverflow.com/q/25745272
tag name: constant-expression
type: Tag

http://stackoverflow.com/q/25778887
type: Question
has comment: http://stackoverflow.com/comment/40316846
has answer: http://stackoverflow.com/a/25778965
has body: I have just been looking into assert in Java and now I am trying to figure out how can we view the message if the assert was true in Eclipse. Code below: public class TheAssertClass { public TheAssertClass(){ int y = 5; int x = 4; assert (y &gt; x): "y is too big. y = " + y; } public static void main(String[] args){ TheAssertClass go = new TheAssertClass(); System.out.println("The program ran"); } } The console only displays "The program ran". I am not exactly sure if I am using this correctly? Thanks.
score: 0
answer count: 2
has title: Java - How to view assert messages in Eclipse
linked to: http://stackoverflow.com/q/11415160
has comment: http://stackoverflow.com/comment/40317055
accepted answer: http://stackoverflow.com/a/25778965
has comment: http://stackoverflow.com/comment/40316832
has comment: http://stackoverflow.com/comment/40316968
tagged with: java
has comment: http://stackoverflow.com/comment/40316734
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/45469294
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3018683
has answer: http://stackoverflow.com/a/45469294
has comment: http://stackoverflow.com/comment/40316803

http://stackoverflow.com/comment/40409475
has text: hi thanks for reply. So putting the convertRowIndexToModel inside the for loop is correct?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25829729
score: 0

http://stackoverflow.com/comment/40330722
has text: possible duplicate of [What is a stack trace, and how can I use it to debug my application errors?](http://stackoverflow.com/questions/3988788/what-is-a-stack-trace-and-how-can-i-use-it-to-debug-my-application-errors)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25786542
score: 0

http://stackoverflow.com/comment/40214987
score: 0
type: Comment
type: QuestionComment
has text: Why 8 bytes? Eight bytes of payload and 28 bytes of UDP header overhead doesn't make much sense.
comment on: http://stackoverflow.com/q/25723655

http://stackoverflow.com/q/25862158
has answer: http://stackoverflow.com/a/25867737
has title: How to add a new folder from the disk, into an Eclipse project?
favorite count: 0
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40468798
accepted answer: http://stackoverflow.com/a/25867737
score: 1
tagged with: java
has body: On searching, all I get are results for how to import an existing project into Eclipse. My problem is different. I have a war file which I imported to Eclipse. Now I want to add nvd3's files to the project, and have placed nvd3's folder in the WebContent/scripts/lib folder on the disk. Now there seems to be no way to make Eclipse recognize that the nvd3 folder exists there. There seems to be no way to add it either in Eclipse. Using the JavaEE version of Eclipse Kepler.
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40469050
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/q/25770711
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40302666
has comment: http://stackoverflow.com/comment/40302586
has comment: http://stackoverflow.com/comment/40302563
linked to: http://stackoverflow.com/q/14510547
tagged with: java
tagged with: hibernate
tagged with: orm
tagged with: mysql
type: Question
has title: Hibernate: foreign key partially used as primary key
has body: I have been working for hours trying to solve this problem, which seems quite simple from a database point of view but hard to figure out with hibernate. I have got two tables: VehicleCategory, and Vehicle. A Vehicle has one VehicleCategory, so a Vehicule references a VehiculeCategory using a foreign key. VehicleCategory: String attr1 String attr2 Integer attr3 String attr4 PRIMARY KEY (attr1, attr2, attr3, attr4) Vehicle String name String attr1 String attr2 Integer attr3 String attr4 FOREIGN KEY (attr1, attr2, attr3, attr4) REFERENCES VehicleCategory PRIMARY KEY (name, attr1, attr2, attr3) Here is my point: I do not want to use attr4 for my primary key, but I want to use the other foreign attributes in my primary key. This is the mapping I did: &lt;class name="Vehicle" table="vehicle"&gt; &lt;composite-id&gt; &lt;key-property name="name" column="name"/&gt; &lt;key-many-to-one name="vehiclecategory" class="VehicleCategory"&gt; &lt;column name="attr1" not-null="true" /&gt; &lt;column name="attr2" not-null="true" /&gt; &lt;column name="attr3" not-null="true" /&gt; &lt;/key-many-to-one&gt; &lt;/composite-id&gt; &lt;many-to-one name="vehiclecategory" class="VehicleCategory" fetch="select" insert="false" update="false" &gt; &lt;column name="attr1" not-null="true" /&gt; &lt;column name="attr2" not-null="true" /&gt; &lt;column name="attr3" not-null="true" /&gt; &lt;column name="attr4" not-null="true" /&gt; &lt;/many-to-one&gt; &lt;/class&gt; I get the following exception: Foreign key (FK_s94md9vv63hrpwhyaw4rfxec5:vehicle [attr1,attr2,attr3])) must have same number of columns as the referenced primary key (vehicle_category [attr4,attr1,attr2,attr3]) I understand what this exception means. But I do not see why I get it because, from my point of view, I did reference the 4-columns primary key in my foreign key, and only used 3 in my Vehicule primary key. I am using Hibernate 4.3.6 Thank you for your help !
score: 0
tagged with: foreign-keys
has comment: http://stackoverflow.com/comment/40406745
has comment: http://stackoverflow.com/comment/40329928
answer count: 0

http://stackoverflow.com/q/25854729
tagged with: file
upvote count: 1
downvote count: 1
has title: How to read in information from a file, and store it as a string. Java
tagged with: java
type: Question
answer count: 1
tagged with: string
has body: ive gotten this far, but this doesnt work to read in the file, thats the part im stuck on. i know that you need to use the scanner, but im not sure what im missing here. i think it needs a path to the file also, but i dont know where to put that in public class string { public static String getInput(Scanner in) throws IOException { { Scanner keyboard = new Scanner(System.in); System.out.println("Enter file"); String filename =keyboard.next(); File inputFile = new File(filename); Scanner input = new Scanner(inputFile); String line; while (input.hasNext()) { line= input.nextLine(); System.out.println(line); } input.close(); } if(filename.isEmpty()) { System.out.println("Sorry, there has been an error. You must enter a string! (A string is some characters put together.) Try Again Below."); return getInput(in); } else { return filename; } } public static int getWordCount(String input) { String[] result = input.split(" "); return result.length; } public static void main(String[] args) { DecimalFormat formatter = new DecimalFormat("0.##"); String input = getInput(new Scanner(System.in)); float counter = getWordCount(input); System.out.println("The number of words in this string ("+input+") are: " + counter); Scanner keyboard= new Scanner(System.in); } } //end of code
favorite count: 0
has answer: http://stackoverflow.com/a/25854786
has comment: http://stackoverflow.com/comment/40454926
type: UnansweredQuestion
score: 0

http://stackoverflow.com/a/25729542
type: AcceptedAnswer
has body: A Runnable isn't a thread. It's just an interface which defines a run method. Calling the run method of an implementing class doesn't run it in a new thread, it just calls it in the thread you're already in, like with any method call. Essentially, Runnable is exactly the Task interface you suggest.
accepted answer of: http://stackoverflow.com/q/25729435
has comment: http://stackoverflow.com/comment/67140921
type: Answer
has comment: http://stackoverflow.com/comment/67237058
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25729435

http://stackoverflow.com/comment/40275882
type: Comment
type: QuestionComment
has text: Could you post a full stack of the error? maybe turn the debug mode?
comment on: http://stackoverflow.com/q/25754522
score: 0

http://stackoverflow.com/q/25863255
has body: Sorry for my English I don't use any of fields for the locking because so I shouldn't think about could or couldn't some field have value null. I always create special fields used only for locking in thread synchronization. For example: public class Worker { private static final List&lt;Toilet&gt; TOILETS = Arrays.asList( new Toilet(1), new Toilet(2), // ... new Toilet(NUMBER_OF_FLOORS) ); // here it is: private static final List&lt;String&gt; LOCK_TOILETS = Arrays.asList( "LOCK TOILET #1", "LOCK TOILET #2", // ... "LOCK TOILET #" + NUMBER_OF_FLOORS ); private final int floorNumber; public void spendWorkingHours() { for (int i = 0; i &lt; X; ++i) { doWork(); snackSomething(); String lockToilet = LOCK_TOILETS.get(floorNumber); Toilet theOnlyToiletOnTheFloor = TOILETS.get(floorNumber); synchronized (lockToilet) { goToToilet(theOnlyToiletOnTheFloor); } } } }
has answer: http://stackoverflow.com/a/25863361
has comment: http://stackoverflow.com/comment/40481260
has answer: http://stackoverflow.com/a/25863366
has comment: http://stackoverflow.com/comment/40470979
has answer: http://stackoverflow.com/a/25863356
answer count: 4
tagged with: synchronization
has comment: http://stackoverflow.com/comment/40489083
upvote count: 3
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40470806
has comment: http://stackoverflow.com/comment/40470627
has comment: http://stackoverflow.com/comment/40471268
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40470874
tagged with: java
accepted answer: http://stackoverflow.com/a/25863356
has comment: http://stackoverflow.com/comment/40471094
has comment: http://stackoverflow.com/comment/40490105
has answer: http://stackoverflow.com/a/25864366
has comment: http://stackoverflow.com/comment/40483360
type: Question
has title: Is it a good practice to create and use String objects for locking in thread synchronization?
has comment: http://stackoverflow.com/comment/40471629
downvote count: 0
has comment: http://stackoverflow.com/comment/40470655
tagged with: string
tagged with: synchronized
favorite count: 0
possible better answer: http://stackoverflow.com/a/25863361

http://stackoverflow.com/q/25755821
tagged with: integer
has title: Non repeating random integers in Java
has comment: http://stackoverflow.com/comment/40274972
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25755880
answer count: 4
tagged with: java
type: Question
duplicate of: http://stackoverflow.com/q/8115722
has comment: http://stackoverflow.com/comment/40274968
has answer: http://stackoverflow.com/a/25756039
linked to: http://stackoverflow.com/q/8115722
score: 0
has answer: http://stackoverflow.com/a/25755911
has answer: http://stackoverflow.com/a/25755954
tagged with: random
has body: I'm trying to get a simple bit of java code spit out the numbers 1-6 in random order without repeating. I've manage to get it to spit out six random integers between one and six, but it only checks to see if a number is used once. Here is the code: import java.util.Random; public class kirbyInt { public static void main(String[] args) { int num1, num2, num3, num4, num5, num6; Random rand = new Random(); num1 = rand.nextInt((6-1) + 1) + 1; System.out.println(num1); num2 = rand.nextInt((6-1) + 1) + 1; if (num2 == num1) { num2 = rand.nextInt((6-1) + 1) + 1; System.out.println(num2); } else { System.out.println(num2); } num3 = rand.nextInt((6-1) + 1) + 1; if (num3 == num1 || num3 == num2) { num3 = rand.nextInt((6-1) + 1) + 1; System.out.println(num3); } else { System.out.println(num3); } num4 = rand.nextInt((6-1) + 1) + 1; if (num4 == num1 || num4 == num2 || num4 == num3) { num4 = rand.nextInt((6-1) + 1) + 1; System.out.println(num4); } else { System.out.println(num4); } num5 = rand.nextInt((6-1) + 1) + 1; if (num5 == num1 || num5 == num2 || num5 == num3 || num5 == num4) { num5 = rand.nextInt((6-1) + 1) + 1; System.out.println(num5); } else { System.out.println(num5); } num6 = rand.nextInt((6-1) + 1) + 1; if (num6 == num1 || num6 == num2 || num6 == num3 || num6 == num4 || num6 == num5) { num6 = rand.nextInt((6-1) + 1) + 1; System.out.println(num6); } else { System.out.println(num6); } } }
has comment: http://stackoverflow.com/comment/40275127

bitmap
tags question: http://stackoverflow.com/q/25714003
type: Tag
tags question: http://stackoverflow.com/q/25735497
tag name: bitmap
tags question: http://stackoverflow.com/q/25840629
tags question: http://stackoverflow.com/q/25716058
tags question: http://stackoverflow.com/q/25725273
tags question: http://stackoverflow.com/q/25838970
tags question: http://stackoverflow.com/q/25804450
tags question: http://stackoverflow.com/q/25817329
tags question: http://stackoverflow.com/q/25721628

http://stackoverflow.com/comment/40390835
type: AnswerComment
has text: hi thanks. I have to process files in a directory but i don't want to do it in serial. So that's why i use worker(). How do you suggest I do this?
type: Comment
comment on: http://stackoverflow.com/a/25810530
score: 0

http://stackoverflow.com/a/25801547
has body: I saw that you use global variable for web-driver? You can try to use a parameter like this: public void setImplicitWait(WebDriver myWebdriver, int waitTime_InSeconds) { myWebdriver.manage().timeouts().implicitlyWait(waitTime_InSeconds, TimeUnit.SECONDS); }
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25791548
has comment: http://stackoverflow.com/comment/40434259
accepted answer of: http://stackoverflow.com/q/25791548
has comment: http://stackoverflow.com/comment/40360645
has comment: http://stackoverflow.com/comment/40381813

http://stackoverflow.com/a/25854376
has body: If you want to show a text before you prompt the user you should first print the text and then wait for input: System.out.print("Fiddlesticks!"+"Give me a 5 letter word: "); String l1 = kb.nextLine(); Note the System.out.print() and not System.out.println(), that is because .print() will not add a new line after it prints the text, just to make it look better.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25854270
type: Answer

http://stackoverflow.com/a/25901663
type: Answer
answers question: http://stackoverflow.com/q/25814560
has body: Smells like a bug. Tracking it here.
score: 0

http://stackoverflow.com/a/25808335
accepted answer of: http://stackoverflow.com/q/25716161
type: AcceptedAnswer
downvote count: 0
has body: Each engine's ENGINE_SCOPE bindings is associated with a Nashorn Global scope object. "Array", "Object" etc. are JS built-in constructors defined in global scope. So such constructors are different in different global scopes. So, you can't compare object from another global scope with "instanceof". But because of smart dynalink based linking, nashorn can still allow you to access properties of such "cross global" objects. You can, for example, access "length" property, elements of array from script run in another engine using normal property/element access, method call syntax. Hope this helps.
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25716161
upvote count: 2

http://stackoverflow.com/a/25761579
type: Answer
upvote count: 5
score: 5
has body: It's explained in the docs: Returns an integer pixel in the default RGB color model (TYPE_INT_ARGB) [...] So you get 8 bits alpha channel, 8 bits red, 8 bits green, 8 bits blue. A simple (and slow way) to examine the value is to use new java.awt.Color(colour, true); and then call the getters. Or you can print the value as an unsigned 32bit hex value: Integer.toString(colour, 16). Each two characters of the output will be one part of the ARGB set.
answers question: http://stackoverflow.com/q/25761438
downvote count: 0

http://stackoverflow.com/a/25830844
answers question: http://stackoverflow.com/q/25830800
downvote count: 0
has comment: http://stackoverflow.com/comment/40411561
type: Answer
has comment: http://stackoverflow.com/comment/40411944
has body: Good example - bitwise XOR to swap two numbers (again, very popular in interviews) - fast swapping values without any third variable: int a = 2; // a = 0010 int b = 11; // b = 1011 a = a ^ b; // a = 0010 ^ 1011 = 1001 b = a ^ b; // b = 1001 ^ 1011 = 0010 (as a at the beginning) a = a ^ b; // a = 1001 ^ 0010 = 1011 (as b at the beginning) You can find an article about this in wiki
score: 2
upvote count: 2

http://stackoverflow.com/comment/40328587
has text: @jbw: that’s a completely different issue. Check that your method really has the signature `public static void main(String[])` and that there is no other `String` class is in scope (read that the signature really is `public static void main(java.lang.String[])`)
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25782601

http://stackoverflow.com/q/25784050
has comment: http://stackoverflow.com/comment/77970084
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/36594351
has comment: http://stackoverflow.com/comment/40326067
tagged with: java
has comment: http://stackoverflow.com/comment/40326657
has comment: http://stackoverflow.com/comment/40326868
score: 6
type: Question
linked to: http://stackoverflow.com/q/2745471
has comment: http://stackoverflow.com/comment/77941309
has answer: http://stackoverflow.com/a/36594351
has comment: http://stackoverflow.com/comment/40326745
answer count: 1
has title: Optional path segments in Spring MVC
downvote count: 0
has comment: http://stackoverflow.com/comment/40346239
linked to: http://stackoverflow.com/q/4904092
favorite count: 0
has body: Reading this (Spring 3) article from 2010, it discusses using an extension to provide a convenient way to include optional path segments: @RequestMapping("/houses/[preview/][small/]{id}") public String handlePreview(@PathVariable long id, @PathVariable("preview/") boolean preview, @PathVariable("small/") boolean small) { return "view"; } I know I could just implement a number of request mappings to achieve the same effect: @RequestMapping(value="/houses/preview/{id}") ... @RequestMapping(value="/houses/{id}") ... ~~~ snip ~~~ But depending on the number of possible permutations, it seems like a very verbose option. Does any later version of Spring (after 3) provide such a facility? Alternatively, is there any mechanism to chain portions of the request URL to feed a larger response method signature? Update This answer to a question relating to sharing path variables and request parameters suggests an approach like: @RequestMapping(method=RequestMethod.GET, value={"/campaigns","/campaigns/{id}"}) @ResponseBody public String getCampaignDetails( @PathVariable("id") String id) { ~~~ snip ~~~ But the path variable cannot be set to null. Just going to /campaigns will return a 400 response.
tagged with: rest
tagged with: spring
upvote count: 6
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40332940

http://stackoverflow.com/q/25736794
has comment: http://stackoverflow.com/comment/40239973
tagged with: bytebuffer
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/25736846
type: UnansweredQuestion
tagged with: double
downvote count: 1
upvote count: 19
has body: I need to convert a bytearray to double. I am using double dvalue = ByteBuffer.wrap(value).getDouble(); But at the runtime I am getting BufferUnderflowException exception Exception in thread "main" java.nio.BufferUnderflowException at java.nio.Buffer.nextGetIndex(Buffer.java:498) at java.nio.HeapByteBuffer.getDouble(HeapByteBuffer.java:508) at Myclass.main(Myclass.java:39) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.hadoop.util.RunJar.main(RunJar.java:212) What do I need to change here?
has answer: http://stackoverflow.com/a/25736847
tagged with: java
has answer: http://stackoverflow.com/a/75293293
type: Question
answer count: 3
tagged with: arrays
score: 18
has title: java.nio.BufferUnderflowException while converting byte array to double

http://stackoverflow.com/q/25740369
has comment: http://stackoverflow.com/comment/40246503
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/40246258
has comment: http://stackoverflow.com/comment/40250581
has comment: http://stackoverflow.com/comment/40246714
accepted answer: http://stackoverflow.com/a/25741003
answer count: 1
favorite count: 0
downvote count: 2
tagged with: android
has body: I'm trying to use an if statement to HashMap, but when I try to run it on a device it crashes. Here's my code ImageView promoIcon = (ImageView) findViewById(R.id.icon_promo); DatabaseHandler db = new DatabaseHandler(this); List &lt;AllItem&gt; allItems = new ArrayList&lt;AllItem&gt;(); allItems = db.getAllAccommodations(); for(AllItem cn : allItems) { String promotion = cn.getPromotion(); if (promotion.equals("1")) { promoIcon.setVisibility(View.VISIBLE); } HashMap&lt;String, String&gt; all_Items = new HashMap&lt;String, String&gt;(); all_Items.put(TAG_PROMOTION,promotion); accommodationlist.add(all_Items); } Here's my logcat 09-09 15:13:37.364: E/AndroidRuntime(18292): FATAL EXCEPTION: main 09-09 15:13:37.364: E/AndroidRuntime(18292): Process: com.indomultimedia.hellobali, PID: 18292 09-09 15:13:37.364: E/AndroidRuntime(18292): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.indomultimedia.hellobali/com.indomultimedia.hellobali.Accommodation}: java.lang.NullPointerException 09-09 15:13:37.364: E/AndroidRuntime(18292): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292) 09-09 15:13:37.364: E/AndroidRuntime(18292): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350) 09-09 15:13:37.364: E/AndroidRuntime(18292): at android.app.ActivityThread.access$800(ActivityThread.java:163) 09-09 15:13:37.364: E/AndroidRuntime(18292): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257) 09-09 15:13:37.364: E/AndroidRuntime(18292): at android.os.Handler.dispatchMessage(Handler.java:102) 09-09 15:13:37.364: E/AndroidRuntime(18292): at android.os.Looper.loop(Looper.java:157) 09-09 15:13:37.364: E/AndroidRuntime(18292): at android.app.ActivityThread.main(ActivityThread.java:5335) 09-09 15:13:37.364: E/AndroidRuntime(18292): at java.lang.reflect.Method.invokeNative(Native Method) 09-09 15:13:37.364: E/AndroidRuntime(18292): at java.lang.reflect.Method.invoke(Method.java:515) 09-09 15:13:37.364: E…
has comment: http://stackoverflow.com/comment/40246344
type: AnsweredQuestion
tagged with: java
has title: Java.lang.NullPointerException while doing if statement
has answer: http://stackoverflow.com/a/25741003
has comment: http://stackoverflow.com/comment/40246282
type: Question

http://stackoverflow.com/comment/40414349
score: 0
comment on: http://stackoverflow.com/a/25832477
type: Comment
has text: That's what I was thinking :)
type: AnswerComment

http://stackoverflow.com/q/25825445
has body: I have a Java EE web application (webapp1) with BIRT 3.7.1 integrated. We have few reports and one of the report params is hidden and the value is fetched implicitly from session object.This is done by using scripted dataset and below is the single line used to map the hidden input param of report to the session attribute. Below is the snippet of code from BIRT logs. This works great in webapp1. beforeOpen() { inputParams["param_6"] =(String)(reportContext.getHttpServletRequest().getSession().getAttribute("AppKey")); } Now I am integrating the same reports in another web application (webapp2). The above report which worked fine in webapp1, is not able to find the session attribute in webapp2. I debugged and saw that the session id in the cookie while accessing BIRT's frameset servlet is the same as the web application session. I am not able to understand why BIRT is not able to get the same session where the session attribute was set. The session attribute is set in a JSP page of the web application 2. BIRT integration above is nothing but embedding all the BIRT files/folders in the web application. This is same as the BIRT runtime sample. The web container being used in Tomcat7.
tagged with: session
tagged with: java
score: 0
has title: BIRT beforeOpen method gets new HttpSession object
has comment: http://stackoverflow.com/comment/40403697
has comment: http://stackoverflow.com/comment/40429740
answer count: 0
tagged with: birt
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/40549279

http://stackoverflow.com/comment/40494434
has text: This may answer your question... http://stackoverflow.com/a/20121813/2267073
type: Comment
comment on: http://stackoverflow.com/q/25872637
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40281332
score: 0
has text: And what about `InvestigationModule` class?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25759492

http://stackoverflow.com/comment/40276016
comment on: http://stackoverflow.com/a/25722312
type: AnswerComment
type: Comment
score: 1
has text: Can you write a complete example using the <form:button>?

http://stackoverflow.com/comment/40215575
score: 0
has text: Andrew, you're correct! Epic fail...HTTPGET solved the problem.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25716388

http://stackoverflow.com/q/25751692
accepted answer: http://stackoverflow.com/a/25752130
has comment: http://stackoverflow.com/comment/40267375
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/40267950
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/40267634
tagged with: datepicker
has answer: http://stackoverflow.com/a/25752130
tagged with: timepicker
has comment: http://stackoverflow.com/comment/40267491
score: 0
has body: I've made my own TimePicker that is supposed to work very much like DatePicker. I would like to know the best way to handle an event such as selecting a time and confirming it from the PopupWindow. I could: Make my TimePicker's popup node (a separate FXML and controller) define an interface and force the TimePicker parent to implement the methods to handle the selected date. (I'd MUCH like to avoid using interfaces in this manner. It seems like a terribly way to do things.) Register some kind of custom EventHandler and listener to the popup window? Then, if I click OKAY after selecting a date from the PopupWindow, an event can be fired all the way up to the TimePicker. Implement some kind of callback-like function. In android, for example, there were options for going to another screen solely to retrieve a result. I'm not sure if JavaFX has that kind of thing. The screens are quite separated from each other.
has title: Handling events from within a PopupWindow
type: AnsweredQuestion
tagged with: java
tagged with: javafx

http://stackoverflow.com/a/30481618
score: 0
type: Answer
has body: When you are registering any event like(button.setOnAction(new Clicker())) here starting/first Source of event will be stage and Target will be button. Now stage will delegate that event to Scene and scene will delegate to root Node and so on.finally button will get event. Here Clicker is a handler that will consume that event. If we want to track that event before handling then "Event Filter" comes into the picture. here we can track that event. After tracking once we consume that event then this will not delegate further. If we are not consuming, this will delegate to direct/immediate child node. After tracking If you want to fire some other event then we can call fireEvent(...) method. for more visit oracle documentation a link!
answers question: http://stackoverflow.com/q/25740103

http://stackoverflow.com/q/25757256
tagged with: java
has comment: http://stackoverflow.com/comment/40277476
has title: Quick conditional without return value Java
type: Question
has body: is there a way to make the "inverse" of this type of conditional? For example, we have this conditional: number = (max) ? a : b; Instead of returning a value, I want to execute an action, without returning anything, for example: (max) ? func1(a) :func2(a); Is that possible? Does that make sense? Thanks.
has comment: http://stackoverflow.com/comment/40277514
score: 0
duplicate of: http://stackoverflow.com/q/9450864
has comment: http://stackoverflow.com/comment/40277433
linked to: http://stackoverflow.com/q/9450864
has comment: http://stackoverflow.com/comment/40297210
type: UnansweredQuestion
answer count: 0
tagged with: syntax

http://stackoverflow.com/q/25728775
downvote count: 0
favorite count: 0
tagged with: rest
has title: Architecture for a RESTful web service with a single thread executor?
tagged with: lifecycle
has answer: http://stackoverflow.com/a/25731068
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
has answer: http://stackoverflow.com/a/25728874
score: 1
tagged with: java
has body: I would like to know what could be the best architecture for a RESTful web service with a single thread executor. My goal : Call a RESTful web service The web service add a task in a thread queue and execute all the task 1 per 1. The life cyle of instanciated object is really important (there must be only one thread queue). I know that a RESTful web service life cycle is "per request" (similar to @RequestScoped I think), so I see 2 options : Option 1 : public class RestService { protected final static Executor executor; protected final static Implementation1 impl1; protected final static Implementation2 impl2; static { executor = Executors.newSingleThreadExecutor(); impl1 = new Implementation1(); impl2 = new Implementation2(); } } @Path("/servicename") public class MyService extends RestService { @POST @Path("/compute") public void compute(){ executor.execute(new Runnable(){ public void run(){ impl1.compute(); } }); } } Option 2 : @Singleton public class RestService { private Executor executor; private Implementation1 impl1; private Implementation2 impl2; public RestService () { executor = Executors.newSingleThreadExecutor(); impl1 = new Implementation1(); impl2 = new Implementation2(); } public void execute(Runnable run){ executor.execute(run); } public Implementation1 getImplementation1(){ return impl1; } public Implementation2 getImplementation2(){ return impl2; } } @Path("/servicename") public class MyService { @Inject private RestService rs; @POST @Path("/compute") public void compute(){ rs.execute(new Runnable(){ public void run(){ rs.getImplementation1().compute(); } }); } } For option 1 I'm not sure about the "life cycle" about a static field. Which option should I use ? How would you do that ? Thanks EDIT : Option 3 (thread handled by EJB Container) and "ordering" is not important : @Singleton public class RestService { private final Executor executor; private final Implementation1 impl1; private final Implementation2 impl2; public RestService () { executor…
has comment: http://stackoverflow.com/comment/40234305
tagged with: executor
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40224410

http://stackoverflow.com/comment/40383573
type: QuestionComment
has text: Did the answer helped you or the problem is still there?
score: 0
comment on: http://stackoverflow.com/q/25810797
type: Comment

http://stackoverflow.com/comment/40317427
has text: It means that either the class `T` itself or one of its super classes implements `Comparable`.
score: 18
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25779184

http://stackoverflow.com/comment/40487583
has text: So now you want to choose a color with each label? `Color` is not a `Component`. You want to convert the label's `String` to a color's name?
comment on: http://stackoverflow.com/q/25872055
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40253445
has text: I hate to be off-topic but I am really curious: why specifically 1303 megabytes of memory and not say 1300?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25744252

http://stackoverflow.com/q/25818598
has answer: http://stackoverflow.com/a/25818667
has comment: http://stackoverflow.com/comment/40389625
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25818661
has body: I wrote the code below in Eclipse and trying to do the same in cmd. However I in cmd the error message : Error: Could not find or load main class GetMousePosition. In cmd, I am in the folder where they class is : c:\Java\Examples\src\Robots\ When I compile the class (doing : javac GetMousePosition), everything works fine. Originally, I set up my java's bin folder path in the environment variables. Thanks in advance for your help package Robots; import java.awt.*; import java.awt.event.*; public class GetMousePosition { public static void main(String[] args) { // TODO Auto-generated method stub System.out.println(MouseInfo.getPointerInfo().getLocation()); } }
tagged with: cmd
has comment: http://stackoverflow.com/comment/40389846
type: Question
has answer: http://stackoverflow.com/a/25818663
has title: Running a Java code in cmd is not working while everything is fine in Eclipse
score: 0
tagged with: java
answer count: 3
tagged with: eclipse

http://stackoverflow.com/a/25845093
has comment: http://stackoverflow.com/comment/40496904
upvote count: 11
has body: I tried to re-create your problem but I can't. May be because of the lack of source code you have shown in this question. But this is what I tried. import java.io.File; import javax.jms.ConnectionFactory; import javax.jms.JMSException; import javax.jms.Message; import javax.jms.Session; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.task.TaskExecutor; import org.springframework.jms.core.JmsTemplate; import org.springframework.jms.core.MessageCreator; import org.springframework.jms.listener.DefaultMessageListenerContainer; import org.springframework.jms.listener.adapter.MessageListenerAdapter; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.util.FileSystemUtils; @Configuration @EnableAutoConfiguration public class Application { public class Receiver { private String name; public Receiver(String name) { this.name = name; } /** * When you receive a message, print it out, then shut down the application. * Finally, clean up any ActiveMQ server stuff. */ public void receiveMessage(String message) { System.out.println("Received &lt;" + message + "&gt; @ "+name); //context.close(); FileSystemUtils.deleteRecursively(new File("activemq-data")); } } static String mailboxDestination = "mailbox-destination"; static String mailboxDestination2= "mailbox-destination2"; @Bean MessageListenerAdapter adapter1() { MessageListenerAdapter messageListener = new MessageListenerAdapter(new Receiver("MailBox1")); messageListener.setDefaultListenerMethod("receiveMessage"); return messageListener; } @Bean MessageListenerAdapter adapter2() { MessageListenerAdapter messageListener = new MessageListenerAdapter(new Receiver("MailBox2")); messageListener.setDefaultL…
answers question: http://stackoverflow.com/q/25817242
type: Answer
score: 11
downvote count: 0

http://stackoverflow.com/q/25805166
downvote count: 0
score: 13
has comment: http://stackoverflow.com/comment/40365770
type: Question
tagged with: java
has title: Unmarshalling Error: unexpected element (uri:url, local:"objectname"). Expected elements are <{}objectname>
upvote count: 13
answer count: 6
has answer: http://stackoverflow.com/a/72690753
has answer: http://stackoverflow.com/a/41564383
has comment: http://stackoverflow.com/comment/40373049
tagged with: jaxb2
tagged with: unmarshalling
has answer: http://stackoverflow.com/a/48287872
favorite count: 0
tagged with: maven-jaxb2-plugin
has answer: http://stackoverflow.com/a/25817296
has comment: http://stackoverflow.com/comment/40364926
accepted answer: http://stackoverflow.com/a/25817296
tagged with: spring
has answer: http://stackoverflow.com/a/25844665
possible better answer: http://stackoverflow.com/a/35123210
has body: I'm using jaxb2-marshaller to generate classes to communicate with a webservice. Java-classes are generated with use of some wsdl files. Everything is okay now, but when I'm trying to use some of the generated classes, i got this unmarshalling error, altough I use the generated ObjectFactory classes. Some of the stack: org.springframework.ws.soap.client.SoapFaultClientException: Unmarshalling Error: unexpected element (uri:"http://xxxxxxxxx", local:"customer"). Expected elements are <{}customer> at org.springframework.ws.soap.client.core.SoapFaultMessageResolver.resolveFault(SoapFaultMessageResolver.java:38) at org.springframework.ws.client.core.WebServiceTemplate.handleFault(WebServiceTemplate.java:826) at org.springframework.ws.client.core.WebServiceTemplate.doSendAndReceive(WebServiceTemplate.java:621) at org.springframework.ws.client.core.WebServiceTemplate.sendAndReceive(WebServiceTemplate.java:555) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:390) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:383) at org.springframework.ws.client.core.WebServiceTemplate.marshalSendAndReceive(WebServiceTemplate.java:373) at einvoice.service.CustomerService.createCustomer(CustomerService.java:40) at einvoice.controller.facturatie.FacturatieOverzichtController.handleRenderRequest(FacturatieOverzichtController.java:36) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) And my class: @Service public class CustomerService { @Autowired private WebServiceTemplate customerDaoTemplate; private ObjectFactory customerObjectFactory; public CustomerService() { customerObjectFactory = new ObjectFactory(); } public boolean createCustomer(Customer c) { System.out.println("CREATING CUSTOMER"); einvoice.proxy.customerdaoservice.Customer customer = customerObjectFactory.createCustomer(); customer.setConnectionURL("test"); customer.setUid("testuid"); customer.setName("Korn…
has answer: http://stackoverflow.com/a/35123210
type: AnsweredQuestion

http://stackoverflow.com/a/25968602
upvote count: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25841292
answers question: http://stackoverflow.com/q/25841292
score: 5
type: Answer
has body: as noted here you can not filter and eager fetch a collection at the same time. you can solve it with a correlated subquery: DetachedCriteria subquery = DetachedCriteria.For(User.class) .createAlias("userLoginSession", "session") .add(Restrictions.eq("session.token", sessionToken)) .setFirstResult(0) .setMaxResults(1) // assuming token is unique otherwise this won't restrict users but loginsessions .setProjection(Projections.id()); Criteria crit = session.createCriteria(User.class) .add(Subqueries.propertyIn("id", subquery) .setFetchMode("userLoginSession", FetchMode.JOIN); Note: this is text editor code of the top of my head. Methodnames may vary

http://stackoverflow.com/a/25751984
has comment: http://stackoverflow.com/comment/40267770
answers question: http://stackoverflow.com/q/25751917
downvote count: 0
has comment: http://stackoverflow.com/comment/40268182
type: Answer
has comment: http://stackoverflow.com/comment/40267837
score: 2
has body: The issue seems to be at this line DateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); For the first error it looks like that the date is coming first and the month later so it should be like DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); Second error shows the incorrect format of the date supplied since it is containing - whereas you are expecting the format containing / ie like DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy"); If you want to handle different formats then try like this: String[] formatDates= {"MM/DD/yyyy", "dd/MM/yyyy", "MM-dd-yyyy","dd-MM-yyyy"}; Date tryParse(String dateString) { for (String formatDate: formatDates) { try { return new SimpleDateFormat(formatDate).parse(dateString); } catch (ParseException e) {} } return null; }
upvote count: 2

http://stackoverflow.com/q/25764169
answer count: 1
downvote count: 0
tagged with: mybatis
favorite count: 0
accepted answer: http://stackoverflow.com/a/25827035
linked to: http://stackoverflow.com/q/10545232
type: AnsweredQuestion
type: Question
has body: I am working with Mybatis-3, and I have the following situation: I have Class - User which looks as follows: public class User extends GeneralDto { private String userId; private String email; private String firstName; private String lastName; private long creationTimestamp; private long updateTimestamp; private List&lt;String&gt; tags; private HashMap&lt;String, String&gt; attributes; private HashMap&lt;String, String&gt; accounts; get and set to all + equals + hashcode. } The two hashmaps contain unknown keys and values of the type String (and they are making me a lot of trouble). I have already mapped this Class into tables using insert method. and it is mapped OK to the following tables scheme: User (userIdentity, userId, email, firstName, lastName, creationTimestamp, updateTimestamp) UserAttribute (userIdentity, attributeName, attributeValue, creationTimestamp, updateTimestamp) UserTag (userIdentity, tagName, creationTimestamp, updateTimestamp) UserAccount (userIdentity, accountIdentity, role, creationTimestamp, updateTimestamp) I need to create a GET method. The method receives UserKey object which contains the userId which is the key of a user. and returns an instance of the User Class. This is the SELECT statement which joins all tables and gets the relevant data from each: &lt;select id="getUser" parameterType="com.intel.aa.iot.mybatis.UserResultHandler" resultMap="userResultMap" resultOrdered="true"&gt; SELECT U.userId as userId, U.email as email, U.firstName as firstName, U.lastName as lastName, U.creationTimestamp as creationTimestamp, U.updateTimestamp as updateTimestamp, UT.tagName as tagName, UAT.attributeName as attributeName, UAT.attributeValue as attributeValue, A.accountId as accountId, UAC.role as role FROM User U LEFT OUTER JOIN UserTag UT ON U.userIdentity = UT.userIdentity LEFT OUTER JOIN UserAttribute UAT ON U.userIdentity = UAT.userIdentity LEFT OUTER JOIN UserAccount UAC ON U.userIdentity = UAC.userIdentity LEFT OUTER JOIN ACCOUNTS A ON UAC…
tagged with: hashmap
has title: Mybatis - Returning Object containing Hashmap from SELECT
upvote count: 5
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/25827035
score: 5

http://stackoverflow.com/comment/40471031
has text: Beat me to it. I'd make that the answer @NeilLunn
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25862979
score: 0

http://stackoverflow.com/q/25860571
downvote count: 0
has body: I have created Three classes- User, UserSubscription and Subscription. I want that users in the UserSubscription table should be referenced by the users existing in the User table. So, how to use mappedBy? The classes are as follows: User: package com.model; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.OneToOne; @Entity public class User { private int userId; private String password; private String contact; private String firstName; private String lastName; private String gender; private String address; private int age; private String email; private String countBooks; private Set&lt;Language&gt; languages = new HashSet&lt;Language&gt;(0); private Set&lt;Book&gt; favorites = new HashSet&lt;Book&gt;(0); @Id @GeneratedValue @Column(name="User_Id") public int getUserId() { return userId; } public void setUserId(int userId) { this.userId = userId; } @Column(name="Password") public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Column(name="Contact") public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } @Column(name="First_Name") public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } @Column(name="Last_Name") public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } @Column(name="Gender") public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } @Column(name="Address") public String getAddress() { return address; } public void…
has answer: http://stackoverflow.com/a/25870839
has title: MappedBy in a OneToOne Mapping
favorite count: 0
type: UnansweredQuestion
tagged with: hibernate-mapping
has answer: http://stackoverflow.com/a/25860699
answer count: 4
score: 3
has answer: http://stackoverflow.com/a/25860717
upvote count: 3
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/25860701
tagged with: jpa

http://stackoverflow.com/q/25778603
has body: I am using Spring MVC in my project and while mapping user request to a URI, I get the 404 error. But there are other controllers where i'm able to access it. Working controller @RequestMapping(value = "groupview.htm", method = RequestMethod.GET) public String showGroups( @ModelAttribute("groupRegistrationDTO") GroupRegistrationDTO groupRegistrationDTO, BindingResult result, Model model, HttpServletRequest httpServletRequest) { GroupsResultDTO groupsResultDTO = manageGroupBusiness.getGroups( groupRegistrationDTO, result, model); return "showGroups"; } Testing with java class showing desired output private static void wsRequest(String jsonInput) { try { URL url = new URL("http://localhost:5080/myservlet/groupview.htm"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("POST"); conn.setRequestProperty("Accept","*/*"); conn.setRequestProperty("Authorization", "Basic " + getBasicAuthenticationEncoding()); if (conn.getResponseCode() != 200) { throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode()); } BufferedReader br = new BufferedReader(new InputStreamReader( (conn.getInputStream()))); String output; System.out.println("Output from Server .... \n"); while ((output = br.readLine()) != null) { System.out.println(output); } conn.disconnect(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } Now i have another controller which is a restful service when i try to test that using poster plugin or through java net URL connection(using requestmethod post). I get 404 response code. Trying to access with URL : http://localhost:5080/myservlet/authAndRegDevice.htm Rest Service Controller @RequestMapping(value = "authAndRegDevice.htm", method = RequestMethod.POST) @ResponseBody public String authenticateAndRegisterDevice( @RequestBody String notificationJsonRequest){ return "success"; } Why would the second controller give the 404 error while the first one wo…
has comment: http://stackoverflow.com/comment/40356758
type: Question
has comment: http://stackoverflow.com/comment/40316765
has comment: http://stackoverflow.com/comment/40317755
has answer: http://stackoverflow.com/a/25800666
has title: Accessing Spring Rest with 404 error
score: 0
has comment: http://stackoverflow.com/comment/40316352
has comment: http://stackoverflow.com/comment/40316715
answer count: 1
has comment: http://stackoverflow.com/comment/40325881
has comment: http://stackoverflow.com/comment/40316777
has comment: http://stackoverflow.com/comment/40316633
accepted answer: http://stackoverflow.com/a/25800666
tagged with: spring
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25800657
tagged with: java

http://stackoverflow.com/comment/40358766
score: 0
comment on: http://stackoverflow.com/q/25801623
type: Comment
type: QuestionComment
has text: are you using normal java serialization or you're literally implementing TCP protocols and sending it over the network?

http://stackoverflow.com/a/25848574
score: 2
accepted answer of: http://stackoverflow.com/q/25848195
has body: AsyncTask runs as a separate thread. A BroadcastReceiver usually runs on the main thread, unless you specify otherwise in 'registerReceiver' (see here: http://developer.android.com/reference/android/content/Context.html#registerReceiver(android.content.BroadcastReceiver,%20android.content.IntentFilter,%20java.lang.String,%20android.os.Handler) ) You can either use a Vector as Budius wrote, or wrap all access to the ArrayList with a synchronized block: synchronized(myList){ myList.add(itemToAdd); }
has comment: http://stackoverflow.com/comment/40444612
answers question: http://stackoverflow.com/q/25848195
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/25742741
answer count: 2
accepted answer: http://stackoverflow.com/a/25743109
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/40250420
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25743109
downvote count: 1
possible better answer: http://stackoverflow.com/a/25743111
type: Question
has answer: http://stackoverflow.com/a/25743111
has body: My problem is very strange for me and concerns java language. I created interface and 2 classes. In the interface I created 2 object's: public static final MyInterface obA and obB. And in the each of classes I created array which stores these objects. If I want to display array of first class, I can't see any objects. In second class i see only firts object. My code: public class ROpole implements IDevices { private static IDevices rOpole = IDevices.rOpole; private static IDevices rGdańsk = IDevices.rGdańsk; private IDevices [] connectedWith = {rGdańsk, null}; ... } public class RGdańsk implements IDevices { private static IDevices rOpole = IDevices.rOpole; private static IDevices rGdańsk = IDevices.rGdańsk; private IDevices [] connectedWith = {rOpole, null, null}; ... } public interface IDevices { public static final IDevices rOpole = new ROpole(); public static final IDevices rGdańsk = new RGdańsk(); ... } My result if I want to display objects: rOpole: Connected with: null, null. rGdańsk: Connected with: Model.ROpole@74a14482, null, null. I don't know why object's are invisible in these arrays. My method which display a objects: public String getInfoAboutDevice() { String informationsAboutDevice = ""; informationsAboutDevice += "Connected with: "; for(int count = 0; count &lt; connectedWith.length; count++) { if(count == interfaces.length - 1) informationsAboutDevice += connectedWith[count] + "."; else informationsAboutDevice += connectedWith[count] + ", "; } informationsAboutDevice += "\n"; return informationsAboutDevice; }
tagged with: java
score: -1
tagged with: eclipse
has title: Eclipse can't see objects in the array

http://stackoverflow.com/q/25725040
tagged with: java
type: Question
tagged with: spring-security
has title: Spring Security with dynamic roles management
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 3
answer count: 0
has body: I am currently migrating from Struts1/EJB3 to Spring MVC 4.0.4/EJB3. Application server is JBoss 4.2.3 (JBoss 7.x in the works). My current security roles are stored in the database (for instance: administrator, validator and officer). For each role, admins can check or uncheck features (use cases) they want members to have access to (add a new file, update a file, delete a file, etc.). I also have a "method" table in which all my "secured" features are stored (add a new file, update a file, delete a file, etc.). My application must have a user management and a role management, so application owners (admins) can add user and roles, and also make changes to existing roles if necessary. There is no login form. Login sequence goes like this: Create an HTTP Session. Gather current user ID from JCIFS. Search user in Active Directory. If found in AD, look for a user record in the user table. If found in database, sync user details with AD (from step 4). Gather roles from database and set them into user's session. Redirect to application's home page. I would like to get the benefits from Spring Security and at the same time offer the flexibility my clients are used to have with their applications. Any hints would be much appreciated. Thank you
upvote count: 3

http://stackoverflow.com/comment/40286214
has text: So how does CoffeeGenerator extend or implement Generator.Does it use Coffee as type parameter while extending/implemening Generator
score: 0
comment on: http://stackoverflow.com/q/25762308
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25745775
has title: JavaFX application not running from command line / how to build and export correctly?
score: 0
tagged with: javafx-8
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25755719
tagged with: ant
tagged with: java
has body: I did a lot of reading for hours, but can´t find any thread for this SPECIFIC problem. I have build a basic JavaFX application with Scenebuilder 2.0 and Eclipse Luna. It consists of a main class, an empty css and a primitive controller class, that does the action for one button right now. The application was exported to a jar and should run under Linux/Suse with JRE 1.6 installed and maybe Windows 1.7. On the development PC I have JRE 1.8 installed and JDK 1.7. The application was exported for JRE 1.6 on the Linunx System. I made a Jar and wanted to start the application by typing java -jar <pathToMyApp/jarname.jar> "Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application" So I read, that you can´t normally export a jar with rightlick export and so on, if you want to start it with the commandline (Linux or Windows, doesn´t matter). Double-clicking works, commandline doesn´t. So I used the AntScript that comes with a JavaFX project: build.fxbuild. I set the name parameters and so on and clicked "ant build.xml and run" Error in Console: (Only one entry, actually there are 52): [javac] warning: C:\Program Files (x86)\Java\jre8\lib\ext\jfxrt.jar(javafx/application/Application.class): major version 52 is newer than 51, the highest major version supported by this compiler. [javac] It is recommended that the compiler be upgraded. BUILD FAILED ****\****\****\JavaFXTest\build\build.xml:84: Problem: failed to create task or type javafx:com.sun.javafx.tools.ant:resources Cause: The name is undefined. Action: Check the spelling. Action: Check that any custom tasks/types have been declared. Action: Check that any <presetdef>/<macrodef> declarations have taken place. No types or tasks have been defined in this namespace yet I did a lot of reading and only found that you should set the JAVA_HOME path to your JDK instead of the JRE. This leads to JavaFX not working correctly, no JavaFX specific tags are recognised. Ant script: (Now running) <?xml v…
tagged with: eclipse
type: Question
answer count: 1
tagged with: jar

http://stackoverflow.com/comment/40467591
score: 0
type: Comment
type: QuestionComment
has text: you need to have the spring framework bundles installed in karaf. We already have spring bundles supporting till version 3.2.4. But if you need bundles with higher versions, you need to convert it, for example http://www.gharki.com/2014/04/how-to-convert-spring-expression-to.html
comment on: http://stackoverflow.com/q/25747484

http://stackoverflow.com/comment/40213520
score: 0
type: Comment
has text: Wo wo wo Sorry everybody `Core.ellipse(mRgba, center, size, 0, 0, 360,new Scalar(255, 0, 255), 1, 8, 0);` is not any Swing component it comes from the `org.opencv.core.Core;` package I don't know how to prevent it to drawing it on screen ?
comment on: http://stackoverflow.com/a/25720430
type: AnswerComment

http://stackoverflow.com/q/25786880
tagged with: dialog
tagged with: java
has body: I have create a number picker using this code - Number Picker But the output looks something like this - But I want it to look something like - I want to display the Cancel and set buttons as given in image. But when I try this code, it shows error - The method setButton(int, String, Dialog) is undefined for the type Dialog. Dialog noPicker = new Dialog(MainActivity.this); noPicker.setButton(Dialog.BUTTON_POSITIVE, "Ok", noPicker); noPicker.setButton(Dialog.BUTTON_NEGATIVE, "Cancel", noPicker); Any ideas on how to resolve this?
has comment: http://stackoverflow.com/comment/40330516
type: Question
has answer: http://stackoverflow.com/a/25789558
answer count: 2
tagged with: picker
has comment: http://stackoverflow.com/comment/40331148
score: 0
has answer: http://stackoverflow.com/a/25787191
tagged with: android
linked to: http://stackoverflow.com/q/17805040
type: UnansweredQuestion
has title: Number Picker With Alert Dialog Like Buttons
has comment: http://stackoverflow.com/comment/40330490

http://stackoverflow.com/q/25790854
upvote count: 1
type: Question
tagged with: ipc
has comment: http://stackoverflow.com/comment/40349835
answer count: 1
downvote count: 0
has title: Android: Implementing a synchronous/blocking API using Messengers for IPC
favorite count: 0
tagged with: android-handler
has answer: http://stackoverflow.com/a/29824241
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40340650
has body: I have a background service that runs in its own separate process using android:process=":deamon" In the manifest entry for the service. I want to communicate with the the service (remote process) from my activity and receive data from it. I'm doing that by sending messages to and from the remote process as described in http://developer.android.com/guide/components/bound-services.html#Messenger and as they suggested I followed If you want the service to respond, then you need to also create a Messenger in the client. >Then when the client receives the onServiceConnected() callback, it sends a Message to the >service that includes the client's Messenger in the replyTo parameter of the send() method. The thing is, I need to provide a blocking/synchronous API to get data from my remote service, how can my "get" function block the caller and then return the data received in my incoming Handler ? What would be the best approach to do that ?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40341661

http://stackoverflow.com/comment/40420423
type: AnswerComment
comment on: http://stackoverflow.com/a/25835122
has text: post the logcat error message and is the data coming to list from intent?
type: Comment
score: 0

http://stackoverflow.com/comment/40201480
has text: Do you prefer work with primitive types or wrapper types?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25716126
type: Comment

http://stackoverflow.com/q/25771654
has answer: http://stackoverflow.com/a/25970818
answer count: 1
downvote count: 0
tagged with: neo4j
favorite count: 0
has body: @RelatedToVia in Spring-Data-Neo4j annotates a field on a NodeEntity object as a reference to a @RelationshipEntity object connecting that node to another node. @RelatedTo, in contrast, marks the field as a reference to the connected node itself, and has an optional type parameter that can be used to specify the type of relationship between the two nodes. @RelationshipEntity(type="SOME_LINK") class SomeLink { @StartNode FooNode foo; @EndNode BarNode bar; } @NodeEntity class FooNode { @RelatedTo(type="SOME_LINK") BarNode bar; @RelatedToVia(type="SOME_LINK") //what's the point in this annotation? SomeLink link; } @RelatedToVia has the same optional type parameter, and I'm curious about why that is: The type of relationship is specified in the field type (a field annotated with @RelatedToVia must be typed to a @RelationshipEntity-annotated class, which must specify a type to compile), so what would be the point of specifying it in the annotation parameter? Even more confusingly, @RelatedToVia also has an optional elementClass parameter that, according to the docs, "returns the target relationship entity class" - which is exactly what's specified in the field type. @RelatedToVia(elementClass=SomeLink.class) //what's the point? SomeLink link; @RelatedToVia(elementClass=SomeOtherLink.class) // ???? SomeLink link; I'm curious because I have a hunch that this was intended to enable some useful polymorphic behavior with RelationshipEntity classes and RelatedToVia fields, and I'd love to see an example of how such behavior might be implemented. As a bonus, what different sorts of behaviors can be achieved using the two different annotations? Also, it seems curious that both these parameters exist for (possibly redundantly) specifying the type of the relationship, while no parameter exists for specifying the class of the node on the other end of the relationship - which can be but isn't necessarily declared in the RelationshipEntity class, and which would have been useful to m…
tagged with: spring-data-neo4j
accepted answer: http://stackoverflow.com/a/25970818
tagged with: spring
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: spring-data
type: Question
has title: Why does @RelatedToVia have optional type and elementClass parameters?

http://stackoverflow.com/q/25806885
has answer: http://stackoverflow.com/a/25806988
tagged with: eclipse
score: 0
accepted answer: http://stackoverflow.com/a/25806988
answer count: 1
has title: Empty the internal DCIM Folder - Android Java
tagged with: android
tagged with: storage
type: AnsweredQuestion
tagged with: java
type: Question
has body: Hy, I want to empty the internal Folder "/storage/emulated/0/DCIM/Camera" This works for me with the following code public void emptyDir() { File dir = new File("/storage/emulated/0/DCIM/Camera"); if (dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i &lt; children.length; i++) { new File(dir, children[i]).delete(); Log.i(logTag,"Path " +dir +" cleared"); } } } Can I access/read this path without hardcode it? The code to Capture my Picture: I think most of the code is pretty clear what i meant to do because i always try to comment anything I do even if I'm just testing something new. I hope that I can show what i created with this one. public void takePhoto() { //Set the size of the Picture Parameters params = mCamera.getParameters(); params.setPictureSize(640, 480); mCamera.setParameters(params); //Befehl um die möglichen Auflösungen auszuwählen/aufzulisten //List&lt;Camera.Size&gt; sizes = params.getSupportedPictureSizes(); //Take the Picture mCamera.takePicture(null, null, mPicture); //SLEEP "sleeper value" SECONDS HERE ... Handler handler = new Handler(); handler.postDelayed(new Runnable() { public void run() { releaseCamera(); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); preview.removeAllViews(); activateCamera(); } }, sleeper); } /** * Creates and Instance of Camera and adds CameraView to * camera_preview FrameLayout */ public void activateCamera() { // Create an instance of Camera mCamera = getCameraInstance(); // Create our Preview view and set it as the content of our activity. mPreview = new CameraPreview(this, mCamera); FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); preview.addView(mPreview); } final PictureCallback mPicture = new PictureCallback() { public void onPictureTaken(byte[] data, Camera camera) { File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE); if (pictureFile == null) { return; } try { FileOutputStream fos = new FileOutputStream(pictureFile); fos.write(data); fos.clos…
tagged with: camera

http://stackoverflow.com/q/25847356
tagged with: android
has body: I was wondering if it's possible in android to embed an application into in another application. In this way you can have control of the embed application and you can add some other functionalities thanks to the parent application. EDIT : To be more accurate, I would like to have an application (parent application ) which can overlay the content of another application (embed application) without losing control of the parent application. Thank you,
possible better answer: http://stackoverflow.com/a/25847474
favorite count: 0
has title: Embed android application into other android application (Overlay + Events)
has answer: http://stackoverflow.com/a/25847474
linked to: http://stackoverflow.com/q/25642077
has comment: http://stackoverflow.com/comment/40441363
has comment: http://stackoverflow.com/comment/40441463
upvote count: 1
has comment: http://stackoverflow.com/comment/40441444
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40441536
score: 1
tagged with: java
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40441825
downvote count: 0
has answer: http://stackoverflow.com/a/25848006
has comment: http://stackoverflow.com/comment/40441927
accepted answer: http://stackoverflow.com/a/25848006

http://stackoverflow.com/q/25738792
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has body: My enum looks like this : public enum SignMethod { MICROSOFT("Microsoft"),XML("Xml"),HDR("Hdr"),JAVA1("Java1"); private final String name; private ArrayList&lt;Server&gt; servers = new ArrayList&lt;&gt;(); private HashSet&lt;String&gt; fileTypes = new HashSet&lt;&gt;(); public static void main(String... args) { System.out.println(MICROSOFT.getName()+" "+MICROSOFT.getServers()+ " " + MICROSOFT.getFileTypes()); System.out.println(ServerAndSignMethodInitialiser.getServers(SignMethod.MICROSOFT)); System.out.println(SignDataInitialiser.getFileTypesList(SignMethod.MICROSOFT)); } private SignMethod(String name) { this.name = name; this.servers = ServerAndSignMethodInitialiser.getServers(this); System.out.println(servers); this.fileTypes = SignDataInitialiser.getFileTypesList(this); System.out.println(fileTypes); } } I am trying to initialise servers variable through a static initialiser class which has a Map that maps from SignMethod enum to ArrayList of servers. But when I am printing the servers right after initialisation in constructor, its printing null. Is there some problem in passing "this" in constructor to other method. public static ArrayList&lt;Server&gt; getServers(SignMethod signMethod) { System.out.println(signMethod); return signmethodToServerMap.get(signMethod); } When I am prinitng signMethod in getServers method its printing alright as "MICROSOFT" etc.
type: Question
has comment: http://stackoverflow.com/comment/40243884
has comment: http://stackoverflow.com/comment/40243565
tagged with: enums
has comment: http://stackoverflow.com/comment/40243589
upvote count: 1
has title: Initialising Enum variables in constructor
answer count: 1
has answer: http://stackoverflow.com/a/25739333
accepted answer: http://stackoverflow.com/a/25739333
favorite count: 0
has comment: http://stackoverflow.com/comment/40244469

http://stackoverflow.com/comment/40465735
type: Comment
comment on: http://stackoverflow.com/a/25860461
score: 0
type: AnswerComment
has text: That's interesting, and thank you for your post(+1), but it still doesn't work for me. I'm suspecting it's the driver problem mentioned by Andrew, still downloading an updated driver

http://stackoverflow.com/a/25743004
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25742913
has body: If you have some process listening on port 8080 then you can always configure tomcat to listen on a different port. To change the listener port by editing your server.xml located under tomcat server conf directory. Search for Connector port="8080" in server.xml and change the port number to some other port.

http://stackoverflow.com/comment/40380801
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25807636
has text: If you solved it, then you should post your solution here, for the benefit of any future users with a similar problem.
score: 1

http://stackoverflow.com/q/25851906
type: Question
answer count: 2
has body: I am installing HANA Studio and I have JDK 1.8 and JDK 1.7 downloaded. I use JDK 1.8 for Eclipse and some other things I am working on however when I try to install HANA Studio through the SAP HANA Lifecycle Management application, I am met with an error saying that JDK 1.8 can be find and the others cannot. Below are the scenarios I have gone through before attempting another reinstall...without a successful: -Downloaded 1.6 and 1.7 -Deleted all JDK/JRE's in windows explorer, re-downloaded just 1.6 and 1.7 -gone into Control Panel > Java > Add JDK > navigated to 1.6 -gone into Control Panel > Java > Add JDK > navigated to 1.7 What else do you think I should try? I need to get this within the next 2 days please. Thank you!!
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25886277
tagged with: hana
tagged with: java
has answer: http://stackoverflow.com/a/32226765
has title: I am installing HANA Studio and I have JDK 1.8 and JDK 1.7 downloaded. How do I point the HANA Studio install towards JDK 1.7?

http://stackoverflow.com/q/25829245
type: AnsweredQuestion
tagged with: java
upvote count: 1
has title: Is my syntax for java exponentiation wrong?
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25829258
has comment: http://stackoverflow.com/comment/40408517
has comment: http://stackoverflow.com/comment/40408528
tagged with: math
has body: I am trying to calculate the area of a triangle using Heron's formula, but I think I'm doing something wrong in the Math.pow function because as soon as I add it, my print statements no longer work and the program fails to compile. This is what I have: public class Challenge { public static void main( String[] args ) { double a; a = triangleArea(3, 3, 3); System.out.println("A triangle with sides 3,3,3 has an area of:" + a); a = triangleArea(3, 4, 5); System.out.println("A triangle with sides 3,4,5 has an area of:" + a); a = triangleArea(9, 9, 9); System.out.println("A triangle with sides 9,9,9 has an area of:" + a ); } public static double triangleArea( int a, int b, int c ) { double area; double s = (a+b+c)/2; s= (s*(s-a)*(s-b)*(s-c)); area= Math.pow(double s,double b=.5) // this line has the error return area; } } The compiler lists the following errors: Challenge.java:22: error: '.class' expected area= Math.pow(double s,double b=.5) // this line has the error ^ Challenge.java:22: error: ';' expected area= Math.pow(double s,double b=.5) // this line has the error ^ Challenge.java:22: error: ';' expected area= Math.pow(double s,double b=.5) // this line has the error ^ 3 errors What do these errors mean? How do I fix them?
has comment: http://stackoverflow.com/comment/50556386
accepted answer: http://stackoverflow.com/a/25829258
score: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40408530

http://stackoverflow.com/q/25713157
upvote count: 81
has title: Generate int unique id as android notification id
tagged with: android
has answer: http://stackoverflow.com/a/41122403
has comment: http://stackoverflow.com/comment/40194973
has comment: http://stackoverflow.com/comment/40194928
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/77839482
has answer: http://stackoverflow.com/a/42159687
has answer: http://stackoverflow.com/a/51949277
tagged with: java
type: Question
answer count: 8
has body: When I send multiple push notifications, I need them to be all shown in the notification bar ordered by the time sent desc. I know I should use unique notification - I tried to generate random number but that did not solve my problem since I need them to be ordered. I tried to use AtomicInt and still don't have the desired result. package com.mypackage.lebadagency; import java.util.concurrent.atomic.AtomicInteger; import android.app.IntentService; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.graphics.Color; import android.os.Bundle; import android.os.SystemClock; import android.support.v4.app.NotificationCompat; import android.util.Log; import android.widget.RemoteViews; import com.google.android.gms.gcm.GoogleCloudMessaging; public class GCMNotificationIntentService extends IntentService { private AtomicInteger c = new AtomicInteger(0); public int NOTIFICATION_ID = c.incrementAndGet(); private NotificationManager mNotificationManager; NotificationCompat.Builder builder; public GCMNotificationIntentService() { super("GcmIntentService"); } public static final String TAG = "GCMNotificationIntentService"; @Override protected void onHandleIntent(Intent intent) { Bundle extras = intent.getExtras(); GoogleCloudMessaging gcm = GoogleCloudMessaging.getInstance(this); String messageType = gcm.getMessageType(intent); if (!extras.isEmpty()) { if (GoogleCloudMessaging.MESSAGE_TYPE_SEND_ERROR .equals(messageType)) { sendNotification("Send error: " + extras.toString()); } else if (GoogleCloudMessaging.MESSAGE_TYPE_DELETED .equals(messageType)) { sendNotification("Deleted messages on server: " + extras.toString()); } else if (GoogleCloudMessaging.MESSAGE_TYPE_MESSAGE .equals(messageType)) { for (int i = 0; i &lt; 3; i++) { Log.i(TAG, "Working... " + (i + 1) + "/5 @ " + SystemClock.elapsedRealtime()); try { Thread.sleep(5000); } catch (Interrup…
score: 81
has answer: http://stackoverflow.com/a/25713229
has answer: http://stackoverflow.com/a/58786832
possible better answer: http://stackoverflow.com/a/39205848
has answer: http://stackoverflow.com/a/39205848
tagged with: push-notification
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25713229
has answer: http://stackoverflow.com/a/51031245

http://stackoverflow.com/a/33944379
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25774309
has body: You can have two properties for the same column like this : @JoinColumn(name = "CGRADO_CODIGO", referencedColumnName = "CGRADO_CODIGO") @ManyToOne @NotFound(action=NotFoundAction.IGNORE) private SipreGrado sipreGrado; @Column(name = "CGRADO_CODIGO",insertable=false,updatable=false) private String sipreGradoCodigo; Your output in the inspect code will be like this : sipreGradoCodigo "001" sipreGrado null or sipreGradoCodigo "001" sipreGrado Entity SipreGrado ["001","other property","etc"] Remember if you have sometimes the entity NULL you can skip it with that annotation @NotFound(action=NotFoundAction.IGNORE) Also,Remember to set insertable=false,updatable=false for the one that you dont want to include in the insert/update queries.
upvote count: 1

http://stackoverflow.com/comment/40236298
comment on: http://stackoverflow.com/q/25734828
type: Comment
score: 0
has text: lets say I have 1 2 3 4 5 6 7 7 7 7, when deleting 7, the new array should only contain 6 entries instead of 10
type: QuestionComment

http://stackoverflow.com/comment/40258883
comment on: http://stackoverflow.com/a/25735851
has text: @EricDarchis is correct, in the startActivity method you pass the intent variable ie. intent with lowercase i
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25939932
answers question: http://stackoverflow.com/q/25863150
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42286795
type: Answer
has body: Actually, I found the solution. I found that using assetmanager is unneccessary. The problem of lagging was due to using 1024px x 1024px images for TextureAtlas and Animation. I had to lower the resolution of it.. Found out that using TextureAtlas,findRegion, and Animation is very inefficient after all. Loading images separately via assetmanager seems to be better solution for animation. I will post another answer when I get to the point.
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25863150

http://stackoverflow.com/a/79479987
has body: A solution that never caused the error again for me was to use: import java.util.Scanner; String arbritraryString =""; int arbritraryInteger =0; boolean temporaryCondition =false; Scanner keyboard =new Scanner(System.in); do{ try{ arbritraryString =keyboard.nextLine(); arbritraryInteger =Integer.parseInt(arbritraryString); /* The rest of your code */ temporaryCondition =false; }catch(NumberFormatException e){System.err.println("error"); temporaryCondition =true;} }while(temporaryCondition);
type: Answer
answers question: http://stackoverflow.com/q/25714629
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/29814439
answers question: http://stackoverflow.com/q/25729319
has comment: http://stackoverflow.com/comment/60006616
score: 5
upvote count: 5
downvote count: 0
has body: The short answer is that the implementation is part of Sun's internal workings and not available through public means. getURLs() will only ever return the URLs that are passed in. There is a longer answer but it is only for the daring. Stepping through Oracle JVM 8 with the debugger has led me through pretty much an identical structure as OpenJDK6 and you can see where it loads the class path here. Basically, the class loader keeps a stack of URLs it has not yet parsed into memory. When asked to load a class it will pop URLs off the stack, load them as class files or jar files, and if they are jar files it will read the manifest and push class path entries onto the stack. Each time it processes a file it adds the "loader" which loaded that file to a loader map (if nothing else, to ensure it doesn't process the same file multiple times). You can access this map if you are really motivated to do (would not recommend it) with: Field secretField = URLClassLoader.class.getDeclaredField("ucp"); secretField.setAccessible(true); Object ucp = secretField.get(loader); secretField = ucp.getClass().getDeclaredField("lmap"); secretField.setAccessible(true); return secretField.get(ucp); Running that on a dummy setup where I have dummy-plugin.jar which references external.jar (in the manifest of dummy-plugin.jar) I get the following: 1) Immediately after creating the class loader (before loading any class): urlClassLoader.getURLs()=[file:.../dummy-plugin.jar] getSecretUrlsStack=[file:.../dummy-plugin.jar] getSecretLmapField={} 2) After loading a class from dummy-plugin.jar: urlClassLoader.getURLs()=[file:.../dummy-plugin.jar] getSecretUrlsStack=[file:.../external.jar] getSecretLmapField={file:.../dummy-plugin.jar=sun.misc.URLClassPath$JarLoader@736e9adb} 3) After loading a class from external.jar: urlClassLoader.getURLs()=[file:.../dummy-plugin.jar] getSecretUrlsStack=[] getSecretLmapField={file:.../dummy-plugin.jar=sun.misc.URLClassPath$JarLoader@736e9adb, file:.../external.jar=s…
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25729319
type: Answer

http://stackoverflow.com/a/25794581
downvote count: 0
has comment: http://stackoverflow.com/comment/40346581
has comment: http://stackoverflow.com/comment/40346811
has body: Doesn't each servlet would have only one instance of it in a web container? No, that is not always true. The web container manages the lifecycle of servlets (it is responsible for creating and managing instances of servlets). The Java EE specification does not guarantee that there will be only one instance of your servlet class, so you should not write your servlets in a way that depend on this. As the description explains, the web container might make multiple instances of your servlet class to efficiently and concurrently handle requests if your servlet implements SingleThreadModel. It is better to write your servlet in such a way that it does not need to implement SingleThreadModel - write your servlet code in a thread-safe way.
type: Answer
has comment: http://stackoverflow.com/comment/40345263
answers question: http://stackoverflow.com/q/25794520
has comment: http://stackoverflow.com/comment/40347106
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25794520
type: AcceptedAnswer

http://stackoverflow.com/q/25736778
has body: I'm making a program that uses LWJGL to render a Display window, and it also listens for keyboard input to prompt it to open a swing window. The problem is, upon the first keyboard prompt, it opens the window successfully. But when you close it and try it again, it seems the LWJGL window 'sticks' down the key you just pressed and instead starts opening up infinite new Swing windows... I'm not sure how to resolve this issue. Here is some code to demonstrate my problem... public class Launcher{ public static void main(String[] args){ new Launcher(); } public Launcher(){ loadGUI(); go(); } public void go(){ while(!Display.isCloseRequested()){ listen(); glClear(GL_COLOR_BUFFER_BIT); Display.update(); Display.sync(60); } } private void listen(){ if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)){ System.out.println("fk"); Example e = new Example(); } } private void loadGUI(){ try{ Display.setDisplayMode(new DisplayMode(480,480)); Display.setTitle("Example"); Display.create(); }catch(LWJGLException e){ e.printStackTrace(); Display.destroy(); System.exit(1); } glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrtho(0, 480, 480, 0, 1, -1); glMatrixMode(GL_MODELVIEW); } private class Example extends JFrame{ public Example(){ add(new JPanel(), BorderLayout.NORTH); pack(); setResizable(true); setTitle("Test"); setVisible(true); } } }
answer count: 0
upvote count: 2
tagged with: opengl
tagged with: java
tagged with: swing
type: Question
score: 2
downvote count: 0
favorite count: 0
has title: Problem with opening JFrames from LWJGL
type: UnansweredQuestion

http://stackoverflow.com/comment/40437213
has text: i read that `getData` is used to store inside phone's memory or not?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25844755

http://stackoverflow.com/q/25835078
accepted answer: http://stackoverflow.com/a/25835122
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
tagged with: android-intent
has comment: http://stackoverflow.com/comment/40419375
linked to: http://stackoverflow.com/q/6087198
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40419116
upvote count: 1
type: Question
has title: sending and receiving Arraylist using intent? Android
tagged with: android-arrayadapter
has comment: http://stackoverflow.com/comment/40426439
has body: I'm trying to create a list of countries, that's to be added by the user during run time. I'm using intent &amp; adapter, and listview to show the countries. When the activity start"MyCountries"the user click on the button add country, a new activity will start" Add Country", my question here is why I can't see any country on the list? i'm I sending and receiving correctly? code for MyCountries: public class MyCountries extends Activity { private ListView lv; private ArrayAdapter&lt;String&gt; adapter; private ArrayList&lt;String&gt;list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_countries); //Button compute=(Button)findViewById(R.id.cancel); lv=(ListView)findViewById(R.id.listView1); list=new ArrayList&lt;String&gt;(); adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, list); lv.setAdapter(adapter); Intent i = getIntent(); list = i.getStringArrayListExtra("country&amp;year"); adapter.notifyDataSetChanged(); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.my_countries, menu); return true; } public void onClick(View v) { Intent intent = new Intent(v.getContext(), AddCountry.class); startActivityForResult(intent,1); } code for "AddCountry" public class AddCountry extends Activity { private EditText name; private EditText year; public String country_name; public int visited_year; public ArrayList&lt;String&gt;arr; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_country); name = (EditText) findViewById(R.id.country); year = (EditText) findViewById(R.id.year); arr= new ArrayList&lt;String&gt;(); Button button=(Button)findViewById(R.id.add); } public void onClick(View v) { switch (v.getId()) { case R.id.add: //Toast.makeText(this, "Add was clicke…
tagged with: listview
has answer: http://stackoverflow.com/a/25835122

http://stackoverflow.com/a/25794679
accepted answer of: http://stackoverflow.com/q/25794653
answers question: http://stackoverflow.com/q/25794653
type: Answer
upvote count: 6
has body: Yes, the project will be machine-dependent. If the native library/code cannot be linked to by that JVM (for example, if you have a Windows JVM and an ELF/.so library, or a 32-bit JVM and 64-bit library), then System.loadLibrary(String) will fail with an UnsatisfiedLinkError.
score: 6
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40361092
score: 0
has text: i have found this question, but there is ask statement in ant build file(?), and my is in java class
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25803018

http://stackoverflow.com/q/25806174
possible better answer: http://stackoverflow.com/a/25806415
has answer: http://stackoverflow.com/a/25806415
has comment: http://stackoverflow.com/comment/40366082
score: 0
has comment: http://stackoverflow.com/comment/40366103
type: AnsweredQuestion
has body: I am trying to write a function, which will return an integer in range 1...9, based on input. But i cannot figure out how to control the correct result, so if user inputs a number outside of range 1 to 9 then it gives error. Here is my code: public static int pmove() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String br_rl = br.readLine(); int br_int = Integer.parseInt(br_rl); if (br_int &gt; 0 &amp;&amp; br_int &lt; 10) { return br_int; } else { // ??? } }
has answer: http://stackoverflow.com/a/25806206
tagged with: java
has answer: http://stackoverflow.com/a/25806533
type: Question
accepted answer: http://stackoverflow.com/a/25806206
answer count: 3
has title: How to throw error in user input?

http://stackoverflow.com/q/25754850
tagged with: maven
score: 2
has body: I don't directly use Apache CXF in my code. I didn't even have it as a dependency. Now when upgrading to WebLogic 12c I get this exception. I previously got some other errors related to extracting a soap message body, which I got around after adding the saaj dependencies below. org.apache.cxf cxf-bundle-jaxrs ${cxf-version} org.apache.cxf cxf-api ${cxf-version} org.apache.cxf cxf-rt-transports-http ${cxf-version} org.apache.cxf cxf-rt-ws-policy ${cxf-version} com.sun.xml.messaging.saaj saaj-impl 1.3.15 javax.xml.soap saaj-api 1.3.5 Error: java.lang.NoClassDefFoundError: org/apache/cxf/jaxrs/impl/UriBuilderImpl at org.apache.cxf.jaxrs.impl.RuntimeDelegateImpl.createUriBuilder(RuntimeDelegateImpl.java:89) at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:69) at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:80) at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:99) at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:649) at javax.servlet.http.HttpServlet.service(HttpServlet.java:844) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3367) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333) at weblogic.security.acl.internal.Auth…
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25796384
downvote count: 0
tagged with: cxf
tagged with: java
type: Question
upvote count: 2
tagged with: weblogic
has answer: http://stackoverflow.com/a/25796384
answer count: 1
tagged with: soap
favorite count: 0
has title: java.lang.NoClassDefFoundError: org/apache/cxf/jaxrs/impl/UriBuilderImpl

http://stackoverflow.com/comment/40466517
has text: @user2864740 what am a supposed to use then?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25860893
type: QuestionComment

http://stackoverflow.com/comment/40473468
has text: This issue is resolved. The problem was in my.cnf file. in the my.cnf file the default character set was latin1. which i changed to UTF8 and it worked.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25746200

http://stackoverflow.com/comment/59605275
score: 5
has text: Just an FYI for folks who are using this with GWT, I had to set "allowedHeaders" to "*" as well. Without it, GWT would complain `Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9876' is therefore not allowed access.`
type: Comment
comment on: http://stackoverflow.com/a/25801822
type: AnswerComment

http://stackoverflow.com/q/25815654
tagged with: solr
type: Question
has answer: http://stackoverflow.com/a/25815887
has title: SOLR FunctionQuery performance
has body: So have a SOLR query in which one of the fq's is a FunctionQuery See http://wiki.apache.org/solr/FunctionQuery This is one of my fq's {!frange l=1}or(and(exists(not(query({!v='type:scu'}))), or(or(termfreq(nba,184887),termfreq(nba,15817823),termfreq(nba,15819703),termfreq(nba,15821195),termfreq(nba,15859845),termfreq(nba,15860041), ...and 2000 other termfreq() calls))),exists(query({!v='isn_field:400112'})),exists(query({!v='(type:scu AND (is_svad:(20332 OR 21017 OR 200662 OR 23 OR 2685 OR 653 OR 266035 OR 267 OR 26612 OR 566127 OR 264129 OR 266133)))'}))) My question is, how does the performance of this FunctionQuery compare to if I'm not using a FunctionQuery, eg if instead of having the function or(termfreq(nba, number), termfreq(nba, number)) statements I just do solr query OR (nba:number1 OR nba:number2 OR nba:number3 ...etc)? Is there a way to further optimize that FunctionQuery such that it becomes faster?
tagged with: lucene
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25815887
upvote count: 1
tagged with: search-engine
has comment: http://stackoverflow.com/comment/40398009
type: AnsweredQuestion
tagged with: performance
score: 1
tagged with: java

http://stackoverflow.com/a/25747645
has body: Swing Timers can also fire action events. You just need to do a class check in the code : public void actionPerformed(ActionEvent e){ if (e.getSource() instanceof (JButton)) { JButton button = (JButton) e.getSource(); if(button.getText().equals("Start")){ timer.start(); }else if(button.getText().equals("Stop")){ timer.stop(); }else if(button.getText().equals("Circle")){ shapes[count] = new Circle(); drawPanel.repaint(); count++; } }else (e.getSource() instanceof (Timer)) { //deal with timer } }
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25747473
answers question: http://stackoverflow.com/q/25747473
upvote count: 1
type: AcceptedAnswer

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

http://stackoverflow.com/comment/40428080
has text: You dont pass email by intent, below passing name put this: intent.putExtra("email", email);
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25839486
type: Comment

http://stackoverflow.com/q/25753615
tagged with: http-headers
has answer: http://stackoverflow.com/a/46445519
has comment: http://stackoverflow.com/comment/40271067
has comment: http://stackoverflow.com/comment/40271718
has answer: http://stackoverflow.com/a/48642479
answer count: 2
linked to: http://stackoverflow.com/q/496651
downvote count: 0
has title: 401 Unauthorized Error using HttpURLConnection Android?
has comment: http://stackoverflow.com/comment/40273407
favorite count: 0
linked to: http://stackoverflow.com/q/15020734
has comment: http://stackoverflow.com/comment/40272598
linked to: http://stackoverflow.com/q/20505207
tagged with: android
has comment: http://stackoverflow.com/comment/56496557
has comment: http://stackoverflow.com/comment/40273490
has comment: http://stackoverflow.com/comment/40272624
has comment: http://stackoverflow.com/comment/40271346
has body: We have searched and searched and still cannot seem to get a resolution to this issue. We have a REST web service and are trying to access it from our Android app. The web service URL work when accessed from a web browser or from the Advanced Rest Client extension in Chrome. Our URL looks like: http://10.52.1.1:8080/GPService/Tenants(Name=DefaultTenant)/Companies(Fabrikam,%20Inc.)/Items(128%20SDRAM).JSON And once this is typed into the browser we are prompted for credentials. After credentials are entered, the JSON result is returned. In our Android app we are trying the following: Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("domain\\user", "password".toCharArray()); } }); URL url = new URL(urlstring); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setDoOutput(false); conn.setDoInput(true); conn.setRequestMethod("GET"); conn.setConnectTimeout(60000); InputStream istream = conn.getInputStream(); Any ideas what we are doing wrong? We tried different methods, similar to this Connecting to remote URL which requires authentication using Java and http://www.muneebahmad.com/index.php/archives/127 but with no success at all, we are constantly getting the 401 Unauthorized error. As per a comment received: our service is using NTLM authentication. Thanks for any help!
type: UnansweredQuestion
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
upvote count: 1
tagged with: http
type: Question
has comment: http://stackoverflow.com/comment/40271107

http://stackoverflow.com/comment/69665117
type: Comment
comment on: http://stackoverflow.com/a/25813398
score: 1
has text: Mind if I ask where the number `100000` comes from in the while loop?
type: AnswerComment

http://stackoverflow.com/a/25794345
has body: In general, it is fine to call the public methods. The thing to consider is what the interface of the Car should be. In this case, does preventCollision() belong in the Car class or in some other CollisionPrevention class. Breaking your code multiple classes each with a single responsibility, and then using them a bigger class like Car, is generally a good idea.
answers question: http://stackoverflow.com/q/25794066
score: 0
type: Answer

http://stackoverflow.com/comment/40478616
type: QuestionComment
has text: Duplicated question. Solution for you: http://stackoverflow.com/a/13640110/3728901
type: Comment
comment on: http://stackoverflow.com/q/25867580
score: 0

http://stackoverflow.com/q/25730278
tagged with: jdbc
has comment: http://stackoverflow.com/comment/41538446
linked to: http://stackoverflow.com/q/4645434
has comment: http://stackoverflow.com/comment/40766561
has body: I have a client who uses a FoxPro database that I need to read/write. I know that most suggestions will be to 'Replace FoxPro', but that is not an option here. I have tried using JStels DBF JDBC Driver, and JavaDBF Framework to write to the DBF Files. Both of these work, but it encounters an error on the other end requiring a re-index of the FoxPro table. It seems that neither of these existing frameworks allow re-indexing a CDX File. I have also looked into XBaseJ but it explicitly states that it does not support FoxPro Indexes so I didn't pursue it any further. Does anyone know of a way that I can accomplish writing into a FoxPro DBF file, then forcing the table to rebuild the Index (CDX)?
has comment: http://stackoverflow.com/comment/40269312
tagged with: foxpro
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/26448207
has comment: http://stackoverflow.com/comment/40231668
type: Question
has title: Write to FoxPro Database from Java
has comment: http://stackoverflow.com/comment/40232623
score: 0
tagged with: read-write
answer count: 1

http://stackoverflow.com/comment/40317215
has text: As I stated in my question, the JAR I created doesn't had any of the dependecies , still it worked well. Thats why I got puzzled?
comment on: http://stackoverflow.com/a/25779060
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25808525
type: Answer
answers question: http://stackoverflow.com/q/25805426
upvote count: 1
score: 1
has body: If i did understood you correctly you wanna find the file extensions , here is sample application I made for you using swing worker , you can now scan your entire computer with specific file extensions you defined in program currently it finds html , txt and pdf you can modify that. Here is the entire project package Create Scan Worker Class Like this below and fix the imports using IDE public class ScanWorker extends SwingWorker&lt;Void, String&gt; { ResultFrame helperv; int finalTotal = 0; String str3; public String status; public ScanWorker(ResultFrame x) { finalTotal = 0; helperv = x; helperv.jTarea.setText(""); } @Override protected Void doInBackground() throws Exception { helperv.jTarea.replaceSelection("Scanning..." + "\n"); Thread.sleep(100); callMainScan(); return null; } @Override protected void process(List&lt;String&gt; chunks) { for (String str : chunks) { helperv.jTarea.append(str); helperv.scanlabel.setText(str); } } @Override protected void done() { helperv.scanlabel.setText("Total Number of Files Matched: " + Integer.toString(finalTotal)); } private void callMainScan() throws IOException { String[] myStringArray = new String[3]; myStringArray[0] = "*.txt"; myStringArray[1] = "*.html"; myStringArray[2] = "*.pdf"; File[] paths; paths = File.listRoots(); try { for (File path : paths) { String str = path.toString(); String slash = "\\"; String s = new StringBuilder(str).append(slash).toString(); Path startingDir = Paths.get(s); for (String stre : myStringArray) { String pattern = stre; Finder finder = new Finder(pattern); Files.walkFileTree(startingDir, finder); finder.done(); } } } catch (IOException e) { System.out.println("Exception occured"); } } public class Finder extends SimpleFileVisitor&lt;Path&gt; { private final PathMatcher matcher; private int numMatches = 0; Finder(String pattern) { matcher = FileSystems.getDefault() .getPathMatcher("glob:" + pattern); } // Compares the glob pattern against // the file or directory name. void find(Path file…
downvote count: 0

http://stackoverflow.com/q/25832004
favorite count: 0
possible better answer: http://stackoverflow.com/a/25834454
has answer: http://stackoverflow.com/a/25832775
has body: I have the following maven project structure: src --main ----java ------de --------mxcd --------foodster ----------Test.java ----------hans.txt Using this code I get a NullPointerException public class Test { public static void main(String[] args) { InputStream ins = Test.class.getResourceAsStream("hans.txt"); Properties p = new Properties(); try { p.load(ins); } catch (IOException e) { e.printStackTrace(); } System.out.println(p.getProperty("100")); } } This doesn't happen when I change my project structure to src --de ----mxcd ------foodster --------Test.java --------hans.txt Why is this so? As far as I know, getResourceAsStream() looks for the file relative to the classes positition, so it shouldn't make a difference wheather I am using /src/de/mxcd... or src/main/java/de/mxcd...
tagged with: maven
accepted answer: http://stackoverflow.com/a/25832775
tagged with: properties
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25834454
tagged with: intellij-idea
has title: getResourceAsStrem with maven structure
answer count: 2
downvote count: 0

http://stackoverflow.com/comment/40481569
has text: I would suggest not using the eclipse maven plugin to generate the eclipse config files but rather use m2e to enable the maven plugin to work correctly in eclipse
comment on: http://stackoverflow.com/q/25869266
score: 2
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40410454
has text: @LuiggiMendoza I'm afraid somebody probably will do this homework - the odds are against your prediction.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25830263
type: QuestionComment

http://stackoverflow.com/a/25774141
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40344937
has body: if you are using it in main make it static and i would use logger like this private static final Logger LOG = Logger.getLogger(Main.class.getSimpleName());
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25774099
has comment: http://stackoverflow.com/comment/40342684
answers question: http://stackoverflow.com/q/25774099

http://stackoverflow.com/a/25729620
downvote count: 0
has comment: http://stackoverflow.com/comment/99972204
has comment: http://stackoverflow.com/comment/99972502
upvote count: 31
has body: I'll expand my comment a little bit. One problem that can occur if you use asList as it wasn't different from ArrayList object: List&lt;Object&gt; list = Array.asList(array) ; list.remove(0); // UnsupportedOperationException :( Here you cannot remove the 0 element because asList returns a fixed-size list backed by the specified array. So you should do something like: List&lt;Object&gt; newList = new ArrayList&lt;&gt;(Arrays.asList(array)); in order to make the newList modifiable.
has comment: http://stackoverflow.com/comment/107220575
type: Answer
answers question: http://stackoverflow.com/q/25729553
score: 31
has comment: http://stackoverflow.com/comment/107222051

http://stackoverflow.com/q/25792778
tagged with: java
has comment: http://stackoverflow.com/comment/40341672
answer count: 3
upvote count: 0
has comment: http://stackoverflow.com/comment/40342017
score: -2
has answer: http://stackoverflow.com/a/25793627
favorite count: 0
has comment: http://stackoverflow.com/comment/40341852
has answer: http://stackoverflow.com/a/25792923
has comment: http://stackoverflow.com/comment/40342223
has title: In Java, how can I load parameters from files?
has comment: http://stackoverflow.com/comment/40342455
accepted answer: http://stackoverflow.com/a/25793627
downvote count: 2
type: Question
has body: I want my program to take numerical parameters from a file. My situation is weird, so here's an example: This hypothetical program will have a database of countries. The user will pick a country. Each country is a folder kept in the same directory as the .class files. In these folders are text files. So if I wanted to get the percentage of Japan's population that is Christian, my program would access the /Japan/religions.txt file, then find the entry that says "Christianity: 12.4%". How can I make it dynamically access files like this? The main thing is I need to get the number for any category of data. Does anyone understand what I'm saying and have the know-how to help me out?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25792906
has answer: http://stackoverflow.com/a/25792906

http://stackoverflow.com/comment/40342799
type: Comment
comment on: http://stackoverflow.com/a/25776762
has text: @Sash_KP..thanks for reply again...but that means that I have to resize all my images ...right ???...I thought there might be the code that will automatically fit my image under the frame...
score: 0
type: AnswerComment

http://stackoverflow.com/a/25800391
has body: In your webservice create a checker, like an integer success where if its 1 it successfully queried but if 0 it didn't query. Retrieve it in your asynctask then check in post execute if success == 1 go to dashboard if success == 0 call dialog. Btw try using the new android Volley for networking as AsyncTask is prone to memory leaks. Cheers! :)
has comment: http://stackoverflow.com/comment/40363980
score: 0
answers question: http://stackoverflow.com/q/25799954
has comment: http://stackoverflow.com/comment/40356997
type: Answer

http://stackoverflow.com/a/25714589
has comment: http://stackoverflow.com/comment/40198161
score: 1
upvote count: 1
type: AcceptedAnswer
has body: No, there's no difference in the examples you gave. However, using new int[] allows you to separate the declaration and initialisation, as in: int[] arr; ... arr = new int[] { 1, 2, 3 }; whereas arr = {1, 2, 3}; would not be allowed.
type: Answer
accepted answer of: http://stackoverflow.com/q/25714563
downvote count: 0
answers question: http://stackoverflow.com/q/25714563

http://stackoverflow.com/comment/40212045
type: Comment
has text: you could try only setSize
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25721899

http://stackoverflow.com/comment/40441793
has text: how would you expect them to look in JSON?
score: 1
comment on: http://stackoverflow.com/q/25847561
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25737843
upvote count: 1
type: Question
tagged with: java
score: -1
has title: How to add Node<Integer> list to get average?
tagged with: nodes
has comment: http://stackoverflow.com/comment/40241929
has answer: http://stackoverflow.com/a/25737884
has answer: http://stackoverflow.com/a/25737883
has answer: http://stackoverflow.com/a/25737897
favorite count: 0
has body: I am supposed to create a method that calculates the average. I can't figure out why i am having so much trouble. My list has a set of random numbers generated but i keep getting an error in my method saying " Exception in thread "main" java.lang.ArithmeticException: / by zero at Node.avg(Node.java:58) at Node.main(Node.java:51)" public class Node&lt;T&gt; { private T data; // data portion private Node&lt;T&gt; next; // link to next node public Node(T dataPortion) { data = dataPortion; next = null; } // end constructor public Node(T dataPortion, Node&lt;T&gt; nextNode) { data = dataPortion; next = nextNode; } // end constructor public T getData() { return data; } // end getData public void setData(T newData) { data = newData; } // end setData public Node&lt;T&gt; getNextNode() { return next; } // end getNextNode public void setNextNode(Node&lt;T&gt; nextNode) { next = nextNode; } // end setNextNode public static void main(String[] args) { Integer num; LList&lt;Integer&gt; firstNode = new LList&lt;Integer&gt;(); for (int counter = 0; counter &lt; 5; counter ++) { num = new Integer((int)(Math.random() * 100)); firstNode.add(num); avg(firstNode); } } public static int avg(LList&lt;Integer&gt; firstNode) { int count = 0, total = 0; int avg = total/count; for (int i = 1; i &lt; 5; i++) { total += ((ListInterface&lt;Integer&gt;) firstNode).getEntry(i); count++; } return avg;
has comment: http://stackoverflow.com/comment/40241986
answer count: 4
tagged with: linked-list
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/25737880

http://stackoverflow.com/comment/40446203
has text: Is the phone number a floating point value or why do you use `BigDecimal` instead of `BigInteger`?
score: 1
comment on: http://stackoverflow.com/q/25849818
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40206883
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25719311
type: Comment
has text: I am not using AppCompat, but i tried call setStyle(STYLE_NO_FRAME, R.style.AppTheme);. Nothing changed

http://stackoverflow.com/a/25752194
has body: Cloning only provides a shallow copy, despite some of the previous recommendations. A common solution to the deep copy problem is to use Java Object Serialization (JOS). The idea is simple: Write the object to an array using JOS’s ObjectOutputStream and then use ObjectInputStream to reconstitute a copy of the object. The result will be a completely distinct object, with completely distinct referenced objects. JOS takes care of all of the details: superclass fields, following object graphs, and handling repeated references to the same object within the graph. Figure 3 shows a first draft of a utility class that uses JOS for making deep copies. import java.io.IOException; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; /** * Utility for making deep copies (vs. clone()'s shallow copies) of * objects. Objects are first serialized and then deserialized. Error * checking is fairly minimal in this implementation. If an object is * encountered that cannot be serialized (or that references an object * that cannot be serialized) an error is printed to System.err and * null is returned. Depending on your specific application, it might * make more sense to have copy(...) re-throw the exception. * * A later version of this class includes some minor optimizations. */ public class UnoptimizedDeepCopy { /** * Returns a copy of the object, or null if the object cannot * be serialized. */ public static Object copy(Object orig) { Object obj = null; try { // Write the object out to a byte array ByteArrayOutputStream bos = new ByteArrayOutputStream(); ObjectOutputStream out = new ObjectOutputStream(bos); out.writeObject(orig); out.flush(); out.close(); // Make an input stream from the byte array and read // a copy of the object back in. ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream(bos.toByteArray())); obj = in.readObject(); } catch(IOException e) { e.printStackTrace(…
has comment: http://stackoverflow.com/comment/40268258
score: 0
answers question: http://stackoverflow.com/q/25752062
type: Answer

http://stackoverflow.com/a/25716195
has body: You forgot scanner.nextLine(); thats reason its not asking you enter anything. Instead of usersInput = userInput.toString(); Use: String usersInputStr = scanner.nextLine(); Follow this link - for how to use scanner: How can I read input from the console using the Scanner class in Java?
score: 2
answers question: http://stackoverflow.com/q/25716174
downvote count: 0
type: Answer
upvote count: 2

c#
tags question: http://stackoverflow.com/q/25864831
tag name: c#
tags question: http://stackoverflow.com/q/25824666
tags question: http://stackoverflow.com/q/25793856
tags question: http://stackoverflow.com/q/25808003
tags question: http://stackoverflow.com/q/25859085
tags question: http://stackoverflow.com/q/25846938
tags question: http://stackoverflow.com/q/25815908
tags question: http://stackoverflow.com/q/25765679
type: Tag
tags question: http://stackoverflow.com/q/25825028
tags question: http://stackoverflow.com/q/25741819
tags question: http://stackoverflow.com/q/25754469

http://stackoverflow.com/comment/40253789
comment on: http://stackoverflow.com/q/25744441
score: 0
type: Comment
type: QuestionComment
has text: You should use `JavaScriptObjects` http://stackoverflow.com/questions/9499831/how-to-genearte-json-on-the-client

http://stackoverflow.com/comment/40333798
has text: Never saw option. Using. NetBeans.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25740832
type: Comment

http://stackoverflow.com/comment/40932891
type: Comment
has text: so so so so good , thank you so much, in this way I can check my Android app method
comment on: http://stackoverflow.com/a/25835398
score: 0
type: AnswerComment

http://stackoverflow.com/a/25723615
upvote count: 5
has comment: http://stackoverflow.com/comment/40217294
has comment: http://stackoverflow.com/comment/40302943
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25723446
has body: Easiest and fastest way would be to have the file as a static web resource file, under the WEB-INF folder and on application startup, have a context listener to load the file into memory. In memory, it should be a Map, mapping from a key you want to search by. This will allow you like a constant access time. Memory consumption would only matter if it is really big. A hundred thousand record for example not worth optimizing if you need to access this many times. The static file should be plain text format or CSV, they are read and parsed most efficiently. No need XML formatting as parsing it would be slow. If the list is really big, you can break it up into multiple, smaller files, and only parse those and only when they are required. A reasonable, easy partitioning would be to break it up by country, but any other partitioning would work (like based on its name using the first few characters from its name). You could also consider building this Map in the memory once, and then serialize this map to a binary file, and include that binary file as a static resource file, and that way you would only have to deserialize this Map and would be no need to parse/process it as a text file and build objects yourself. Improvements on the data file An alternative to having the static resource file as a text/CSV file or a serialized Map data file would be to have it as a binary data file where you could create your own custom file format. Using DataOutputStream you can write data to a binary file in a very compact and efficient way. Then you could use DataInputStream to load data from this custom file. This solution has the advantages that the file could be much less (compared to plain text / CSV / serialized Map), and loading it would be much faster (because DataInputStream doesn't use number parsing from a text for example, it reads the bytes of a number directly).
score: 5
accepted answer of: http://stackoverflow.com/q/25723446

http://stackoverflow.com/q/25850234
has answer: http://stackoverflow.com/a/25853538
tagged with: struts2
has comment: http://stackoverflow.com/comment/40446747
answer count: 2
downvote count: 0
has body: One of my project is running on Struts 1.x and We are trying to integrate few of URL's pattern on struts 2.x. Few URL also end with Abc.do . Currently web.xml looks like: action org.apache.struts.action.ActionServlet config /WEB-INF/struts-config.xml action *.do And above pattern working fine as defined in web.xml. Now we have added in web.xml to support Struts 2.x parallel. struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 *.action After added above info in web.xml , those URL pattern ends with .action they are also working fine using struts 2.x. But when we want to add few specific URL pattern which also ends with .do mapped to Struts 2.x as below. struts2 /Hello.do We want all request which starts with Hello*.do should mapped on struts 2.x , but right now this is not happening. So is am something missing here in web.xml or Altogether it is not possible. Is there any way apart we can solve this issue?
favorite count: 0
type: UnansweredQuestion
tagged with: deployment-descriptor
tagged with: regex
has comment: http://stackoverflow.com/comment/40447259
has title: URL pattern issue with Struts 1.x and Struts 2.x
has comment: http://stackoverflow.com/comment/40462438
score: 1
tagged with: xml-configuration
upvote count: 1
has answer: http://stackoverflow.com/a/25976637
type: Question
tagged with: java

http://stackoverflow.com/comment/82966585
has text: this snippet is incomplete, since the codeGenerator variable cannot be resolved. is the corresponding class written in java? since java method names do have a different naming convention.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/42958172
score: 1

http://stackoverflow.com/comment/40257940
comment on: http://stackoverflow.com/q/25745799
score: 0
type: Comment
type: QuestionComment
has text: It seems to me that you´ve got kind of mess of imports or dependencies not noticeable in compile time but they´re killing your app as bytecode executes. Looks like the code is expecting the class it was compiled with (there you should look for the error) and gets the other.

http://stackoverflow.com/comment/40450314
comment on: http://stackoverflow.com/a/25832430
type: Comment
score: 0
has text: I have made the database already as i have stated in the comment above, I do not want to waste time making tables in the program itself as it contains at least 150+ items. The table is already made on a workspace which i can access after logging in to my SYSTEM profile. If you could look into the structure of oracle 11g database that would be great. Sorry for bad question, I'm very new to jdbc and stack overflow. If you need more screenshots or information i am happy to upload
type: AnswerComment

http://stackoverflow.com/comment/40331911
score: 1
comment on: http://stackoverflow.com/q/25787711
type: Comment
type: QuestionComment
has text: There is a class called BigInteger

http://stackoverflow.com/q/25804935
has title: jQuery Editable DataTable get value from Struts Action
tagged with: datatable
has comment: http://stackoverflow.com/comment/40364098
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am using jQuery editable datatable to show and edit data (in cell editing). On server side I am using Struts 2. On server side I am checking few conditions before updating cell value. If some conditions fails then I have to put corresponding message in response object and on client side take action according to message value or show proper message to user. My jsp page code : .makeEditable({ sUpdateURL: "editEntry", "aoColumns": [ null, null, { indicator: 'Saving...', tooltip: 'Click to edit '+$("#editLabel").val()+' name', type: 'textarea', submit:'Save changes', fnOnCellUpdated: function(sStatus, sValue, settings){ alert("Entry Updated"); }, } ], }); My Struts Action Class: public class EditMinistryAction extends ActionSupport{ private String value; private String message; @Override public String execute(){ //few conditions checking return SUCCESS; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } public String getMessage() { return message; } } I have checked response object through browser plugins, It is having my desired messages, but my problem is where to write the code to parse response object? Which function of editable datatable I have to override? Thanks in advance...
has comment: http://stackoverflow.com/comment/40364289
tagged with: javascript
tagged with: jquery
tagged with: struts2
has comment: http://stackoverflow.com/comment/40364522
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25864439
possible better answer: http://stackoverflow.com/a/25864589
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25864538
tagged with: http://stackoverflow.com/tag/csv
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25864589
type: Question
answer count: 2
linked to: http://stackoverflow.com/q/22927124
has body: I'm using csvWriter, the code i'm using it works. Is It possible create a csv with multiple pages, like Excel files? Here you are the specifics about the project. List&lt;BookEvent&gt; listBooks = new ArrayList&lt;BookEvent&gt;(); for (ExaClass examp : examps) { listBooks.add(new BookEvent(examp.getExample(), examp.getExample2(), examp.getExampleN())); } String filename = UUID.randomUUID().toString(); FileWriter file = new FileWriter(filename); ICsvBeanWriter csvWriter = new CsvBeanWriter(file, CsvPreference.STANDARD_PREFERENCE); String[] header = {"Example1", "Example2", "ExampleN"}; csvWriter.writeHeader(header); header = new String[]{"example1", "example2", "exampleN"}; for (BookEvent aBook : listBooks) { csvWriter.write(aBook, header); } csvWriter.close();
accepted answer: http://stackoverflow.com/a/25864538
has title: csvWriter java: Create csv with multiple pages

http://stackoverflow.com/q/25784438
linked to: http://stackoverflow.com/q/12888169
has comment: http://stackoverflow.com/comment/40327370
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25785178
type: Question
has title: Android Gridview Smooth scrolling with button
tagged with: button
has body: I am currently making a part of my app to select multiple images from gallery using Gridview. The PROBLEM is that I need to put a button on the first item and the rest will be images (the 0,0 will be button and the rest well, imageview with check box) That button will be using the phone camera. I was able to make it, but in exchange, it is not scrolling smoothly, is there a way to fix this? below is my code: @Override public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; View view; System.out.println(position); if (position == 0) { holder = new ViewHolder(); view = getLayoutInflater().inflate(R.layout.year_dropdownlayout, parent, false); holder.mButton = (Button) view.findViewById(R.id.mfreakingBtn); ViewGroup.LayoutParams params = holder.mButton.getLayoutParams(); params.height = 250; params.width = 250; holder.mButton.requestLayout(); } else { view = getLayoutInflater().inflate(R.layout.select_photos_layout, parent, false); holder = new ViewHolder(); holder.imageView = (ImageView) view.findViewById(R.id.imageView1); holder.mCheckBox = (CheckBox) view.findViewById(R.id.checkBox1); holder.mCheckBox.setOnCheckedChangeListener(mCheckedChangeListener); holder.progressBar = (ProgressBar) view.findViewById(R.id.progress); holder.mButton = null; view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "You Clicked " + position, Toast.LENGTH_LONG).show(); } }); imageLoader.displayImage("file://" + imageUrls.get(position), holder.imageView, options, new SimpleImageLoadingListener() { @Override public void onLoadingStarted(String imageUri, View view) { holder.progressBar.setProgress(0); holder.progressBar.setVisibility(View.VISIBLE); } @Override public void onLoadingFailed(String imageUri, View view, FailReason failReason) { holder.progressBar.setVisibility(View.GONE); } @Override public void onLoadingComplete(String …
score: 0
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/25785178
tagged with: gridview

http://stackoverflow.com/comment/40281610
type: QuestionComment
has text: @JaeHeonLee I'm looking for this option so that if I'll need to add some functionality to A in the future - I won't need to change the code of C....
type: Comment
comment on: http://stackoverflow.com/q/25759594
score: 0

http://stackoverflow.com/comment/40240633
comment on: http://stackoverflow.com/a/25736847
type: AnswerComment
score: 0
type: Comment
has text: I am fetching row from a HBase Table byte [] row1 = Bytes.toBytes(rowid); Get g = new Get(row1); Result result = table.get(g); byte[] value = result.getValue(Bytes.toBytes("columnfamily"), Bytes.toBytes("columnname")); But when printing System.out.print(value.length); I am getting 4

http://stackoverflow.com/q/25823976
upvote count: 2
type: UnansweredQuestion
downvote count: 2
tagged with: multithreading
has answer: http://stackoverflow.com/a/25824052
tagged with: java
has title: Why getting ArrayIndexOutOfBoundsException?
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/40398985
score: 0
favorite count: 0
has body: Giving me correct output but sometime getting IndexOutOFBound Exception.....Not able to get what reordering is done by the compiler? package com.array.thread; import java.util.concurrent.*; public class EvenOddProcessor { public static void main(String[] args) { CyclicBarrier barrier = new CyclicBarrier(6, new Runnable() { @Override public void run() { System.out.println("BARRIER BROKEN!!!"); } }); int[] array = new int[10]; for (int i = 0; i &lt; array.length; i++) array[i] = i; ArrayIndexProcessor evenIndexProcessor = new ArrayIndexProcessor(array, 0, barrier); ArrayIndexProcessor oddIndexProcessor = new ArrayIndexProcessor(array, 1, barrier); Thread t1 = new Thread(evenIndexProcessor, "Even_1"); Thread t2 = new Thread(evenIndexProcessor, "Even_2"); Thread t3 = new Thread(evenIndexProcessor, "Even_3"); t1.start(); t2.start(); t3.start(); Thread t4 = new Thread(oddIndexProcessor, "Odd_1"); Thread t5 = new Thread(oddIndexProcessor, "Odd_2"); Thread t6 = new Thread(oddIndexProcessor, "Odd_3"); t4.start(); t5.start(); t6.start(); System.out.println("&gt;&gt;&gt;&gt;&gt; Main thread is done"); } } class ArrayIndexProcessor implements Runnable { private final CyclicBarrier barrier; private final int[] array; private volatile int currentPtr = 0; private Lock lock = new ReentrantLock(); public ArrayIndexProcessor(int[] array, int startIndex, CyclicBarrier barrier) { this.array = array; this.currentPtr = startIndex; this.barrier = barrier; } public void run() { try { barrier.await(); } catch (InterruptedException | BrokenBarrierException e) { e.printStackTrace(); } while (!(array.length == 0) &amp;&amp; (currentPtr &lt; array.length)) { lock.lock(); try { System.out.println(Thread.currentThread().getName() + "=" + array[currentPtr]); currentPtr = currentPtr + 2; } finally { lock.unlock(); } } } }
has comment: http://stackoverflow.com/comment/40398982

http://stackoverflow.com/a/25906161
has comment: http://stackoverflow.com/comment/40624206
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/25870723
upvote count: 0
has body: It's exactly what I want but I rather use this below to get a vertical alignment : // set the LayoutManager to GridLayout and use a Grid of 1 x buttons.length p.setLayoutManager(new GridLayout(1, buttons.length)); Thanks everyone.
score: -1

http://stackoverflow.com/comment/40237795
type: QuestionComment
has text: can't see a acceptable char array parameter in vicCheck() method
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25735685

http://stackoverflow.com/q/25782488
has answer: http://stackoverflow.com/a/25782700
has comment: http://stackoverflow.com/comment/40323214
score: 0
has comment: http://stackoverflow.com/comment/40323041
favorite count: 0
has body: I need to develop web application. This application will implement web-based terminal for some application server (this project will provide alternative thin and cross-platform web-based client instead of windows-only binary client). I understand than using ajax for communicating with app.server is not correct, because we need to be more real-time. So we need something more asynchronous than ajax. I planned to use web sockets. But my application need to communicate with remote application server too. Existing implementation is based on TCP. So we have to use this existing protocol specification. I can imagine how to connect to remote server when new web-socket connection is accepted. And I know web-socket implementation is easy because it's event driven. However I know classic java socket is stream based, and I have to read from stream and my code will be blocked until some data appears from remote side. So code will not be able to respond to another events. I see one way to make it correct - use threads for classic sockets. But I don't know if it's correct for web java application. Please suggest me any way.
type: UnansweredQuestion
has title: Java WebSocket and TCP Socket communication
tagged with: sockets
upvote count: 1
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/40323922
downvote count: 1
type: Question
answer count: 1
tagged with: websocket

http://stackoverflow.com/comment/40369363
type: QuestionComment
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25801272
has text: MUTUAL AUTHENTICATION for what protocol? Do you do a SELECT by AID?

http://stackoverflow.com/comment/40388903
has text: @LuiggiMendoza : I'm not sure to understand how I should use this observation to improve my code with minor changes, could you give me a hint ?
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25816588
type: AnswerComment

multithreading
tags question: http://stackoverflow.com/q/25773045
tags question: http://stackoverflow.com/q/25741323
tags question: http://stackoverflow.com/q/25813990
tags question: http://stackoverflow.com/q/25872985
tags question: http://stackoverflow.com/q/25743950
tags question: http://stackoverflow.com/q/25758436
tags question: http://stackoverflow.com/q/25731738
tags question: http://stackoverflow.com/q/25863255
type: Tag
tags question: http://stackoverflow.com/q/25741262
tags question: http://stackoverflow.com/q/25854858
tags question: http://stackoverflow.com/q/25825619
tags question: http://stackoverflow.com/q/25834704
tags question: http://stackoverflow.com/q/25753982
tags question: http://stackoverflow.com/q/25834245
tags question: http://stackoverflow.com/q/25868660
tags question: http://stackoverflow.com/q/25821149
tags question: http://stackoverflow.com/q/25835354
tags question: http://stackoverflow.com/q/25807900
tags question: http://stackoverflow.com/q/25729435
tags question: http://stackoverflow.com/q/25769740
tags question: http://stackoverflow.com/q/25862198
tags question: http://stackoverflow.com/q/25807390
tags question: http://stackoverflow.com/q/25751120
tags question: http://stackoverflow.com/q/25729764
tags question: http://stackoverflow.com/q/25850060
tags question: http://stackoverflow.com/q/25832726
tags question: http://stackoverflow.com/q/25823888
tags question: http://stackoverflow.com/q/25868972
tags question: http://stackoverflow.com/q/25722710
tags question: http://stackoverflow.com/q/25817242
tags question: http://stackoverflow.com/q/25832079
tags question: http://stackoverflow.com/q/25722743
tags question: http://stackoverflow.com/q/25714100
tags question: http://stackoverflow.com/q/25827856
tags question: http://stackoverflow.com/q/25740653
tags question: http://stackoverflow.com/q/25812721
tags question: http://stackoverflow.com/q/25830388
tags question: http://stackoverflow.com/q/25714178
tags question: http://stackoverflow.com/q/25785300
tags question: http://stackoverflow.com/q/25865972
tags question: http://stackoverflow.com/q/25728753
tags question: http://stackoverflow.com/q/25848644
tags question: http://stackoverflow.com/q/25772640
tags question: http://stackoverflow.com/q/25744446
tags question: http://stackoverflow.com/q/25753876
tags question: http://stackoverflow.com/q/25850569
tags question: http://stackoverflow.com/q/25751795
tags question: http://stackoverflow.com/q/25811732
tags question: http://stackoverflow.com/q/25771937
tags question: http://stackoverflow.com/q/25807724
tags question: http://stackoverflow.com/q/25855132
tags question: http://stackoverflow.com/q/25727011
tags question: http://stackoverflow.com/q/25822720
tags question: http://stackoverflow.com/q/25862411
tags question: http://stackoverflow.com/q/25803220
tags question: http://stackoverflow.com/q/25736346
tags question: http://stackoverflow.com/q/25730340
tags question: http://stackoverflow.com/q/25824663
tags question: http://stackoverflow.com/q/25801264
tags question: http://stackoverflow.com/q/25832778
tags question: http://stackoverflow.com/q/25838471
tags question: http://stackoverflow.com/q/25825596
tags question: http://stackoverflow.com/q/25729804
tags question: http://stackoverflow.com/q/25794232
tags question: http://stackoverflow.com/q/25729249
tags question: http://stackoverflow.com/q/25743290
tags question: http://stackoverflow.com/q/25820476
tags question: http://stackoverflow.com/q/25721283
tags question: http://stackoverflow.com/q/25853238
tags question: http://stackoverflow.com/q/25869223
tags question: http://stackoverflow.com/q/25742320
tags question: http://stackoverflow.com/q/25832159
tags question: http://stackoverflow.com/q/25716906
tags question: http://stackoverflow.com/q/25824604
tags question: http://stackoverflow.com/q/25782051
tags question: http://stackoverflow.com/q/25871763
tags question: http://stackoverflow.com/q/25728948
tags question: http://stackoverflow.com/q/25742997
tags question: http://stackoverflow.com/q/25738581

http://stackoverflow.com/comment/40317077
score: 0
type: Comment
type: QuestionComment
has text: so tell me what is wrong? at least post up some error code?
comment on: http://stackoverflow.com/q/25778963

http://stackoverflow.com/comment/40474929
score: 1
type: AnswerComment
has text: The functionality for comparing is implemented in the Integer-Class. So you should not implement your own solution (substraction). Use the compareTo method.
comment on: http://stackoverflow.com/a/25789128
type: Comment

http://stackoverflow.com/a/46686127
type: Answer
has body: No, Because a string in java can have maximum 2,147,483,647 (2^31 - 1) no of characters and all characters will vary so it will produce a very large no of combinations, but integer have only a range from -2,147,483,648 to 2,147,483,648. So it is impossible, and using this method the hash code of a string is computed s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1]. Example : If you create two string variables as "FB" and "Ea" there hash code will be same.
upvote count: 10
score: 10
answers question: http://stackoverflow.com/q/25736486
downvote count: 0

http://stackoverflow.com/a/25743185
upvote count: 1
answers question: http://stackoverflow.com/q/25742968
has body: You can use JSONObject and JsonArray for this as shown below JSONObject mainObj = new JSONObject(); JSONArray somearr = new JSONArray(); while (iter.hasnext()) { ClassName someObject=iter.next(); JSONObject jsonobj = new JSONObject(); jsonobj.put("id", id_from_someObject);; jsonobj.put("name", name_from_someObject); jsonobj.put("name", location_from_someObject);; somearr.put(seatObj); } mainObj.put("response",somearr); return mainObj.toString();
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/25742968

http://stackoverflow.com/q/25872637
has answer: http://stackoverflow.com/a/25888059
possible better answer: http://stackoverflow.com/a/42057772
favorite count: 0
answer count: 5
tagged with: spring
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/20120619
has title: Spring Data - Multi-column searches
has answer: http://stackoverflow.com/a/64160242
tagged with: java
accepted answer: http://stackoverflow.com/a/25888059
tagged with: spring-data
type: Question
has answer: http://stackoverflow.com/a/46302324
has body: I am using Spring Data for the paging and the sorting. However, I would like to perform multi-columns searches. Now, I am using the annotation @Query in my repository interface like this: public interface MyRepository extends PagingAndSortingRepository<Item,Long> { @Query(value="select mt from MY_TABLE mt where mt.field1 = %searchtext% or mt.field2 = %searchtext% or mt.field3 = %searchtext%") Page<Item> findByAllColumns(@Param("searchtext") String searchtext, Pageable pageable); } I would like to know if there is another way to do because the number of columns in a table can be high. Thanks for your help. edit (clarification of the question after the comment of Brandon Oakley): The problem in this solution is in the where clause of the @Query annotation because we have to repeat the exact same searchtext parameter for every column we want to search on
has comment: http://stackoverflow.com/comment/40494434
score: 18
has answer: http://stackoverflow.com/a/63284189
upvote count: 18
has answer: http://stackoverflow.com/a/42057772
has comment: http://stackoverflow.com/comment/40513488
tagged with: spring-data-jpa
linked to: http://stackoverflow.com/q/57112319
downvote count: 0
has comment: http://stackoverflow.com/comment/40513894

http://stackoverflow.com/comment/40490557
comment on: http://stackoverflow.com/q/25873446
has text: i believe both are same :)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40375038
type: QuestionComment
has text: I used Jaxb and if you change the type in xsd:decimal works fine ;)
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25810916

http://stackoverflow.com/comment/40232925
type: QuestionComment
has text: Is there a way in java to de-reference the pointer and pass the data at the end of it to a function? Or is that why I wrote a deep copy?
comment on: http://stackoverflow.com/q/25729804
score: 0
type: Comment

http://stackoverflow.com/q/25776803
has body: I have a stereo wave file that I need to read and play back only the selected channel. What is the best way to accomplish this?
has answer: http://stackoverflow.com/a/62141067
has title: JavaSound: Extract one channel of stereo audio
has answer: http://stackoverflow.com/a/25796085
type: AnsweredQuestion
score: 2
tagged with: audio
accepted answer: http://stackoverflow.com/a/25796085
downvote count: 0
tagged with: java
type: Question
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/62141067
favorite count: 0
tagged with: javasound

http://stackoverflow.com/comment/40228393
comment on: http://stackoverflow.com/q/25729804
type: Comment
type: QuestionComment
has text: Hi - Your analogy is a good one. In this case, "pass by value" means 1) You have an apple, 2) the JVM gave you a piece of paper where the apple is (a "reference"), 3) when you pass the apple, you *pass a copy of that piece of paper*. Q: Does that help?
score: 0

http://stackoverflow.com/comment/40348946
comment on: http://stackoverflow.com/a/25775820
type: AnswerComment
score: 0
type: Comment
has text: How do I accept it? It will not let me up vote it as mentioned previously as I do not have 15 reputation yet?

http://stackoverflow.com/q/25796362
has answer: http://stackoverflow.com/a/25796521
has comment: http://stackoverflow.com/comment/40348709
has answer: http://stackoverflow.com/a/25796611
tagged with: java
has comment: http://stackoverflow.com/comment/40348711
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40348799
has title: Display random month from a button click on android?
has comment: http://stackoverflow.com/comment/40349165
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
score: 0
has body: I am trying to create an app that lets the user click a button and it will display a random month. I have created a string array in my strings.xml file. Bellow is my main.java, strings.xml and activity.xml. I try to run the app and it just force closes. package com.example.datebutton; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.TextView; import android.graphics.Color; public class Main extends Activity { Button btn; @Override public void onCreate(Bundle b) { super.onCreate(b); setContentView(R.layout.activity_main); btn = (Button) findViewById(R.id.btn1); final String[] months = getResources().getStringArray(R.array.Months); final TextView tv =(TextView)findViewById(R.id.text1); btn.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { int rand = (int) (Math.random() * 12); tv.setText(months[rand]); } }); } } here is my activity.xml <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/text1" android:layout_width="68dp" android:layout_height="wrap_content" android:layout_gravity="center" android:gravity="center_vertical" android:text="@array/Months" /> here is my strings.xml <?xml version="1.0" encoding="utf-8"?> DateButton January Feburary March April May June July August September October November December I'm still getting errors and the app still says unfortunately your app closed. The logcat is below. 09-11 16:55:17.472: W/Resources(1638): Converting to string: TypedValue{t=0x1/d=0x7f0c0000 a=-1 r=0x7f0c0000} 09-11 16:55:17.512: D/AndroidRuntime(1638): Shutting down VM 09-11 16:55:17.512: W/dalvikvm(1638): threadid=1: thread exiting with uncaught exception (group=0xb3a8fba8) 09-11 16:55:17.532: E/AndroidRuntime(1638): FATAL EXCEPTION: main 09-11 16:55:17.532: E/AndroidRuntime(1638): Process: com.example.datebutton, PID: 1638 09-11 16:55:17.53…

http://stackoverflow.com/comment/64971953
type: AnswerComment
type: Comment
has text: API 23+ and above its not working Mr.Víctor Albertos, Can u explain how to do it, i refers some top reputation link regarding this issue, but not working, kindly help me, thanks in advance
comment on: http://stackoverflow.com/a/25754781
score: 0

http://stackoverflow.com/comment/40364983
type: QuestionComment
comment on: http://stackoverflow.com/q/25805452
score: 1
has text: A lot of ways: timer beans, schedulers. What was your attempt?
type: Comment

http://stackoverflow.com/a/25883019
score: 3
has body: I implement search-as-you-type using an indexed multi-property field populated with every fragment that "hits", similar to your "weird solution". The search query is an equality filter, plus an inequality filter on another field for sort ordering. This has the benefit of satisfying the 'advanced indexing' queries described here: https://developers.google.com/appengine/articles/indexselection ...thus you can filter on the field multiple times if the user types in multiple fragments. The equality queries are very efficient; the only downside is extra storage and indexing. Whether or not this is a problem depends on how many rows and how many fragments you're storing (and your budget). FWIW, all Lucene-based text search engines (Elasticsearch, Solr, etc) work pretty much just like this - they index a reverse mapping from analyzed token to document. In fact, you can use the Lucene analyzers every effectively to create your indexed fragments. Just make sure you analyze the query terms as well as the stored data.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40526292
upvote count: 3
has comment: http://stackoverflow.com/comment/40526092
type: Answer
accepted answer of: http://stackoverflow.com/q/25872497
downvote count: 0
answers question: http://stackoverflow.com/q/25872497
has comment: http://stackoverflow.com/comment/40533549

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

http://stackoverflow.com/comment/40445986
has text: Its works.. Somehow "set path=%path%;C:\SeleniumConfig;C:\Program Files (x86)\Java\jdk1.7.0_21\bin; " not overriding system path. In system path java 1.5 was set, so it picking same i.e 1.5. Now runnning command from JAVA_HOME\bin\javae.exe .. so it picks 1.7 java.
comment on: http://stackoverflow.com/q/25845916
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25824902
has answer: http://stackoverflow.com/a/25850022
favorite count: 0
has title: Spring Tool Suite 3.6.1 won't update
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27940677
has answer: http://stackoverflow.com/a/25829114
upvote count: 14
tagged with: eclipse-luna
has answer: http://stackoverflow.com/a/38798498
tagged with: java
type: Question
has body: Updating the Spring Tool Suite in Eclipse Luna, I get the following error since I turned off the option to download updates for Eclipse 3.7: **An error occurred while collecting items to be installed session context was:(profile=DefaultProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=). No repository found containing: osgi.bundle,org.springsource.ide.eclipse.commons.quicksearch,3.6.1.201408250654-RELEASE No repository found containing: osgi.bundle,org.springsource.sts,3.6.1.201408250824-RELEASE No repository found containing: org.eclipse.update.feature,org.springsource.ide.eclipse.commons.quicksearch.feature,3.6.1.201408250654-RELEASE No repository found containing: org.eclipse.update.feature,org.springsource.sts,3.6.1.201408250824-RELEASE No repository found containing: binary,org.springsource.sts.ide.executable.win32.win32.x86_64,3.6.1.201408250824-RELEASE-e43 No repository found containing: org.eclipse.update.feature,org.springsource.sts.package,3.6.1.201408250824-RELEASE-e43 No repository found containing: binary,org.springsource.sts.package_root,3.6.1.201408250824-RELEASE-e43** The version I have installed is: Spring Tool Suite Version: 3.6.0.RELEASE Build Id: 201407101106 Platform: Eclipse Luna (4.4)** Does anyone know how to fix this?
tagged with: spring-tool-suite
has answer: http://stackoverflow.com/a/38979563
score: 14
tagged with: spring-roo
downvote count: 0

http://stackoverflow.com/comment/40445716
type: Comment
has text: your json starts array->array->obj, not array->obj. why the unnecessary array?
type: QuestionComment
comment on: http://stackoverflow.com/q/25848665
score: 0

http://stackoverflow.com/q/25868574
has answer: http://stackoverflow.com/a/25868612
upvote count: 3
answer count: 5
has answer: http://stackoverflow.com/a/41996548
has body: I'm new to Java and I'm no sure how to do the following: A Scala application somewhere converts a String into bytes: ByteBuffer.wrap(str.getBytes) I collect this byte array as a Java String, and I wish to do the inverse of what the Scala code above did, hence get the original String (object str above). Getting the ByteBuffer as a String to begin with is the only option I have, as I'm reading it from an AWS Kinesis stream (or is it?). The Scala code shouldn't change either. Example string: String str = "AAAAAAAAAAGZ7dFR0XmV23BRuufU+eCekJe6TGGUBBu5WSLIse4ERy9............"; How can this be achieved in Java? EDIT Okay, so I'll try to elaborate a little more about the process: A 3rd party Scala application produces CSV rows which I need to consume Before storing those rows in an AWS Kinesis stream, the application does the following to each row: ByteBuffer.wrap(output.getBytes); I read the data from the stream as a string, and the string could look like the following one: String str = "AAAAAAAAAAGZ7dFR0XmV23BRuufU+eCekJe6TGGUBBu5WSLIse4ERy9............"; I need to restore the contents of the string above into its original, readable, form; I hope I've made it clearer now, sorry for puzzling you all to begin with.
has comment: http://stackoverflow.com/comment/40482079
possible better answer: http://stackoverflow.com/a/25868650
has answer: http://stackoverflow.com/a/25868946
downvote count: 0
tagged with: scala
has answer: http://stackoverflow.com/a/33949638
has comment: http://stackoverflow.com/comment/40511539
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40482590
score: 3
has comment: http://stackoverflow.com/comment/40479959
tagged with: java
has comment: http://stackoverflow.com/comment/40480452
type: Question
accepted answer: http://stackoverflow.com/a/25868612
has answer: http://stackoverflow.com/a/25868650
has title: How to convert a String-represented ByteBuffer into a byte array in Java
favorite count: 0
linked to: http://stackoverflow.com/q/13109588

http://stackoverflow.com/q/25820652
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/40393305
tagged with: java
has answer: http://stackoverflow.com/a/25820745
type: Question
has comment: http://stackoverflow.com/comment/40393345
tagged with: database
has title: ClassNotFoundException when connecting to Oracle Database
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40393297
tagged with: classnotfoundexception
has answer: http://stackoverflow.com/a/25820754
has body: I've written a simple Program to test if the Oracle databse connection works. I'm not doing it in netbeans or eclipse, I'm just writing it in notepad++ and compilation,run by command prompt. This is my program import java.sql.*; public class OracleCon{ public static void main(String args[]){ try{ Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORCL","SYSTEM","root"); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from user_details"); while(rs.next()){ System.out.println(rs.getString(1)+" "+rs.getInt(2)+" "+rs.getString(3)); } con.close(); }catch(Exception e){ System.out.println(e); } } } The error is ClassNotfoundexception oracle.jdbc.driver.oracledriver when running the program. I searched and found lot of suggestion in stackoverflow, even I set the class path in environment variables too. Still not working. So I've no other choice than creating this thread. I know solving these kind of problems will be very frustrating than solving errors in programs. I've worked with mysql previously, but this is my first time in Oracle database. My installed version is 12c.

http://stackoverflow.com/comment/119449759
score: 1
type: AnswerComment
type: Comment
has text: The original redirection response which had the token after the # is gone because after receiving 302, the browser is making a new GET request right? 1. In the GET request to the consumer.org/redirec_uri if the part after the hash that is token is not sent then when the JS will be returned by the consumer.org where will the JS find this "token" because the URL used to retrieve this JS doesn't have a token now? 2. If the IDP(OAuth) provider returned the token in the redirect URL then isn't that exposed to the internet? or the response headers are not exposed to the Internet?
comment on: http://stackoverflow.com/a/25786877

http://stackoverflow.com/q/25767120
tagged with: java
tagged with: active-directory
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25789692
has title: Unable to login to AD account with given password
tagged with: ldap
score: 0
has comment: http://stackoverflow.com/comment/40295232
has body: We have set up accounts for users with temporary passwords. The user receives the password through email and then is suppose to be able to log in with it. We have since fixed our previous problem of our passwords not meeting the AD requirements and are using defaults for testing. Here is the error we receive in the console. Please let me know if there is anything else that can be supplied. Thanks: Console 2014-09-10 13:25:32,685 [ajp-0.0.0.0-8009-4] ERROR com.util.ADUtil - Error building user from attributes java.lang.NumberFormatException: For input string: "exampletest" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at com.example.publicwebsite.example.account.util.ADUtil.buildAccount(ADUtil.java:742) at com.example.publicwebsite.example.account.util.ADUtil.searchForUsers(ADUtil.java:841) at com.example.publicwebsite.example.account.util.AccountUtil.searchForUsers(AccountUtil.java:157) at org.apache.jsp.public_.example.admin.searchActiveAccountsJson_jsp._jspService(searchActiveAccountsJson_jsp.java:77) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.jboss.web.tomcat.security.SecurityAssociationValv…
linked to: http://stackoverflow.com/q/25746662
has comment: http://stackoverflow.com/comment/40295058
accepted answer: http://stackoverflow.com/a/25789692
type: AnsweredQuestion

http://stackoverflow.com/comment/40202075
score: 3
has text: *"I assume it would go in the ActionListener method"* - That would be a good start, take a look at [Basic I/O](http://docs.oracle.com/javase/tutorial/essential/io/) for more details
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25716718

http://stackoverflow.com/comment/40262473
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25749160
has text: What kind of outcome you would expect then?

http://stackoverflow.com/a/50003139
has body: The accepted answer has the issue that the current request is not granted ie. only for the following requests the session is established! Therefore I needed to configure in point 2 public class MyAuthorizationFilter extends AbstractAuthenticationProcessingFilter { public MyAuthorizationFilter() { super( "/*" ); // allow any request to contain an authorization header } public Authentication attemptAuthentication( HttpServletRequest request, HttpServletResponse response ) throws AuthenticationException { if ( request.getHeader( "Authorization" ) == null ) { return null; // no header found, continue on to other security filters } // required to use the token myNewToken = new MyAuthorizationToken( request.getHeader( "Authorization" ) ); // and set in the current context ==&gt; the current request is as well authorized SecurityContextHolder.getContext().setAuthentication(myNewToken); // return a new authentication token to be processed by the authentication provider return myNewToken; } @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { // try to authenticate the current request attemptAuthentication((HttpServletRequest) req, (HttpServletResponse) res); super.doFilter(req, res, chain); } } otherwise the current request is not yet authenticated although a session is already created!!! (And the Providers I do not need, i.e. adding filter is sufficient.)
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25794680
upvote count: 1

http://stackoverflow.com/comment/40434906
type: Comment
type: QuestionComment
score: 0
has text: If the permissions are okay and the problem persists, then check that both the JVM and the compiled code are of the shame bit size (32 or 64). This shouldn't ever be a problem from within the GUI, but I guess you never know!?
comment on: http://stackoverflow.com/q/25843319

http://stackoverflow.com/q/25731344
accepted answer: http://stackoverflow.com/a/25731450
tagged with: sorting
has comment: http://stackoverflow.com/comment/40229259
score: 0
has body: I'm trying to get a function be a parameter to a function through Callable. As you try to run it, it would say the error 'void' type not allowed here at long a = timer(sort.Insertion(A)); Why is that? import java.util.*; import java.util.concurrent.*; import java.io.*; public class ThisClass { public static Sort sort = new Sort(); public static void main(String[] args) throws FileNotFoundException { Scanner scanner = new Scanner(new File("location/here.txt")); int z = 0; while(scanner.hasNextInt()) { z++; } int[] A = new int[z]; for(int i = 0; i &lt; A.length; i++) { A[i] = scanner.nextInt(); System.out.print(" " + A[i]); } long a = timer(sort.Insertion(A)); } public long timer (Callable func) throws Exception { long start = System.currentTimeMillis(); func.call(); long end = System.currentTimeMillis(); return end - start; } public static void print (int[] A) { for(int i = 0; i &lt; A.length; i++) { System.out.print(" " + A[i]); } } } import java.util.ArrayList; public class Sort { public void Insertion (int[] A) { for(int j = 1; j &lt; A.length; j++) { int key = A[j]; int i = j - 1; while((i &gt;= 0) &amp;&amp; (A[i] &gt; key)) { A[i + 1] = A[i]; i = i - 1; } A[i + 1] = key; } } } PS. And if anybody could just help with other ways of having Higher Ordered Functions in Java, or having functions being passed as paramaters in functions, that would be great. And very well appreciated.
has title: 'void' type not allowed here, Callable func
answer count: 1
tagged with: higher-order-functions
has comment: http://stackoverflow.com/comment/40229909
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/25731450
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40229206
tagged with: callable

http://stackoverflow.com/comment/40399291
type: AnswerComment
score: 0
type: Comment
has text: Also, remember that you can add blank `JPanel` to layouts, so for instance, if you were using a 3 columned `GridLayout` and wanted a centered button, at the end you could add a blank `JPanel` and then the button.
comment on: http://stackoverflow.com/a/25824100

http://stackoverflow.com/q/25850077
tagged with: groovy
has answer: http://stackoverflow.com/a/29523642
possible better answer: http://stackoverflow.com/a/25904288
favorite count: 0
has comment: http://stackoverflow.com/comment/40710604
answer count: 4
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25904288
linked to: http://stackoverflow.com/q/2646194
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/26014712
has body: I am using this tutorial to upload large files but it is unable to upload even 300KB of file. Also it does not upload anything other than *.txt or *.log files. Need pointers which can help me upload large files irrespective of filetypes. Sharing modified code public class MultipartUtility { private final String boundary private static final String LINE_FEED = "\r\n" private HttpURLConnection httpConn private String charset private OutputStream outputStream private PrintWriter writer public MultipartUtility(String requestURL, String charset) throws IOException { this.charset = charset // creates a unique boundary based on time stamp boundary = "===" + System.currentTimeMillis() + "===" URL url = new URL(requestURL) httpConn = (HttpURLConnection) url.openConnection() httpConn.setUseCaches(false) httpConn.setDoOutput(true) // indicates POST method httpConn.setDoInput(true) httpConn.setRequestProperty("Content-Type", "multipart/form-data; boundary=" + boundary) httpConn.setRequestProperty("User-Agent", "CodeJava Agent") httpConn.setRequestProperty("Test", "Bonjour") outputStream = httpConn.getOutputStream() writer = new PrintWriter(new OutputStreamWriter(outputStream, charset), true) } public void addFormField(String name, String value) { writer.append("--" + boundary).append(LINE_FEED) writer.append("Content-Disposition: form-data; name=\"" + name + "\"").append(LINE_FEED) writer.append("Content-Type: text/plain; charset=" + charset).append(LINE_FEED) writer.append(LINE_FEED) writer.append(value).append(LINE_FEED) writer.flush() } public void addFilePart(String fieldName, File uploadFile) throws IOException { String fileName = uploadFile.getName() writer.append("--" + boundary).append(LINE_FEED) writer.append("Content-Disposition: form-data; name=\"" + fieldName + "\"; filename=\"" + fileName + "\"").append(LINE_FEED) writer.append("Content-Type: " + URLConnection.guessContentTypeFromName(fileName)).append(LINE_FEED) writer.append("Content-Transfer-Encoding: binary").a…
has title: How to upload large files by multipart request in Java?
linked to: http://stackoverflow.com/q/6074516
has answer: http://stackoverflow.com/a/25964013
accepted answer: http://stackoverflow.com/a/25964013
upvote count: 2
tagged with: multipart

http://stackoverflow.com/q/25740955
answer count: 1
has body: When I try to add contacts with ADF Mobile, I get this Exception: ERROR CODE:0 My Code: Contact newcontact = device.createContact(contact); What's the error and how can I fix it?
score: 0
downvote count: 1
has answer: http://stackoverflow.com/a/25744486
favorite count: 0
has title: ADF Mobile Exception when adding contact
tagged with: oracle-adf-mobile
type: UnansweredQuestion
tagged with: oracle-adf
type: Question
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/40363385
type: Comment
comment on: http://stackoverflow.com/a/25804505
has text: If you would add a little explanation of what you changed and why this would be perfect ;-)
score: 0
type: AnswerComment

http://stackoverflow.com/a/25800234
answers question: http://stackoverflow.com/q/25800150
type: Answer
has body: The bug is lying in this section: while (a[t]&lt;l){ t=t+1; if ( t==min(b,n)) return -1 ; if ( a[t]==l) { return t; } } For l = 3, so after the first loop, t = 0 and a[t] == l, so the condition of the while loop a[t] &lt; l is false, so your program directly return -1 without entering the loop. You can add a condition check before entering this loop: if(a[t] == l) return t; while(a[t] &lt; l){ //the rest of your code. }
has comment: http://stackoverflow.com/comment/40356027
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25800150

http://stackoverflow.com/a/25862393
has body: You cannot use the Application context for creating UI elements like Dialogs. This Line in your Add.java File causes the problem: alertDialogBuilder = new AlertDialog.Builder(context); because you are passing an Application Context instead of an Activity context. Just move your Code into your Activity and it should work fine. Move this into your Activity: public void tyc() { // TODO Auto-generated method stub add nn = new add(this); nn.Toastby(); } then call in onCreate() again in Activity not in the Application class! tyc();
has comment: http://stackoverflow.com/comment/40469527
has comment: http://stackoverflow.com/comment/40481002
has comment: http://stackoverflow.com/comment/40474430
downvote count: 0
has comment: http://stackoverflow.com/comment/40473785
has comment: http://stackoverflow.com/comment/40479355
type: Answer
has comment: http://stackoverflow.com/comment/40469835
answers question: http://stackoverflow.com/q/25862211
score: 3
upvote count: 3

http://stackoverflow.com/comment/40376437
comment on: http://stackoverflow.com/q/25810121
score: 0
type: Comment
type: QuestionComment
has text: Your log did not mention any failure while deploying the app, so looks like you are hitting the wrong url. Check web app context path to get the url right.

http://stackoverflow.com/q/25786904
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25788482
has answer: http://stackoverflow.com/a/25791730
has comment: http://stackoverflow.com/comment/40330804
tagged with: button
tagged with: action
favorite count: 0
tagged with: jdialog
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40330758
has body: I have an action defined in the same package as the JDialog. I want to bind the Java Dialog`s close button to this action, without using window listeners. Just set once this action to the button. Can you help me do this, please? Thank you
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40330676
tagged with: java
has comment: http://stackoverflow.com/comment/40333018
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/40330578
has title: Associate predefined action to close button Java JDialog

http://stackoverflow.com/q/25854916
tagged with: jpa
answer count: 1
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/25896599
accepted answer: http://stackoverflow.com/a/25896599
has body: I'm using hibernate JPA annotations, and as for repositories I'm using Spring JPA i have the following two entities: @Entity @Table(name = "idn_organization") @Audited public class Organization extends UuidBasedEntity { @Column(name = "full_name", length = 64, nullable = false) private String fullName; @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, orphanRemoval = true) @JoinTable( name = "idn_organization_address", joinColumns = @JoinColumn(name = "organization_id"), inverseJoinColumns = @JoinColumn(name = "address_id") ) private Set&lt;Address&gt; addresses; @Column(name = "phone_number", length = 12, nullable = true) private String phoneNo; @Column(name = "registered_date", nullable = true) private Date registeredDate; @Column(name = "social_security", length = 9, nullable = true) private String socialSecurity; public String getFullName() { return fullName; } public void setFullName(String fullName) { this.fullName = fullName; } public Set&lt;Address&gt; getAddresses() { return addresses != null ? addresses : new HashSet&lt;Address&gt;(); } public void setAddresses(Set&lt;Address&gt; addresses) { if (this.addresses == null) this.addresses = new HashSet&lt;&gt;(); this.addresses.clear(); if (addresses != null) this.addresses.addAll(addresses); } And: @Entity @Table(name = "cmn_address") @JsonIgnoreProperties({"hibernateLazyInitializer", "handler"}) @Audited public class Address extends AutoIdBasedEntity { @Valid @NotNull(message = "{address.type.notNull}") @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "type_code") @ForeignKey(name = "FK_address_address_type") @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) private AddressType type; @NotNull(message = "{address.line1.notNull}") @Column(name = "address_line_1", length = 256, nullable = true) private String addressLine1; @Column(name = "address_line_2", length = 128, nullable = true) private String addressLine2; @Column(name = "address_line_3", length = 128, nullable = true) p…
has comment: http://stackoverflow.com/comment/40461132
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40460988
has comment: http://stackoverflow.com/comment/40460491
type: Question
has title: one-to-many relationship with join table: relation not being persisted
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40463826
score: 0

http://stackoverflow.com/comment/98386447
has text: @geoand very good solution. But how could I get this value prop outside the class. I created a singleton class AppilicationProperties.java, and in this class will load all properties value, what I need. Then in other place, I will do that: AppilicationProperties.getInstance().getProp(); But I got always null. Pls help, thx!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25765032

http://stackoverflow.com/comment/40235883
comment on: http://stackoverflow.com/q/25734689
score: 0
type: Comment
type: QuestionComment
has text: Build a list (or set, technically) of previously-matched keys, and only replace a token if it matches, and exists in the previously-matched set.

http://stackoverflow.com/q/25788932
has title: RestyGWT & GWT integration
tagged with: java
has comment: http://stackoverflow.com/comment/40669398
type: Question
upvote count: 2
answer count: 1
has body: repost: OBJECTIVE: I'm using GWT and trying to call an existing Twitter REST Service using RestyGWT client PROBLEM: I am not receiving a response to my GET request to "https://api.twitter.com/1.1/statuses/mentions_timeline.json" , or another json. THINGS I'VE TRIED: I've looked at RestyGWT's documentation, and I couldn't come across a concrete example on how to call third party REST services. Tried calling a REST service using plaintext return types, same problem. There must be something I'm doing wrong on a fundamental leve. CODE: Here's my onModuleLoad: public void onModuleLoad() { Resource r = new Resource("https://api.twitter.com/1.1/statuses/mentions_timeline.json"); r.get().send(new JsonCallback() { @Override public void onSuccess(Method method, JSONValue response) { System.out.println("Twitter response:\tYES"); } @Override public void onFailure(Method method, Throwable exception) { System.out.println("Twitter response:\tNO"); System.out.println("Exception:\t\t"+exception.toString()); System.out.println("Exception Message:\t"+exception.getMessage()); System.out.println("Status code:\t\t"+method.getResponse().getStatusCode() ); } });} OUTPUT: GWT MODULE LOADED Twitter response: NO Exception: org.fusesource.restygwt.client.FailedStatusCodeException: Exception Message: Status code: 0
favorite count: 0
tagged with: resty-gwt
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25865125
downvote count: 0

http://stackoverflow.com/q/25798566
type: Question
has comment: http://stackoverflow.com/comment/40353298
has comment: http://stackoverflow.com/comment/40353189
has comment: http://stackoverflow.com/comment/40353218
downvote count: 0
has body: I am trying to check if a certain certificate has been revoked by searching for its entry in a .crl file. For this I am using a simple code, where, on a click of a button .crl file is downloaded, then a serial number of a Certificate is searched in it. Using X509CRL. The problem is, that the method getRevokedCertificate allways returns null, although I am certain that the the serial number of the revoked certificate is inside the .crl file. I am certain, because the method crl.getRevokedCertificates().toString() prints some of the entries, and I am taking the Serial Number from those. The code below is copy-pastable, made in Android Studio. Needs a only button. public void getCRL(View view) throws IOException { // Force downloading on main thread StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); // Where is the crl? String stURL = "http://www.trustcenter.de/crl/v2/tcclass0.crl"; URL url = new URL(stURL); // Open connection HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); try { // Get .crtFile InputStream in = new BufferedInputStream(urlConnection.getInputStream()); CertificateFactory cf = CertificateFactory.getInstance("X.509"); X509CRL crl = (X509CRL) cf.generateCRL(in); Log.d("All revoked: ", crl.getRevokedCertificates().toString()); // Test what certificate? Serial number String STcertSN = "550B00010002F12E05BFE98E3627"; BigInteger certSN = new BigInteger(STcertSN,16); Log.d("Serial number in decimal: ", certSN.toString()); // See if revoked X509CRLEntry isRevoked = crl.getRevokedCertificate(certSN); if (isRevoked != null) { Log.d("Revoking: ", isRevoked.toString()); } else { Log.d("Revoing: ","Was not revoked"); } } catch (Exception e) { Log.e("uri","Failed at everything"); } finally { urlConnection.disconnect(); } } EDIT: I have tried the same code now in Eclipse. And the code seems to work okay - I get the message about the found revoked certificate. import…
tagged with: android
favorite count: 0
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40353400
tagged with: x509
has title: getRevokedCertificate(BigInteger) method always returns null
score: 2
tagged with: biginteger
tagged with: java
tagged with: eclipse

http://stackoverflow.com/comment/40379926
score: 0
comment on: http://stackoverflow.com/a/25812951
type: Comment
has text: My bad. I accidently enter a -2 for distance. Thank you, Jon.
type: AnswerComment

http://stackoverflow.com/q/25853854
score: 0
possible better answer: http://stackoverflow.com/a/25853896
has body: I have an android application that returns an Entry date Formatted like this 2014-08-26T16:23:30.803 I need it to display 08/16/2014 04:23 pm Here is my code items.add(new ListViewItem() {{ Ticket = json_data.optString("TicketID"); Desc = json_data.getJSONObject("Location").optString("LocationName"); Status = json_data.optString("Status_Desc"); Poster = json_data.optString("Lastposter"); Time = json_data.optString("Entrydate"); }});
has answer: http://stackoverflow.com/a/25853991
has answer: http://stackoverflow.com/a/25853945
has comment: http://stackoverflow.com/comment/40468011
linked to: http://stackoverflow.com/q/454315
tagged with: android
linked to: http://stackoverflow.com/q/2201925
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25854004
has answer: http://stackoverflow.com/a/25853896
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: How to Format Date Time in Android
type: Question
accepted answer: http://stackoverflow.com/a/25853991
tagged with: arraylist

http://stackoverflow.com/comment/40315370
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25777981
type: QuestionComment
has text: How do you know that it's not executed? Are you debugging?

http://stackoverflow.com/a/25734534
type: Answer
answers question: http://stackoverflow.com/q/25734358
upvote count: 3
has body: Use integer arithmetic: int seconds = someDouble.intValue(); int millis = (int)(someDouble * 1000) % 1000; The Double class offers the intValue() method, so that's seconds sorted out. millis is just the remainder after dividing the number of milliseconds by 1000, so the modulus operator % is all you need (the number of seconds is irrelevant to this calculation).
score: 3
downvote count: 0

http://stackoverflow.com/comment/40994444
comment on: http://stackoverflow.com/a/25788397
has text: @Denor: Usually you pick a point `P` *not* on the line of the four points `A,B,C,D` then compute `CR(A,B;C,D)=([ACP][BDP])/([ADP][BCP])` where `[XYZ]` is a determinant of homogeneous coordinates in the plane, i.e. a 3×3 determinant. But actually this is more like a new question best asked on http://math.stackexchange.com/. After all, my answer newer made use of cross ratios.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/117846137
comment on: http://stackoverflow.com/a/47664146
type: AnswerComment
type: Comment
score: 0
has text: Works as expected. Tested with version 2.14.1 and %processId dumps the process id of the process.

http://stackoverflow.com/a/25836057
score: 3
accepted answer of: http://stackoverflow.com/q/25835553
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40421796
has body: Here, see if this is working. Please, do watch the main method, since, Swing GUI or any GUI for that matter, must run in it's own thread, but not main. Moreover, instead of setting sizes manually, consider calling frame.pack(), this will create a JFrame after calculating sizes of the components, contained with this container, in a good sense. Try to use JFrame.DISPOSE_ON_CLOSE over, JFrame.EXIT_ON_CLOSE, since, the latter is very much similar to using System.exit(0), which simply kills the application, though the former, will graciously wait for all daemon threads to stop, before actually JVM shuts down. import java.awt.*; import javax.swing.*; public class HelloFrame { private void displayGUI() { JFrame frame = new JFrame("Hello Frame Example"); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel contentPane = new JPanel(); JLabel label = new JLabel( "This is where I put something 3D", JLabel.CENTER); contentPane.add(label); frame.setContentPane(contentPane); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); } public static void main(String[] args) { Runnable runnable = new Runnable() { @Override public void run() { new HelloFrame().displayGUI(); } }; EventQueue.invokeLater(runnable); } }
upvote count: 3
has comment: http://stackoverflow.com/comment/40421284
type: Answer
has comment: http://stackoverflow.com/comment/40421680
answers question: http://stackoverflow.com/q/25835553

http://stackoverflow.com/comment/40361190
type: Comment
type: QuestionComment
has text: Why don't you substring and remove last `%` character? Or you can use `replace`
score: 1
comment on: http://stackoverflow.com/q/25803205

http://stackoverflow.com/a/25735754
answers question: http://stackoverflow.com/q/25735706
has body: You could install the .jar file to the local repository. http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html or else include the .jar as system dependency. http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#System_Dependencies
type: Answer
score: 0

http://stackoverflow.com/a/25739168
answers question: http://stackoverflow.com/q/25738561
has comment: http://stackoverflow.com/comment/40280453
accepted answer of: http://stackoverflow.com/q/25738561
has comment: http://stackoverflow.com/comment/40264703
has comment: http://stackoverflow.com/comment/40280530
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
has body: Start from the inner loop out. Each iteration of the inner loop takes Theta(log_K(i)) iterations, since the iterator j starts from i and decays exponentially. So, you have to combine that with the outer loop now, which is a simple incremental loop. Thus, the outer loop takes: Theta(log_K(1) + log_K(2) + log_K(3) + ... + log_K(n)) = = Theta(log_K(1*2*...*n)) = Theta(log_K(n!)) = = Theta(n*log_K(n)) = Theta(nlogn) The last equality is because log_K(x) = log_2(x) / log_2(K), but log_2(K) is a constant. I am assuming you mean for(j=i;j&gt;=1;j=j/3){, and NOT for(i=j;j&gt;=1;j=j/3){ (i and j switched on initialization)

http://stackoverflow.com/comment/40364262
score: 0
type: QuestionComment
has text: You're using a Node class in your code (`Node environment = ...`). What is the package of this class ?
type: Comment
comment on: http://stackoverflow.com/q/25804414

http://stackoverflow.com/a/25855547
answers question: http://stackoverflow.com/q/25838241
has body: The following worked for me. evaluate(new File("/Users/jellin/meow.groovy")) I did change the meow.groovy file to execute the method within the file. void meow() { println "walrus" } meow() One issue is I don't see a way to pass a parameter to the calling script. I have used the following before, you can pass parameters as part of the binding. String script = "full path to the script" GroovyScriptEngine gse = new GroovyScriptEngine() Binding binding = new Binding(); Object result = gse.run(script, binding) Also, you might be able to simply reference the other scripts as classes and execute the run method on them. There is also an AST transformation that can be used to have scripts extend a base script. See here for more info http://mrhaki.blogspot.com/2014/05/groovy-goodness-basescript-with.html
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/40322089
type: QuestionComment
type: Comment
has text: 'Runtime r = Runtime.getRuntime(); Process process = r.exec("telnet 172.16.221.87 "); InputStream is = process.getInputStream(); OutputStream os = process.getOutputStream(); BufferedWriter br = new BufferedWriter(new OutputStreamWriter(os)); br.write("ditech\r\n"); br.flush(); ' The exception is coming on last line that is br.flush();
score: 0
comment on: http://stackoverflow.com/q/25781750

http://stackoverflow.com/q/25859228
tagged with: android
has comment: http://stackoverflow.com/comment/40463796
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40466199
tagged with: java
has body: I have been following this tutorial: AndroidHive - working with Camera API to try and enable taking photos in my app. However, I'm getting an error once I press my "take photo button". LogCat: 09-16 11:04:00.539 19561-19561/au.gov.nsw.shellharbour.saferroadsshellharbour D/Dob_in_a_Hoon_photos﹕ Failed to create Dob_in_a_Hoon_photos directory 09-16 11:04:00.539 19561-19561/au.gov.nsw.shellharbour.saferroadsshellharbour D/AndroidRuntime﹕ Shutting down VM 09-16 11:04:00.539 19561-19561/au.gov.nsw.shellharbour.saferroadsshellharbour W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x40e21438) 09-16 11:04:00.559 19561-19561/au.gov.nsw.shellharbour.saferroadsshellharbour E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.NullPointerException: file at android.net.Uri.fromFile(Uri.java:441) at au.gov.nsw.shellharbour.saferroadsshellharbour.dob_in_a_hoon.getOutputMediaFileUri(dob_in_a_hoon.java:97) at au.gov.nsw.shellharbour.saferroadsshellharbour.dob_in_a_hoon.captureImage(dob_in_a_hoon.java:89) at au.gov.nsw.shellharbour.saferroadsshellharbour.dob_in_a_hoon.access$000(dob_in_a_hoon.java:28) at au.gov.nsw.shellharbour.saferroadsshellharbour.dob_in_a_hoon$1.onClick(dob_in_a_hoon.java:60) at android.view.View.performClick(View.java:4191) at android.view.View$PerformClick.run(View.java:17229) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4963) 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:1038) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at dalvik.system.NativeStart.main(Native Method) 09-16 11:04:10.529 19561-19561/au.gov.nsw.shellharbour.saferroadsshellharbour I/Process﹕ Sending signal. PID: 19561 SIG: 9 Here is my .java file: public class …
has answer: http://stackoverflow.com/a/25861807
type: Question
tagged with: android-camera
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40463913
accepted answer: http://stackoverflow.com/a/25861807
has comment: http://stackoverflow.com/comment/40467425
has title: Displaying image taken by camera API android
has comment: http://stackoverflow.com/comment/40464527
possible better answer: http://stackoverflow.com/a/25864076
has answer: http://stackoverflow.com/a/25864076

http://stackoverflow.com/a/25852678
downvote count: 0
has body: You are getting caught out by the JVMs int cache pool that is used automatically when auto boxing ints. The result is that low int values will share the same instance of a boxed int, but larger values will not. 150 is outside of this cache range so the key that is inserted into the map is a different instance to the one being used to look the value up. As evidence, run the following code: Integer a = 150; Integer b = 150; System.out.println("System.identityHashCode(a) = " + System.identityHashCode(a)); System.out.println("System.identityHashCode(b) = " + System.identityHashCode(b)); One would expect both values to have the same identity hashcode, however they do not. On my test run, the output was: System.identityHashCode(a) = 1291472364 System.identityHashCode(b) = 1158801519 Reference to the JLS 5.1.7 that covers this behaviour. Ideally, boxing a given primitive value p, would always yield an identical reference. In practice, this may not be feasible using existing implementation techniques. The rules above are a pragmatic compromise. The final clause above requires that certain common values always be boxed into indistinguishable objects. The implementation may cache these, lazily or eagerly. For other values, this formulation disallows any assumptions about the identity of the boxed values on the programmer's part. This would allow (but not require) sharing of some or all of these references. To fix this problem, you should avoid auto boxing the key entirely. But as another demonstration that it is this cache that is catching you out, you can resize the int cache when you run the test. -Djava.lang.Integer.IntegerCache.high=4096 With this flag set, your test program will not throw a NullPointerException and will behave the way that you expected. Up to the key value of 4096 anyway ;)
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25852516
has comment: http://stackoverflow.com/comment/40451534

http://stackoverflow.com/a/25735621
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25735497
has body: The problem is here String profile_picture = c.getString(loadImageFromWebOperations(TAG_PROFILE_PICTURE.replaceAll(" ", "%20"),sdCard.getAbsolutePath() + "/dir1/dir2")); First get they value for key and then load the url.
has comment: http://stackoverflow.com/comment/40237905

http://stackoverflow.com/comment/40436101
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25843684
has text: So you mention that the last part should be in my oncreate. but what about the AppPreferences appPref; appPref = new AppPreferences(getApplicationContext(), "PREFS"); and appPref.SaveData("Value", "Tag");. Isn't that also in teh same OnCreate?

http://stackoverflow.com/q/25749875
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/25750029
type: AnsweredQuestion
tagged with: android
has body: I am doing an android login call to an API, the response could be two different json: A.- Json Error {"message":" not found","error":"Unauthorized","status":401} B.-Json Success {"permissions":10,"ac_status":"active"} My idea is return to the main Screen one of this three (int) values after check the Json tags: return 0 if error getting JSON (like server down) return 1 if login success return 2 if error in login (sever error , JSON null) I am trying something like this on an AsyncTask,it works but I always get 0 on server error and login success. How I can do it? thanks in advanced. @Override protected Void doInBackground(Void... params) { ... ... int valueReturn =0; JSONObject response = jsonService.call(url); try { if (response.getString("TAG_ERROR") valueReturn = 2; else valueReturn= 1; } catch (JSONException e) { valueReturn = 0; }
has title: returning one between three int possibilities after Json
type: Question
has answer: http://stackoverflow.com/a/25750029
answer count: 1
score: 0

http://stackoverflow.com/q/25730031
upvote count: 1
tagged with: shapeless
tagged with: scalaz
answer count: 0
score: 1
tagged with: java
type: Question
downvote count: 0
has body: I am using the datastax java drver for Cassandra from scala (2.10.4) to build batches of prepared statements but have hit the following problem. Table definition in CQL use ks; drop table bc_test; create table bc_test( id TEXT, id_1 BIGINT, c1 COUNTER, c2 COUNTER, PRIMARY KEY(id, id_1) ); First problem is implicit numeric widening error import com.datastax.driver.core.{ResultSet, ProtocolOptions, Cluster, Session} import com.datastax.driver.core.RegularStatement import com.datastax.driver.core.PreparedStatement import com.datastax.driver.core.BoundStatement import com.datastax.driver.core.BatchStatement val c = Cluster.builder().addContactPoint("127.0.0.1").withPort(9042).build val sess = c.connect("ks") val p_bc_test_c1: PreparedStatement = sess.prepare("UPDATE bc_test SET c1 = c1 + ? WHERE id = ? and id_1 = ?") val batch: BatchStatement = new BatchStatement(BatchStatement.Type.COUNTER); val id1: Long = 1L val idText: String = "one" val c1: Long = 1L batch.add(p_bc_test_c1.bind(c1, "one", id1)) // which gives the error scala&gt; batch.add(p_bc_test_c1.bind(c1, "one", id1)) &lt;console&gt;:19: error: implicit numeric widening batch.add(p_bc_test_c1.bind(c1, "one", id1)) ^ I can get around this using type ascription but wanted to find something a bit nicer that can also be built into a more generic solution. What I came up with was : import scalaz._ import Scalaz._ import shapeless._ import poly._ import syntax.std.tuple._ trait CassandraLongVal type CassandraLong = java.lang.Long @@ CassandraLongVal def cassandraLongCol(c : Long): CassandraLong = Tag(c) trait CassandraIntVal type CassandraInt = java.lang.Integer @@ CassandraIntVal def cassandraIntCol(c : Int): CassandraInt = Tag(c) object ToCassandraType extends Poly1 { implicit def caseInt = at[Int](cassandraIntCol(_)) implicit def caseLong = at[Long](cassandraLongCol(_)) implicit def caseString = at[String](identity) } case class Update1(cval: Long, id: String, id1: Long) val update1Gen = Generic[Update1] val bUpd…
tagged with: cassandra
favorite count: 0
has title: Calling Java library method with (Object ...) arg list from Scala , retaining type sanity (Shapeless / Scalaz)
type: UnansweredQuestion
tagged with: scala

http://stackoverflow.com/q/25834996
favorite count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/40418871
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/4983886
score: 3
has body: Suppose I have an array of integers like this: { 3, 1, 6, 8, 2, 0, 1 } I need to find the maximum element on the left hand side of each element which is smaller than the element, or print -1 if that maximum element doesn't exist. So, solution for this problem will be: { -1, -1, 3, 6, 1, -1, 0 } I can solve this in O(n^2) using two loops. Inner loop will find maximum element which is smaller than the given element. But is there any better approach to solve this?
tagged with: algorithm
has title: How to find maximum element on left hand side of an element which is smaller than the element?
tagged with: java
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/25835060
has comment: http://stackoverflow.com/comment/40419759
type: Question
has answer: http://stackoverflow.com/a/25835138
answer count: 3
tagged with: max
has answer: http://stackoverflow.com/a/55268039
tagged with: arrays

http://stackoverflow.com/comment/40441342
comment on: http://stackoverflow.com/q/25847343
score: 0
type: QuestionComment
type: Comment
has text: Also does someone know how to make the picture link appear as the picture itself instead of the link?

http://stackoverflow.com/comment/40313300
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25776672
has text: @Prog That's a non-sequitur. Where does `someone` get declared? What is its type? How is `Interface` declared? You can clearly assign a `() -> void` to a variable declared as an interface that is declared with a single method, `void thisCanBeAnyName();`. I've asked a follow-up question on this, which is [here](http://stackoverflow.com/q/25776804/1424875).

http://stackoverflow.com/a/25765704
score: 0
type: Answer
type: AcceptedAnswer
has body: for character only will be el.value.replace(/[^a-z]/ig, '');
accepted answer of: http://stackoverflow.com/q/25765512
answers question: http://stackoverflow.com/q/25765512

http://stackoverflow.com/q/25789318
score: 0
tagged with: java-me
type: AnsweredQuestion
has body: maybe you could help to understand some things about TimerClass: Assume i got a timer Timer timer = new Timer(); And a data-fetching task timer.shedule(new DataFetcher, 0, time); Assume a short interval to execute the task plus an theoretical infinite running program, may it appear that, when the period is short enough or the execution of the task takes too long, i'll end up with lots of DataFetcher instances? If i change the sheduling DataFetcher df = new DataFetcher(); timer.shedule(df, 0, time); would this ensure that i'd always work with the same task instance? I tried to simulate that, to estimate the behaviour, but i'm kinda stuck. Greetings Please notice that im working on a mobile device using j2me. I know about timer alternatives in std java but i guess its not suitable for the microedition.
type: Question
has answer: http://stackoverflow.com/a/25789475
tagged with: java
tagged with: timertask
has title: Infinite TimerTask method call
answer count: 1
accepted answer: http://stackoverflow.com/a/25789475

http://stackoverflow.com/comment/40426260
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25815551
has text: @isomarcte Thanks, I'll award it once the system allow me to do so in 23 hours.

http://stackoverflow.com/q/25782299
has answer: http://stackoverflow.com/a/28138741
tagged with: spring-mvc
type: AnsweredQuestion
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/25625694
tagged with: eclipse
has body: At first I'm apologizing for asking same question twice. First time I didn't get any answer. Then I tried myself to solve the problem,but failed. This is why I'm asking the question again and this time I'm putting it briefly. I was learning Spring MVC framework by myself. I was using jdk 8.20 version, tomcat 8.0.9 version and eclipse luna. At first everything was working smoothly. But all of a sudden my tomcat server installed in eclipse stopped working. I was failed to run it using cmd or startup.bat too. Problem asked here. After that I tried myself and I changed the server. I used tomcat 7 and TomEE 1.7.0. Every time my server started smoothly, I installed the server in eclipse smoothly. But whenever I tried to create a project and run it, eclipse couldn't use the server anymore. Even after attempting to run a project, eclipse couldn't start it by start command. But the difference between tomcat8 and TomEE is I can now run it outside of eclipse using startup.bat. I also tried changing the port number,but that didn't work either. For TomEE first it showed unable to read zip file spring-core-4.0.6.RELEASE-javadoc. Then I replaced all the spring files, now it showing a container failed to start. Here is my console output: Sep 11, 2014 12:18:53 PM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_20\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre8/bin/client;C:/Program Files/Java/jre8/bin;C:/Program Files/Java/jre8/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.8.0_20\bin;C:\apache-tomee-plus-1.7.0\bin;E:\IDE\eclipse-jee-luna-R-win32_2\eclipse;;. Sep 11, 2014 12:18:54 PM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Serv…
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25782422
tagged with: apache-tomee
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/25782422
has title: Apache Tomcat and Apache TomEE server is not running web projects in eclipse
possible better answer: http://stackoverflow.com/a/28138741

http://stackoverflow.com/a/25778370
type: Answer
has body: Why invoke(AA aa) method of class C can accept instance of class B ? Because class B also implemented interface AA Does all class are the same by implementing a same interface ? Yes. It's like having an interface Animal. When your class Dog implements Animal Dog now IS-A(n) Animal. If Cat implements Animal, Cat now IS-A(n) Animal also. I just only know about polymorphism to extends same class. But I don't know using with Interfaces. Polymorphism is not just limited to extending a class. It also happens when you implement an interface. In your given example with Student and Teacher class. Let's say you have an interface called SchoolGoer and your Student and Teacher implements it, now you can say that every instances of Student and Teacher IS-A SchoolGoer You can now do something like this: SchoolGoer aTeacher = new Teacher(); SchoolGoer aStudent = new Student(); aTeacher.goToSchool(); aStudent.goToSchool(); Since they both implemented the SchoolGoer interface, they can both do whatever a SchoolGoer does. In this case goToSchool.
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25778347
accepted answer of: http://stackoverflow.com/q/25778347
type: AcceptedAnswer
downvote count: 0

concurrency
tags question: http://stackoverflow.com/q/25785300
tag name: concurrency
tags question: http://stackoverflow.com/q/25744446
tags question: http://stackoverflow.com/q/25832996
tags question: http://stackoverflow.com/q/25728280
tags question: http://stackoverflow.com/q/25832079
tags question: http://stackoverflow.com/q/25781226
tags question: http://stackoverflow.com/q/25838471
tags question: http://stackoverflow.com/q/25807724
tags question: http://stackoverflow.com/q/25862411
tags question: http://stackoverflow.com/q/25721283
tags question: http://stackoverflow.com/q/25728948
tags question: http://stackoverflow.com/q/25797959
tags question: http://stackoverflow.com/q/25840733
tags question: http://stackoverflow.com/q/25795541
tags question: http://stackoverflow.com/q/25731738
tags question: http://stackoverflow.com/q/25848195
tags question: http://stackoverflow.com/q/25738581
type: Tag
tags question: http://stackoverflow.com/q/25803754
tags question: http://stackoverflow.com/q/25868660
tags question: http://stackoverflow.com/q/25730078
tags question: http://stackoverflow.com/q/25863268
tags question: http://stackoverflow.com/q/25784915

http://stackoverflow.com/comment/40320780
type: Comment
has text: Use output redirection operator with your java program. e.g. `your_java_prog_binary > /home/logs.txt`
score: 0
comment on: http://stackoverflow.com/q/25781168
type: QuestionComment

http://stackoverflow.com/q/25738939
tagged with: android
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25739142
tagged with: android-library
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25739142
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
linked to: http://stackoverflow.com/q/3022454
downvote count: 0
duplicate of: http://stackoverflow.com/q/3022454
has body: I used to include an Android library on Eclipse, say lib-1.jar, to my app that supports all devices from API 8. Now the news: the latest version of this library supports only Android from API 9 (lib-2.jar). I don't want to drop the support for API 8, and at the same time I need this new version. Is it possible to tell Android to load lib-1 or lib-2 depending of the current API version?
has title: Load a specific Android library based on API version

http://stackoverflow.com/q/25753966
has answer: http://stackoverflow.com/a/78058195
answer count: 18
has answer: http://stackoverflow.com/a/67641340
has answer: http://stackoverflow.com/a/33477302
has answer: http://stackoverflow.com/a/59772254
downvote count: 0
tagged with: java
linked to: http://stackoverflow.com/q/24589932
has answer: http://stackoverflow.com/a/72717653
has answer: http://stackoverflow.com/a/59439447
tagged with: eclipse
has answer: http://stackoverflow.com/a/76746867
type: Question
has answer: http://stackoverflow.com/a/74208102
has answer: http://stackoverflow.com/a/74316533
has answer: http://stackoverflow.com/a/69874704
upvote count: 58
has answer: http://stackoverflow.com/a/73815333
has comment: http://stackoverflow.com/comment/42095090
has answer: http://stackoverflow.com/a/67844407
linked to: http://stackoverflow.com/q/70220737
has answer: http://stackoverflow.com/a/60198152
has answer: http://stackoverflow.com/a/75018586
has answer: http://stackoverflow.com/a/69614865
has body: Eclipse 4.4.0 on Mac OSX 10.9, JVM 8 gives an alert when I try to run it: "The JVM shared library "/Library/Java/JavaVirtualMachine/jdk1.8.0_20.jdk/Contents/Home/bin/.../jre/lib/server/libjvm.dylib" does not contain the JNI_CreateJavaVM symbol" The application does not start. I edited the Info.plist per Shan's instructions of 8/25, but I still get the same error. I've also downloaded &amp; installed Java from Apple's web site, but I still get the same error. thanks for the help.
has title: Eclipse: JVM shared library does not contain the JNI_CreateJavaVM symbol
has answer: http://stackoverflow.com/a/71665235
tagged with: macos
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/62517341
has comment: http://stackoverflow.com/comment/40280805
has answer: http://stackoverflow.com/a/77326702
type: UnansweredQuestion
score: 58
has comment: http://stackoverflow.com/comment/104769304

http://stackoverflow.com/a/25773219
has comment: http://stackoverflow.com/comment/40309197
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25773118
type: Answer
has comment: http://stackoverflow.com/comment/40306197
upvote count: 1
has body: I don't think your sorting function works: My test: static void test() { addToArray("Zello"); addToArray("Boby"); addToArray("Amy"); addToArray("Coco"); addToArray("Boris"); for(int i = 0; i &lt; size; i++) { System.out.println(sortedArray[i]); } } Output: Amy Boris Boby Zello Coco Here is a different and more efficient way to do it. Use Arrays.binarySearch() to find the proper insertion position. Mind you, this function returns: the index of the value if it already exists. the -(insertPosition - 1) if the value doesn't exist. I assume based on your code that the size variable represents the index of the last element in the array. That means you probably initialize it to -1 when the array is empty. Furthermore, I think you don't allow duplicates and that each Person will be unique so my solution returns false when you try to insert a duplicate. Of course, make sure you resize the array after certain criterium is matched (usually when array is half full). public boolean addToArray(T item) { if (item == null) { return false; } else if (size == -1) { size++; sortedArray[size] = item; return true; } else { // find the correct insertion point using Binary Search int insertionPoint = Arrays .binarySearch(sortedArray, 0, size+1, item); if (insertionPoint &gt;= 0) { // duplicate value return false; } // set the insertionPoint to proper value insertionPoint = (-(insertionPoint) - 1); // shift elements to the right of insertionPoint for (int i = size + 1; i &gt; insertionPoint; i--) { sortedArray[i] = sortedArray[i - 1]; } // insert at insertionPoint sortedArray[insertionPoint] = item; // update size size++; return true; //success } } Also, you can further simplify your compareTo() method in the Person object. public int compareTo(Person p) { if(p != null) { return p.age - this.age; } else throw new NullPointerException(); } Right now, sorting is descending. If you want to make it ascending, change: return p.age - this.age; To: return this.age - p.age; Here is a full running …
score: 1
accepted answer of: http://stackoverflow.com/q/25773118

http://stackoverflow.com/q/25840152
has comment: http://stackoverflow.com/comment/40429152
tagged with: java
has comment: http://stackoverflow.com/comment/40429307
upvote count: 1
has comment: http://stackoverflow.com/comment/40429071
has comment: http://stackoverflow.com/comment/40429228
downvote count: 1
has comment: http://stackoverflow.com/comment/40429002
type: Question
tagged with: union
tagged with: arrays
tagged with: nested-loops
has body: I want to create a union array for two integer arrays using nested loops. This is my attempt so far: import java.util.Scanner ; public class array4 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter first array size:"); int size = input.nextInt(); int x[] = new int[size]; System.out.println("Enter first array elements:"); for (int i = 0; i &lt; size; i++) { x[i] = input.nextInt(); } System.out.print("Enter second array size:"); int size2 = input.nextInt(); int y[] = new int[size2]; for (int i = 0; i &lt; size2; i++) { y[i] = input.nextInt(); } System.out.println("Union"); for (int i = 0; i &lt; size; i++) { System.out.println(x[i]); } for (int i = 0; i &lt; size2; i++) { for (int z = 0; z &lt; size; z++) { if (y[i] != x[z]) { System.out.println(y[i]); } } } } }
has comment: http://stackoverflow.com/comment/40429090
has comment: http://stackoverflow.com/comment/40429062
possible better answer: http://stackoverflow.com/a/25840231
score: 0
has answer: http://stackoverflow.com/a/25840515
answer count: 3
has answer: http://stackoverflow.com/a/25840231
favorite count: 0
accepted answer: http://stackoverflow.com/a/25840515
has title: Java Union array of 2 int arrays using nested loops
has comment: http://stackoverflow.com/comment/40429167
has comment: http://stackoverflow.com/comment/40429050
has answer: http://stackoverflow.com/a/25840540
type: AnsweredQuestion

http://stackoverflow.com/a/48415363
upvote count: 3
has comment: http://stackoverflow.com/comment/97479677
has comment: http://stackoverflow.com/comment/97480358
has comment: http://stackoverflow.com/comment/97480027
type: Answer
answers question: http://stackoverflow.com/q/25858698
score: 3
downvote count: 0
has body: Combining the answers above I've made a much easier approach: return resWrapper(domainObj, embeddedRes(domainObj.getSettings(), "settings")) This is a custom utility class (see below). Note: Second argument of resWrapper accepts ... of embeddedRes calls. You may create another method that omits the relation String inside resWrapper. First argument of embeddedRes is Object, so you may also supply an instance of ResourceSupport The result of the expression is of the type that extends Resource&lt;DomainObjClass&gt;. So, it will be processed by all Spring Data REST ResourceProcessor&lt;Resource&lt;DomainObjClass&gt;&gt;. You may create a collection of them and also wrap around new Resources&lt;&gt;(). Create the utility class: import com.fasterxml.jackson.annotation.JsonUnwrapped; import java.util.Arrays; import org.springframework.hateoas.Link; import org.springframework.hateoas.Resource; import org.springframework.hateoas.Resources; import org.springframework.hateoas.core.EmbeddedWrapper; import org.springframework.hateoas.core.EmbeddedWrappers; public class ResourceWithEmbeddable&lt;T&gt; extends Resource&lt;T&gt; { @SuppressWarnings("FieldCanBeLocal") @JsonUnwrapped private Resources&lt;EmbeddedWrapper&gt; wrappers; private ResourceWithEmbeddable(final T content, final Iterable&lt;EmbeddedWrapper&gt; wrappers, final Link... links) { super(content, links); this.wrappers = new Resources&lt;&gt;(wrappers); } public static &lt;T&gt; ResourceWithEmbeddable&lt;T&gt; resWrapper(final T content, final EmbeddedWrapper... wrappers) { return new ResourceWithEmbeddable&lt;&gt;(content, Arrays.asList(wrappers)); } public static EmbeddedWrapper embeddedRes(final Object source, final String rel) { return new EmbeddedWrappers(false).wrap(source, rel); } } You only need to include import static package.ResourceWithEmbeddable.* to your service class to use it. JSON looks like this: { "myField1": "1field", "myField2": "2field", "_embedded": { "settings": [ { "settingName": "mySetting"…

http://stackoverflow.com/comment/40229898
comment on: http://stackoverflow.com/q/25730708
type: QuestionComment
has text: What do you find when you search your project for `new MongoClient`?
score: 0
type: Comment

http://stackoverflow.com/comment/40239587
score: 1
has text: A good question I feel. A lot of new concepts for me. Thanks!
comment on: http://stackoverflow.com/q/25736346
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40324509
has text: i have a situation like where i need to rollback in catch block and need to do some process in catch block.
score: 0
comment on: http://stackoverflow.com/q/25783176
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25744771
has comment: http://stackoverflow.com/comment/40254633
tagged with: multithreading
has body: I have a simple Swing button that refreshes a jtable, but after a random number of clicks the application freezes, sometimes indefinitely, sometimes it responds after a minute or so. I never did any thread especific method so I think maybe thats the issue but I dont know where to start or how to modify the methods if that is the cause of the freezes. This is the code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { recorrerLista(); } public EventList recorrerLista(){ Persistir p = Persistir.getInstancia(); Vector<Pedidos> lista2 = p.listarPedidos(); Iterator it = lista2.iterator(); if(!pedList.isEmpty()){ pedList.clear(); } while(it.hasNext()){ Vector v = new Vector(); v = (Vector) it.next(); int index = (Integer)v.get(0); Pedidos ped = new Pedidos(); ped = p.buscarPedidoPorId(index); pedList.add(ped); } return pedList; } Edit: I tried inserting the method of the persistence class (Persistir) inside a SwingWorker but now the UI don't show up. Here is the code public Vector listarPedidos() throws InterruptedException, ExecutionException{ SwingWorker listar = new SwingWorker<Vector, Vector>(){ @Override protected Vector doInBackground() throws Exception { Vector<Articulos> lista = null; EntityManagerFactory emf = Persistence.createEntityManagerFactory("PedidosPU" ); EntityManager em = emf.createEntityManager(); em.getTransaction().begin(); try { Query query = em.createNativeQuery("SELECT * FROM pedidosview WHERE ENTREGADO='P' ORDER BY fecha_pedido"); lista = (Vector) query.getResultList(); } catch (Exception e) { System.out.println( e.getMessage() ); em.getTransaction().rollback(); } finally { em.close(); emf.close(); } return lista; } }; return (Vector) listar.get(); } Edit 2: I did what was suggested and i get a null pointer exception, here is my code: public Vector listarPedidos(){ //Vector<Articulos> lista = null; final EntityManagerFactory emf = Persistence.createEntityManagerFactory("PedidosPU" ); final EntityManager em = emf.createEntityM…
upvote count: 1
tagged with: swing
answer count: 1
score: 0
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/25753445
tagged with: swingworker
has comment: http://stackoverflow.com/comment/40257350
has comment: http://stackoverflow.com/comment/40267889
accepted answer: http://stackoverflow.com/a/25753445
tagged with: jtable
has title: Java/Swing app Freezes randomly
type: AnsweredQuestion
favorite count: 0
has comment: http://stackoverflow.com/comment/40254520
type: Question

http://stackoverflow.com/a/72655943
has body: import re def rearrange_name(name): result = re.search(r"^([\w \.-]*), ([\w \.-]*)$", name) #Included extra characters i.e. .- to be captured in our groups in the event they are found. #result = re.search(r"^([\w .-]*), ([\w .-]*)$", name) #seems to be also working without escaping the period if result == None: return name return "{} {}".format(result[2], result[1]) name=rearrange_name("Raila, Odinga M.") print(name)`enter code here`
type: Answer
answers question: http://stackoverflow.com/q/25801247
score: 0

http://stackoverflow.com/comment/40322111
has text: Why would an inner join be relevant? How can Hibernate be sure that every address has a person? You've specified that every person has an address. That doesn't mean every address has a person.
comment on: http://stackoverflow.com/q/25779980
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25826577
has body: You need to implement the isCellEditable method for your TableModel: public boolean isCellEditable(int row, int col) return false; See also the tutorials.
type: Answer
has comment: http://stackoverflow.com/comment/40412777
has comment: http://stackoverflow.com/comment/40407142
answers question: http://stackoverflow.com/q/25825060
has comment: http://stackoverflow.com/comment/40407164
score: 0

http://stackoverflow.com/a/25774883
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40309654
has body: This is not an "answer"; but just a viewpoint not able to fit in a comment. I would likely have written it like this: if (type == INCREASING &amp;&amp; currentVal &gt;= duration) { done = true; } else if (type == DECREASING &amp;&amp; currentVal &lt;= 0) { done = true; } There is no else / done = false, because if cleared that is like a concern elsewhere. Also done = true might be better replaced with a break or return, etc.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25774785

http://stackoverflow.com/q/25792879
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40342041
has body: I've created a chat in java with a GUI and a textField to send Messages. I can also type for commands (like "§example") there. But In the chat I want to create a "§kick [user]" command. How can I get the argument [user] in the public void runCommand() { if(textField.getText().equals("§kick")) { appendTextMessages("kicked " + user); textField.setText(null); textField.requestFocus(); } } Hope you understand the question! Thanks in advance
downvote count: 0
has comment: http://stackoverflow.com/comment/40341961
has answer: http://stackoverflow.com/a/25793046
favorite count: 0
has answer: http://stackoverflow.com/a/25792951
accepted answer: http://stackoverflow.com/a/25792951
tagged with: arguments
has title: How to listen for a command with multiple arguments?
has comment: http://stackoverflow.com/comment/40342001
tagged with: command
upvote count: 1
possible better answer: http://stackoverflow.com/a/25793046
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40341893
score: 1
tagged with: java
tagged with: chat

http://stackoverflow.com/a/25830971
has comment: http://stackoverflow.com/comment/40411930
answers question: http://stackoverflow.com/q/25830755
has comment: http://stackoverflow.com/comment/40411660
has body: In Java 8 Code: String alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; List&lt;String&gt; list = Arrays.asList(alphabets.split("")); List&lt;String&gt; result = list.stream().filter(s -&gt; !(s.equals("S") || s.equals("P") || s.equals("O") || s.equals("R") || s.equals("T"))).collect(Collectors.toList()); System.out.println("The list of letters after after extractison S P O R T are "); result.stream().forEach(s -&gt; System.out.print(" " + s)); System.out.println(""); System.out.println("The number of letters after extractison S P O R T is " + result.stream().count()); Output: The list of letters after after extractison S P O R T are A B C D E F G H I J K L M N Q U V W X Y Z The number of letters after extractison S P O R T is 21 Explanation: As far as I know lambda in Java 8 just works with List, so I converted the String to the list by using Arrays.asList. Next I used filter which works like if statement to go through the list and ignore S P O R and T and collect them as List named result. At the end, I print the list by using new form of for loop and show how many letters we have after extraction those letters. Cleaned up Version: import java.util.*; import java.util.function.Predicate; import java.util.stream.Collectors; public class TakeOutChars { public static void main(String[] args) { String alphabets = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; List&lt;String&gt; list = Arrays.asList(alphabets.split("")); System.out.println(filterSPORT(list, ignoreSPORT())); System.out.println(filterSPORT(list, ignoreSPORT()).stream().count()); } public static Predicate ignoreSPORT() { return s -&gt; !(s.equals("S") || s.equals("P") || s.equals("O") || s.equals("R") || s.equals("T")); } public static List&lt;String&gt; filterSPORT(List list, Predicate predicate) { return (List&lt;String&gt;) list.stream().filter( predicate ).collect(Collectors.toList()); } } Output of Cleaned up Version: [A, B, C, D, E, F, G, H, I, J, K, L, M, N, Q, U, V, W, X, Y, Z] 21
has comment: http://stackoverflow.com/comment/40418845
has comment: http://stackoverflow.com/comment/40412234
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40452779
has comment: http://stackoverflow.com/comment/40457062
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40457102

http://stackoverflow.com/comment/40235407
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25734358
has text: First, `Double someDouble` should be `double someDouble`. If you don't understand the difference between primitive types and objects, I suggest you study up on them.

http://stackoverflow.com/a/25720862
upvote count: 1
has comment: http://stackoverflow.com/comment/40210137
has comment: http://stackoverflow.com/comment/40210178
has body: Just use File or Path objects with proper parent-child relations. You do not need to care about slashes and blackslashes, File and Path will take care about them for you. E.g. to define a property file which sits in the user dir folder in a subfolder of props and having a file name myprops.properties, you can use it like this: File propFile = new File(System.getProperty("user.dir"), "/props/myprops.properties"); And you can load this property file like this: // Use try-with-resources to properly close the file input stream try (InputStream in = new FileInputStream(propFile)) { LogManager.getLogManager().readConfiguration(in); } Edit: So if you need a file named logging.properties in your user dir, simply use this: File propFile = new File(System.getProperty("user.dir"), "logging.properties"); try (InputStream in = new FileInputStream(propFile)) { LogManager.getLogManager().readConfiguration(in); }
accepted answer of: http://stackoverflow.com/q/25720734
answers question: http://stackoverflow.com/q/25720734
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/40210285
has comment: http://stackoverflow.com/comment/40210186

http://stackoverflow.com/a/25845517
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/25839671
type: Answer
has body: You can add it manually into web.xml and ibm-web-bnd.xml (this is example that corresponds to the DW article you mentioned, please change it accordingly): web.xml <description /> MyConstants com.ibm.acme.ree.lib.Config ibm-web-bnd.xml <?xml version="1.0" encoding="UTF-8"?> After that you can use JNDI to lookup java:comp/env/MyConstants and get Config object.
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25839671
type: AcceptedAnswer

http://stackoverflow.com/q/25736878
accepted answer: http://stackoverflow.com/a/25742950
type: Question
tagged with: jakarta-ee
has title: Cannot deploy Web application to tomcat from Eclipse
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40241050
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40240299
has comment: http://stackoverflow.com/comment/40240199
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40240142
has comment: http://stackoverflow.com/comment/40240845
has body: I'm trying deploy a web app to tomcat but getting the next errors INFO: validateJarFile(C:\Users\Denis.Belykh\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\IBRSWebTomcatWAR\WEB-INF\lib\javaee-api-6.0.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class сен 09, 2014 11:03:42 AM org.apache.catalina.loader.WebappClassLoader validateJarFile INFO: validateJarFile(C:\Users\Denis.Belykh\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\IBRSWebTomcatWAR\WEB-INF\lib\javax.servlet.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class сен 09, 2014 11:03:48 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined сен 09, 2014 11:03:48 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined сен 09, 2014 11:03:48 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined сен 09, 2014 11:03:48 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined сен 09, 2014 11:03:48 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined сен 09, 2014 11:03:48 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined сен 09, 2014 11:03:48 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined сен 09, 2014 11:03:48 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined сен 09, 2014 11:03:48 AM org.apache.catalina.startup.TaglibUriRule body INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/per…
has comment: http://stackoverflow.com/comment/40240676
has comment: http://stackoverflow.com/comment/40243597
has comment: http://stackoverflow.com/comment/40240222
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25742950
tagged with: java
linked to: http://stackoverflow.com/q/10848341

http://stackoverflow.com/q/25797018
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25939399
score: 1
tagged with: java
has body: I'm working on a big java web application in Eclipse, whose files have different encodings: some are in UTF-8, others in Cp1252, yet others are in ISO-8859-1 (with no distinction between JSP's or java source files, or CSS) &mdash; but I know the encoding of each file. I'm converting the project to Maven, and this is a great occasion to turn all of them to UTF-8. Of course I don't want to lose a single character (so fully automated conversions do not apply here). How should I go about it? Is there a tool that can help me ensure I don't lose any special character? The webapp is in Italian, so, especially in JSP's, there could be lots of accented letters (probably not everywhere HTML entities have been used). The project is in Eclipse, but I can use an external editor if that could make the conversion easier.
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40349929
answer count: 2
tagged with: encoding
possible better answer: http://stackoverflow.com/a/25797066
has title: How to convert (Java) files with different encodings to the same?
downvote count: 0
has answer: http://stackoverflow.com/a/25797066
tagged with: jsp
favorite count: 0
accepted answer: http://stackoverflow.com/a/25939399
tagged with: utf-8
has comment: http://stackoverflow.com/comment/40350034
upvote count: 1
type: Question

http://stackoverflow.com/comment/40482581
comment on: http://stackoverflow.com/q/25867488
has text: You can check the charset used in your email (when it is received by Gmail) reading the [message headers](https://support.google.com/mail/answer/22454?hl=en) Try to find something like `Content-Type: text/plain; charset=UTF-8`. If the charset is not UTF-8 there must be something wrong with your Java application (perhaps using some default charset instead of UTF-8)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/65548639
score: 0
type: Comment
has text: on cxf specific, this could be the answer for @confile question `DataHandler handler= attr.getDataHandler(); InputStream instream = handler.getInputStream();`
comment on: http://stackoverflow.com/a/25818465
type: AnswerComment

http://stackoverflow.com/q/25845929
accepted answer: http://stackoverflow.com/a/25847098
has comment: http://stackoverflow.com/comment/40440278
favorite count: 0
linked to: http://stackoverflow.com/q/22249483
has comment: http://stackoverflow.com/comment/40439972
has comment: http://stackoverflow.com/comment/40440626
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/25847835
has comment: http://stackoverflow.com/comment/40440048
has body: In my application I need to find a faster way of loading big arrays of Integer and Float variables. What ave Creating arrays directly using Java Code - This didn't work, because arrays used by my application are really big, 200 000+ float values, which cause java code too large error and I couldn't find any workaround for this. Tried importing these arrays in project using xml which didn't work too, because file size is getting really big and I can't even build. The thing which worked so far, I've added txt files in assets folder, read them using InputStream, parse them as floats / integers and create arrays dynamically, but this is too slow. The reason which I have these big arrays is, because my project uses Vuforia for showing 3D Models, which needs to represent them as arrays of floats / integers (vertices,textcoords,normals,indices), but loading 12 Models is taking too much time. I would love to get some advices / suggestions how can I speed up the loading process. Thanks in advance!
has comment: http://stackoverflow.com/comment/40440130
has answer: http://stackoverflow.com/a/25847098
has comment: http://stackoverflow.com/comment/40439888
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40440749
has comment: http://stackoverflow.com/comment/40440347
has comment: http://stackoverflow.com/comment/40438974
has comment: http://stackoverflow.com/comment/40439904
has comment: http://stackoverflow.com/comment/40439751
has comment: http://stackoverflow.com/comment/40439848
tagged with: java
score: 4
has comment: http://stackoverflow.com/comment/40439575
has title: Android fastest way of reading big arrays of variables
possible better answer: http://stackoverflow.com/a/25846974
type: Question
has answer: http://stackoverflow.com/a/42655277
upvote count: 4
has answer: http://stackoverflow.com/a/25846974
has comment: http://stackoverflow.com/comment/40439621
tagged with: arrays
downvote count: 0

http://stackoverflow.com/comment/42527776
score: 0
comment on: http://stackoverflow.com/q/25836209
type: Comment
type: QuestionComment
has text: Ecole de technologie supérieure? @Razor88

http://stackoverflow.com/comment/40306317
comment on: http://stackoverflow.com/q/25770447
type: Comment
type: QuestionComment
score: 2
has text: Would you mind to add those errors stack trace here? I've run your program. I was unable to get any error, except misprinting of several elements.

http://stackoverflow.com/q/25798156
linked to: http://stackoverflow.com/q/14115950
has comment: http://stackoverflow.com/comment/40352105
has comment: http://stackoverflow.com/comment/40352202
tagged with: swing
downvote count: 1
tagged with: jbutton
type: Question
has body: Whenever I set an icon for my JButton it is always not sized correctly. How can I resize the icon to fit the button fully? final JButton btnSanic = new JButton(); Image img = icon.getImage(); Image newimg = img.getScaledInstance(width, height, java.awt.Image.SCALE_SMOOTH); icon = new ImageIcon(newimg); btnSanic.setIcon(icon);
has answer: http://stackoverflow.com/a/55977671
tagged with: java
tagged with: icons
has comment: http://stackoverflow.com/comment/40352151
has comment: http://stackoverflow.com/comment/133529550
has answer: http://stackoverflow.com/a/58904425
possible better answer: http://stackoverflow.com/a/55977671
has comment: http://stackoverflow.com/comment/40352349
score: 5
answer count: 3
has answer: http://stackoverflow.com/a/25798462
favorite count: 0
has title: Resizing icon to fit on JButton in Java?
has comment: http://stackoverflow.com/comment/40352038
upvote count: 6
has comment: http://stackoverflow.com/comment/40352370
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25798462

http://stackoverflow.com/q/25751001
answer count: 1
favorite count: 0
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40265712
tagged with: java
downvote count: 2
type: Question
has body: I have an app which gets the data from the cloud and displays it in a listview. The data i am getting is from two source one from an API and the other one from parse cloud. The data from the API is displayed first and it takes the position of top listview items and the data from parse cloud is displayed later and takes the lower position. I want the data taken from the parse cloud take the position in top listview items(When the data has been retrieved) and the data taken from the API to move down. private class GetContacts extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { super.onPreExecute(); // Showing progress dialog pDialog = new ProgressDialog(getActivity()); pDialog.setMessage("Please wait..."); pDialog.setCancelable(false); pDialog.show(); list.setAdapter(adapter); } @Override protected Void doInBackground(Void... arg0) { getIp = getIpAddress(); // Creating service handler class instance ServiceHandler sh = new ServiceHandler(); // Making a request to url and getting response String jsonStr = sh .makeServiceCall(url + getIp, ServiceHandler.GET); ParseQuery&lt;ParseObject&gt; query = ParseQuery.getQuery("ads"); query.findInBackground(new FindCallback&lt;ParseObject&gt;() { public void done(List&lt;ParseObject&gt; scoreList, ParseException e) { for (int i = 0; i &lt; scoreList.size(); i++) { try { ParseFile file = (ParseFile) scoreList.get(i) .get("appImage"); HashMap&lt;String, String&gt; contact = new HashMap&lt;String, String&gt;(); String desc = scoreList.get(i) .getString("Desc"); String AppTitle = scoreList.get(i).getString( "AppTitle"); String appUrl = scoreList.get(i).getString( "appUrl"); String imageUrl = file.getUrl(); String Existing_user = scoreList.get(i) .getString("ExistingUser"); if (Existing_user.equals("true")) { existing = true; } else if (Existing_user.equals("false")) { existing = false; } // adding each child node to HashMap key =&gt; // value if (AppTitle != null) { contact.put(TAG_NAME, AppTitle); } …
score: -2
has answer: http://stackoverflow.com/a/25751379
tagged with: listview
tagged with: android-listview
has title: How to change the position of listview items?
upvote count: 0

http://stackoverflow.com/q/25864232
tagged with: java
has body: How to avoid this message on Windows XP, please? I have tried to create the exception for my domain (with trusted SSL certificate) in Java settings, put all the security levels to the lovest values but this warning still occurs. It is really annoying when I have to click on this 3 times a minute (Zebra printer printing applet). Thanks
tagged with: ssl
type: Question
tagged with: applet
has answer: http://stackoverflow.com/a/25865552
accepted answer: http://stackoverflow.com/a/25865552
tagged with: security
score: 0
has title: How to dismiss Java security warning
answer count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/25721403
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25721216
has body: I would say that it is not possible because of the way hash set works: When you insert something into a hash set, its hash is computed (a special unique value obtained through some maths) and it is then stored as a mapping from its hash to its value. No 'history' of insertion is kept. If you do want to achieve what you describe, you better choose another data structure such as a linked list. Edit: as suggested by llogiq and Sasikumar Murugesan, a good data structure that could fit your needs and keep the rest of your software as is would be to use a LinkedHashSet. This allows your software to still use HashSet elsewhere.
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40241703
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25721216

http://stackoverflow.com/comment/40308838
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25771136
has text: Could you please explain how would hibernate know that the usertypeId in user table is a foreign key refering to usertype table?
score: 0

http://stackoverflow.com/q/25845366
score: 0
answer count: 3
tagged with: sqlite
has answer: http://stackoverflow.com/a/25845788
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25845507
tagged with: java
type: Question
has title: Sqlite Inserting More Than One Records into database
has body: I need to insert about 700 records(name,id) into sqlite permanently ,because app will get user's name from the database. I think ,reading text file is a solution but not know this is the best. Can you show me other options to insert about 700 records into database? thanks
tagged with: database
has answer: http://stackoverflow.com/a/25845444
tagged with: multiple-records

http://stackoverflow.com/q/25852042
has comment: http://stackoverflow.com/comment/40453322
type: Question
tagged with: fileoutputstream
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/40452901
tagged with: locking
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/40451013
has comment: http://stackoverflow.com/comment/40450573
type: UnansweredQuestion
has title: Writing a file with lock() java
answer count: 0
score: 0
tagged with: java
has body: I'm using PDFbox to try and write over an existing empty pdf. I'm new to using lock() and can't figure out how to write to the file in that instance so I can write the information to it. I think I need a ByteStream somewhere but can't figure out how to use it. File pdfexport = new File(filename); FileChannel channel = new RandomAccessFile(pdfexport, "rw").getChannel(); if (pdfexport.exists()) { FileLock lock = channel.lock(); FileOutputStream fop = new FileOutputStream(channel.write()); //The above line says there is an error which there probably is. documentnew.save(fop); lock.release(); channel.close(); }

http://stackoverflow.com/a/25848918
type: Answer
has body: I suspect you've forgotten to enable assertions at runtime (the -ea option to the java tool, or somewhere in your runtime config if running through an IDE). If assertions are not enabled, the entire expression is completely ignroed (not executed), so you don't get an NPE. For example, with this code: class Temp { public static void main(String args[]) throws Exception{ System.out.println("Testing"); (new Temp()).testValues(null); System.out.println("Done"); } public void testValues(String str) { assert str.equals("CODE"); } } If I run it without assertions enabled, naturally no exception occurs because str.equals("CODE") is never evaluated. But if I run it with assertions enabled, I get an NPE as expected.
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/25848731

http://stackoverflow.com/comment/40251764
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25733603
score: 0
has text: No doubt, they will still be UDP packets so there will be losses. What about speed gains by bypassing the entire network stack and having access to raw packets?

http://stackoverflow.com/comment/40368854
comment on: http://stackoverflow.com/q/25807636
score: 0
has text: OK, I can't reproduce this. What aren't you telling us? Is this code exactly what you're running?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40487269
score: 0
comment on: http://stackoverflow.com/q/25872377
type: Comment
type: QuestionComment
has text: I have just typed what is needed. Assume that function1 is part of another class where all the processing is happening. And Person, Girl and this Process class is a part of the same package.

http://stackoverflow.com/comment/93054394
type: QuestionComment
comment on: http://stackoverflow.com/q/25792526
score: 0
type: Comment
has text: I am new to selenium. Even I want to achieve the above said scenario. Basically a scenario can be in multiple classes[as project is big I cannot put all test cases in single class]. I want to execute each scenario with each set of data. Meaning execute first scenario with first set of data then second & so on. I used dependsOnGroups in subsequent classes, parallel=false & group-by-instances, but still its executing 1st class with all set of data & then moving to next class. Please suggest..

http://stackoverflow.com/comment/40267629
comment on: http://stackoverflow.com/q/25748817
has text: @Taylor I am not very experienced either in any jpa but it seems like that Peristency.Supplier[ supplierid=null ] is the "toString()" called on a entity by default
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/47465147
downvote count: 1
has comment: http://stackoverflow.com/comment/109039139
has comment: http://stackoverflow.com/comment/108890145
has body: Here is a very simple answer to your question. It works. import java.time.*; import java.util.*; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; public class MyClass { public static void main(String args[]) { DateTimeFormatter T = DateTimeFormatter.ofPattern("dd/MM/yyyy HH:mm"); Scanner h = new Scanner(System.in); System.out.print("Enter date of birth[dd/mm/yyyy hh:mm]: "); String b = h.nextLine(); LocalDateTime bd = LocalDateTime.parse(b,T); LocalDateTime cd = LocalDateTime.now(); long minutes = ChronoUnit.MINUTES.between(bd, cd); long hours = ChronoUnit.HOURS.between(bd, cd); System.out.print("Age is: "+hours+ " hours, or " +minutes+ " minutes old"); } }
upvote count: 8
type: Answer
answers question: http://stackoverflow.com/q/25747499
has comment: http://stackoverflow.com/comment/104329373
score: 7

http://stackoverflow.com/comment/40388521
score: 3
comment on: http://stackoverflow.com/q/25818009
has text: Have you tried to write a regex yet?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25780782
type: Answer
has body: Byte, Double, Float, Integer, Long, Short are some of the objects that are immutable.
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25780713
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25780713

http://stackoverflow.com/a/25825986
downvote count: 0
answers question: http://stackoverflow.com/q/25825780
accepted answer of: http://stackoverflow.com/q/25825780
type: Answer
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/40402829
has body: It is up to the model to ignore hidden files. Renderer's job is display only, it should not interfere with data selection and filtering. For example you can use File.listFiles(FileFilter filter) in the model: private static final File[] EMPTY_LIST = {}; private File[] getFiles(File parent) { File[] files = parent.listFiles(new FileFilter() { @Override public boolean accept(File file) { return !file.isHidden(); } }); return files != null ? files : EMPTY_LIST; } @Override public int getChildCount(Object parent) { return getFiles((File) parent).length; } @Override public Object getChild(Object parent, int index) { return getFiles((File) parent)[index]; } @Override public int getIndexOfChild(Object parent, Object child) { File[] files = getFiles((File) parent); for (int idx = 0; idx &lt; files.length; idx++) { if (files[idx].equals(child)) return idx; } return -1; }
type: AcceptedAnswer

http://stackoverflow.com/comment/40427762
has text: Yep, your regex matches the symbol `[` which was at the start **OR** `]` at the end.
score: 0
comment on: http://stackoverflow.com/q/25839344
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25792756
score: 1
answers question: http://stackoverflow.com/q/25781529
has body: If you like to add the execution of different plugins to the same life cycle phase the execution order is defined by the order of the definition in the pom file. So if you choose to bind all the above three plugins to the package phase than they will be executed in the given order. You can of course use the antrun plugin which will work also and will implicit execute the steps in the defined order without thinking about the default behaviour of Maven. You can also use the exec-maven-plugin to execute a script in a particular life cycle phase but which might be not a good solution cause the script is OS dependent. Or you can use the groovy plugin to execute some steps in groovy code.
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/40467022
type: Comment
comment on: http://stackoverflow.com/a/25738426
has text: No Foreign keys in the tables. Now, please tell me how can I achieve this?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/65892063
score: 0
type: Comment
has text: This answer is good but fails to address the alpha channel. See other answers.
type: AnswerComment
comment on: http://stackoverflow.com/a/25761567

http://stackoverflow.com/a/25869922
downvote count: 0
type: Answer
score: 11
upvote count: 11
has body: Used XMiResourceImpl.It is Working fine for Now. XMIResourceImpl resource = new XMIResourceImpl(); File source = new File(fileName); resource.load( new FileInputStream(source), new HashMap&lt;Object,Object&gt;()); Data data = (Data)resource.getContents().get(0); for saving the model Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE; Map&lt;String, Object&gt; m = reg.getExtensionToFactoryMap(); m.put("key", new XMIResourceFactoryImpl()); ResourceSet resSet = new ResourceSetImpl(); Resource resource = resSet.createResource(URI.createFileURI(fileName)); resource.getContents().add(data); resource.save(Collections.EMPTY_MAP);
accepted answer of: http://stackoverflow.com/q/25864816
answers question: http://stackoverflow.com/q/25864816
type: AcceptedAnswer

http://stackoverflow.com/a/25827489
upvote count: 2
type: Answer
score: 2
has body: One can maintain a history of undoable actions so a list of Undos is possible. Doing an actionPerformed registers the reverse undo action restoring the state. That would fit nicely. A bit dated, und/redo essay with patterns. UndoManager.
answers question: http://stackoverflow.com/q/25827420
downvote count: 0
has comment: http://stackoverflow.com/comment/40405545

http://stackoverflow.com/a/25834579
has body: You could use String's trim method to remove whitespace before and after a given String.
type: Answer
answers question: http://stackoverflow.com/q/25834428
score: 0

http://stackoverflow.com/comment/40479629
comment on: http://stackoverflow.com/a/25865351
type: AnswerComment
score: 0
type: Comment
has text: Thanks for the suggestion, I have used a Global Focus Listener which keeps track of which `JTextArea` was last to be focused which removes the use of my `TextAction`. I will mark this as correct and provide my solution below.

http://stackoverflow.com/a/25868026
answers question: http://stackoverflow.com/q/25867429
downvote count: 0
has body: remove "session.close();" from your "finally" block.Because the session was already closed, so when compiler try to run the finally block it getting null pointer exception,
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40480055
has comment: http://stackoverflow.com/comment/40482240
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25867429

http://stackoverflow.com/a/25841306
answers question: http://stackoverflow.com/q/25840945
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40435973
has comment: http://stackoverflow.com/comment/40434946
downvote count: 0
has body: Not tested, but should work: Create a normal SBT project, define your desired settings, etc. there. Let's say it's in the path ~/parent. Note that the project folder of an SBT project is itself a project. You can depend on external projects from file system or VCS in SBT. In the builds where you want to reuse parent project, create project/project/Build.scala (or project/build.sbt) if it doesn't exist yet, define the project as usual and and add a dependency on ProjectRef(file("~/parent"), "project").
type: Answer

http://stackoverflow.com/comment/40385088
comment on: http://stackoverflow.com/a/25806988
has text: Thanks for your answer, that was exactly what i was searching for. I'm pretty sure that the picture will always be there because i created an application that allowes me to handle the camera and uploads the taken picture for me then, the problem was that I couldn't find a way to delete the picture on the phone after the upload because saving it with the same name doesn't overwrite it
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40482240
has text: I've removed `session.close()` after this an error about mysql port appeared. I changed in hibernate.cfg.xml connection url from `jdbc:mysql://$OPENSHIFT_MYSQL_DB_HOST:$OPENSHIFT_MYSQL_DB_PORT/program` to `jdbc:mysql://127.7.242.2:3306/program` and now I don't get any error. I got IP and port from the phpMyAdmin. Thank you very much!
type: AnswerComment
comment on: http://stackoverflow.com/a/25868026
score: 0
type: Comment

http://stackoverflow.com/comment/40454975
has text: It does work now. The corruption was not an serious issue. Thanks.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25853152

spring
tags question: http://stackoverflow.com/q/25724545
tags question: http://stackoverflow.com/q/25731127
tags question: http://stackoverflow.com/q/25716056
tags question: http://stackoverflow.com/q/25837461
tags question: http://stackoverflow.com/q/25792200
tags question: http://stackoverflow.com/q/25764823
tags question: http://stackoverflow.com/q/25730500
tags question: http://stackoverflow.com/q/25719208
tags question: http://stackoverflow.com/q/25777145
tags question: http://stackoverflow.com/q/25724810
tags question: http://stackoverflow.com/q/25840394
tags question: http://stackoverflow.com/q/25748048
tags question: http://stackoverflow.com/q/25740440
tags question: http://stackoverflow.com/q/25821447
tags question: http://stackoverflow.com/q/25872637
tags question: http://stackoverflow.com/q/25742852
tags question: http://stackoverflow.com/q/25808849
tags question: http://stackoverflow.com/q/25749498
tags question: http://stackoverflow.com/q/25822665
tags question: http://stackoverflow.com/q/25804122
tags question: http://stackoverflow.com/q/25840092
tags question: http://stackoverflow.com/q/25810121
tags question: http://stackoverflow.com/q/25774061
tags question: http://stackoverflow.com/q/25789490
tags question: http://stackoverflow.com/q/25864840
tags question: http://stackoverflow.com/q/25862150
tags question: http://stackoverflow.com/q/25723155
tags question: http://stackoverflow.com/q/25800387
tags question: http://stackoverflow.com/q/25867417
tags question: http://stackoverflow.com/q/25720396
tags question: http://stackoverflow.com/q/25751216
tags question: http://stackoverflow.com/q/25800324
tags question: http://stackoverflow.com/q/25732337
tags question: http://stackoverflow.com/q/25849567
tags question: http://stackoverflow.com/q/25778930
tags question: http://stackoverflow.com/q/25870095
tags question: http://stackoverflow.com/q/25763410
tags question: http://stackoverflow.com/q/25831546
tags question: http://stackoverflow.com/q/25717926
tags question: http://stackoverflow.com/q/25728347
tags question: http://stackoverflow.com/q/25762064
tags question: http://stackoverflow.com/q/25726444
tags question: http://stackoverflow.com/q/25725040
tags question: http://stackoverflow.com/q/25724786
tags question: http://stackoverflow.com/q/25844419
tags question: http://stackoverflow.com/q/25740161
tags question: http://stackoverflow.com/q/25830631
tags question: http://stackoverflow.com/q/25861379
tags question: http://stackoverflow.com/q/25777637
tags question: http://stackoverflow.com/q/25796945
tags question: http://stackoverflow.com/q/25747415
tags question: http://stackoverflow.com/q/25811438
tags question: http://stackoverflow.com/q/25856785
tags question: http://stackoverflow.com/q/25802400
tags question: http://stackoverflow.com/q/25794614
tags question: http://stackoverflow.com/q/25751254
tags question: http://stackoverflow.com/q/25858698
type: Tag
tags question: http://stackoverflow.com/q/25737018
tags question: http://stackoverflow.com/q/25733587
tags question: http://stackoverflow.com/q/25725714
tags question: http://stackoverflow.com/q/25718929
tags question: http://stackoverflow.com/q/25852359
tags question: http://stackoverflow.com/q/25747484
tags question: http://stackoverflow.com/q/25817960
tags question: http://stackoverflow.com/q/25871131
tags question: http://stackoverflow.com/q/25727099
tags question: http://stackoverflow.com/q/25761416
tags question: http://stackoverflow.com/q/25807418
tags question: http://stackoverflow.com/q/25798206
tags question: http://stackoverflow.com/q/25760765
tags question: http://stackoverflow.com/q/25853804
tags question: http://stackoverflow.com/q/25788632
tags question: http://stackoverflow.com/q/25789907
tags question: http://stackoverflow.com/q/25837944
tags question: http://stackoverflow.com/q/25759814
tags question: http://stackoverflow.com/q/25770043
tags question: http://stackoverflow.com/q/25740895
tags question: http://stackoverflow.com/q/25745022
tags question: http://stackoverflow.com/q/25857255

http://stackoverflow.com/comment/40460649
has text: @MarkoTopolnik - The accepted answer to the question I linked to is exactly what OP needs (regardless of the question itself).
comment on: http://stackoverflow.com/q/25853102
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40532670
type: AnswerComment
type: Comment
has text: I was running network request in `Async Task` but I was calling Toast.show() in `doInBackground()` method.After I removed it from there and added in `onPostExecute()` method it worked! Thanks for answering!
comment on: http://stackoverflow.com/a/25877177
score: 0

http://stackoverflow.com/comment/112690240
type: Comment
comment on: http://stackoverflow.com/q/25776903
score: 0
type: QuestionComment
has text: Same problem here, have you found a solution ?

http://stackoverflow.com/q/25781750
has comment: http://stackoverflow.com/comment/40323964
favorite count: 0
has comment: http://stackoverflow.com/comment/40322090
tagged with: linux
type: UnansweredQuestion
tagged with: windows
has body: I'm trying to run commands using Runtime.getRuntime.exec() in Java. Runtime r = Runtime.getRuntime(); Process process = r.exec("telnet 172.16.221.87 "); InputStream is = process.getInputStream(); OutputStream os = process.getOutputStream(); BufferedWriter br = new BufferedWriter(new OutputStreamWriter(os)); br.write("ditech\r\n"); br.flush(); // The exception is coming on last line that is br.flush(); When I run code in Linux, then its working fine. But when same code is run on Windows, it throws following error: java.io.IOException: The pipe is being closed at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(Unknown Source) at java.io.BufferedOutputStream.flushBuffer(Unknown Source) at java.io.BufferedOutputStream.flush(Unknown Source) at sun.nio.cs.StreamEncoder.implFlush(Unknown Source) at sun.nio.cs.StreamEncoder.flush(Unknown Source) at java.io.OutputStreamWriter.flush(Unknown Source) at java.io.BufferedWriter.flush(Unknown Source) at com.telnet.ConnectToTelnet.doTelnet(ConnectToTelnet.java:132) at com.telnet.ConnectToTelnet.main(ConnectToTelnet.java:16) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
has comment: http://stackoverflow.com/comment/40324428
has comment: http://stackoverflow.com/comment/40324023
has answer: http://stackoverflow.com/a/25799412
has comment: http://stackoverflow.com/comment/40322209
score: 2
has comment: http://stackoverflow.com/comment/40322557
upvote count: 2
tagged with: runtime.exec
tagged with: java
has comment: http://stackoverflow.com/comment/40353070
type: Question
has comment: http://stackoverflow.com/comment/40322957
has comment: http://stackoverflow.com/comment/40322769
has comment: http://stackoverflow.com/comment/40322034
has comment: http://stackoverflow.com/comment/40323790
has title: java.io.IOException: The pipe is being closed is thrown on Windows but works fine on Linux
has comment: http://stackoverflow.com/comment/40322089
has comment: http://stackoverflow.com/comment/40321958
has comment: http://stackoverflow.com/comment/40322043
has comment: http://stackoverflow.com/comment/40323884
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/40291661
has text: yeah i thought of doing like that. But already the requirement has so many selections to do. So i thought this wont be user friendly. Anyway thanks for the advice. I appreciate it.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25765469
type: AnswerComment

opennlp
type: Tag
tags question: http://stackoverflow.com/q/25815381
tag name: opennlp
tags question: http://stackoverflow.com/q/25722262

http://stackoverflow.com/a/25764716
answers question: http://stackoverflow.com/q/25763806
has comment: http://stackoverflow.com/comment/40327997
has comment: http://stackoverflow.com/comment/40296498
has comment: http://stackoverflow.com/comment/40294712
has comment: http://stackoverflow.com/comment/40320610
score: 0
type: Answer
has body: Use of JAXB parsing is very good, I think it will really be easy. You can do something like this:: DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); InputSource is = new InputSource(new StringReader(xml)); Document doc = dBuilder.parse(is); doc.getDocumentElement().normalize(); NodeList nList = doc.getElementsByTagName("XML_Parent_Element"); for (int temp = 0; temp &lt; nList.getLength(); temp++) { Node nNode = nList.item(temp); if (nNode.getNodeType() == Node.ELEMENT_NODE) { Element eElement = (Element) nNode; bean.setAttribute(eElement.getElementsByTagName("attribute_name_string") .item(temp).getAttribute()); }

http://stackoverflow.com/comment/40241895
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25713607
score: 0
has text: @shashanksoni i want your complete `web.xml` including `<?xml version=`

maven
tags question: http://stackoverflow.com/q/25840589
tags question: http://stackoverflow.com/q/25737871
tags question: http://stackoverflow.com/q/25755760
tags question: http://stackoverflow.com/q/25869266
tags question: http://stackoverflow.com/q/25726545
tags question: http://stackoverflow.com/q/25861815
tags question: http://stackoverflow.com/q/25735706
tags question: http://stackoverflow.com/q/25728094
tags question: http://stackoverflow.com/q/25798308
type: Tag
tags question: http://stackoverflow.com/q/25843055
tags question: http://stackoverflow.com/q/25768461
tags question: http://stackoverflow.com/q/25761653
tags question: http://stackoverflow.com/q/25790336
tags question: http://stackoverflow.com/q/25774695
tags question: http://stackoverflow.com/q/25749869
tags question: http://stackoverflow.com/q/25787197
tags question: http://stackoverflow.com/q/25748839
tags question: http://stackoverflow.com/q/25787127
tags question: http://stackoverflow.com/q/25744472
tags question: http://stackoverflow.com/q/25797866
tags question: http://stackoverflow.com/q/25832004
tags question: http://stackoverflow.com/q/25818759
tags question: http://stackoverflow.com/q/25747578
tags question: http://stackoverflow.com/q/25807133
tags question: http://stackoverflow.com/q/25828425
tags question: http://stackoverflow.com/q/25752970
tags question: http://stackoverflow.com/q/25835872
tags question: http://stackoverflow.com/q/25725552
tags question: http://stackoverflow.com/q/25730213
tags question: http://stackoverflow.com/q/25810725
tags question: http://stackoverflow.com/q/25747361
tags question: http://stackoverflow.com/q/25834002
tags question: http://stackoverflow.com/q/25821677
tags question: http://stackoverflow.com/q/25825854
tags question: http://stackoverflow.com/q/25728855
tags question: http://stackoverflow.com/q/25864041
tags question: http://stackoverflow.com/q/25720479
tags question: http://stackoverflow.com/q/25754850
tags question: http://stackoverflow.com/q/25759492
tags question: http://stackoverflow.com/q/25724672
tags question: http://stackoverflow.com/q/25848144
tags question: http://stackoverflow.com/q/25843650
tags question: http://stackoverflow.com/q/25742852
tags question: http://stackoverflow.com/q/25861041
tags question: http://stackoverflow.com/q/25759965
tags question: http://stackoverflow.com/q/25786790
tags question: http://stackoverflow.com/q/25759471
tags question: http://stackoverflow.com/q/25842161
tags question: http://stackoverflow.com/q/25779900
tags question: http://stackoverflow.com/q/25753220
tags question: http://stackoverflow.com/q/25847257
tags question: http://stackoverflow.com/q/25741728
tags question: http://stackoverflow.com/q/25713330
tags question: http://stackoverflow.com/q/25860087
tags question: http://stackoverflow.com/q/25732522
tags question: http://stackoverflow.com/q/25733890
tags question: http://stackoverflow.com/q/25855873
tags question: http://stackoverflow.com/q/25718398
tags question: http://stackoverflow.com/q/25778996
tags question: http://stackoverflow.com/q/25859151
tags question: http://stackoverflow.com/q/25739969
tags question: http://stackoverflow.com/q/25776903
tags question: http://stackoverflow.com/q/25840945
tags question: http://stackoverflow.com/q/25853786
tags question: http://stackoverflow.com/q/25755166
tags question: http://stackoverflow.com/q/25777975
tags question: http://stackoverflow.com/q/25811257
tags question: http://stackoverflow.com/q/25833295
tags question: http://stackoverflow.com/q/25854466
tags question: http://stackoverflow.com/q/25823582
tags question: http://stackoverflow.com/q/25744615
tags question: http://stackoverflow.com/q/25726463
tags question: http://stackoverflow.com/q/25829847
tags question: http://stackoverflow.com/q/25783822
tags question: http://stackoverflow.com/q/25719260
tags question: http://stackoverflow.com/q/25774066
tags question: http://stackoverflow.com/q/25830789
tags question: http://stackoverflow.com/q/25872624
tags question: http://stackoverflow.com/q/25742488

http://stackoverflow.com/a/25870820
type: Answer
has body: I got it working. Here's how I implemented it, the other buttons don't do a thing quite yet. All the code is in a class called Soundboard, which implements ActionListener, while javax.swing* and java.awt.event* are also imported. JButton loadButton; JButton clearButton; JButton Button1; JButton Button2; JButton Button3; JButton Button4; JPanel mainsPanel; int times; public void windowCreate() { JFrame frame = new JFrame(); mainsPanel = new JPanel(); loadButton = new JButton("Load..."); loadButton.setSize(80, 30); loadButton.setLocation(4, 4); clearButton = new JButton("Clear"); clearButton.setSize(80, 30); clearButton.setLocation(92, 4); Button1 = new JButton("1"); Button1.setSize(80, 80); Button1.setLocation(4, 45); Button2 = new JButton("2"); Button2.setSize(80, 80); Button2.setLocation(92, 45); Button3 = new JButton("3"); Button3.setSize(80, 80); Button3.setLocation(4, 133); Button4 = new JButton("4"); Button4.setSize(80, 80); Button4.setLocation(92, 133); loadButton.addActionListener(this); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.add(loadButton); frame.add(clearButton); frame.add(Button1); frame.add(Button2); frame.add(Button3); frame.add(Button4); frame.add(mainsPanel); frame.setSize(183,245); frame.setVisible(true); frame.setLocationRelativeTo(null); } @Override public void actionPerformed(ActionEvent event){ times += 1; System.out.println("Test successful - this was the #" + times + " press"); } public static void main(String[] args){ Soundboard window = new Soundboard(); window.windowCreate(); }
answers question: http://stackoverflow.com/q/25869768
score: 0

http://stackoverflow.com/a/25742808
answers question: http://stackoverflow.com/q/25742698
type: Answer
score: 0
has body: Change the type from int to Integer. Then it'll be able to be null, and you'll be able to check this at runtime.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25742698

http://stackoverflow.com/q/25786334
has comment: http://stackoverflow.com/comment/40329774
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/40329762
has comment: http://stackoverflow.com/comment/40330454
has answer: http://stackoverflow.com/a/25786600
tagged with: java
tagged with: file
type: Question
has title: Java File.exists() returns true even when file doesn't exist
has comment: http://stackoverflow.com/comment/40329620
upvote count: 2
has comment: http://stackoverflow.com/comment/40329860
score: 0
has body: String filePath = "C:\Users\d654227/Desktop/abdc.url"; // Actually its getting constructed dynamically. File file = new File(filePath); if(file.exists()){ LogUtil.logConsole(filePath+" File already exist."); file.delete(); }else { LogUtil.logConsole(filePath+" File doesnt exist."); } Using Windows 7 n IE 9. Its is getting executed through an applet. Same code works in our dev enviroinment and most of the customer places except one customer.
has comment: http://stackoverflow.com/comment/40329738
has comment: http://stackoverflow.com/comment/40329614
has comment: http://stackoverflow.com/comment/40330820
has comment: http://stackoverflow.com/comment/40329659
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/40305065
score: 0
has text: I haven't found anything. You can use an `ISaveHandler` but this only works if the part is dirty.
type: QuestionComment
comment on: http://stackoverflow.com/q/25769001
type: Comment

http://stackoverflow.com/a/25773335
upvote count: 1
answers question: http://stackoverflow.com/q/25773256
has body: Java doesn't have code that interacts with the debugger in an official way (last I heard), however many debuggers have something called a conditional breakpoint, where it will only stop if some variable or field evaluates to a specified value. So you could have your code change a value (like a constant) and set the breakpoint conditionally that way. Note that conditional breakpoints are generally a performance hit.
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25773256
score: 1
has comment: http://stackoverflow.com/comment/40344302

http://stackoverflow.com/q/25850008
downvote count: 0
has comment: http://stackoverflow.com/comment/40446345
accepted answer: http://stackoverflow.com/a/25850552
has title: How-to chain and apply a stream of comparators?
has comment: http://stackoverflow.com/comment/40446275
has comment: http://stackoverflow.com/comment/40446282
possible better answer: http://stackoverflow.com/a/25850305
favorite count: 0
has body: I have a stream of unsorted items and a stream of comparators. I want to apply all the comparators onto the stream by using "thenComparing" (Multisort) Is there a more elegant way than the following code to achive this? Stream unsorted = ...; Stream&lt;Comparator&gt; comparators = ...; Comparator compareFunc = comparators.reduce(null, (a, b) -&gt; { if(a == null) { return b; }else { return a.thenComparing(b); } }); Stream result = unsorted.sorted(compareFunc);
has answer: http://stackoverflow.com/a/25850305
tagged with: java-8
type: AnsweredQuestion
tagged with: java-stream
tagged with: java
has answer: http://stackoverflow.com/a/25850552
score: 9
type: Question
answer count: 2
upvote count: 9

http://stackoverflow.com/comment/40223555
type: QuestionComment
comment on: http://stackoverflow.com/q/25728280
score: 1
has text: Read either the whole directory, or one file at a time into RAM and then write in parallel from RAM to multiple USB pen drives.
type: Comment

http://stackoverflow.com/comment/40427212
score: 0
type: Comment
has text: Interesting enough, if I purposefully change the filename to something incorrect, it gives me a different error: "resource... relative to Main not found". So at least it is getting the right file.
comment on: http://stackoverflow.com/a/25838063
type: AnswerComment

http://stackoverflow.com/a/25845360
type: Answer
answers question: http://stackoverflow.com/q/25761400
has comment: http://stackoverflow.com/comment/82820446
has comment: http://stackoverflow.com/comment/82973196
has body: Please try the code below - tested and working Channel channel = session.openChannel("shell"); OutputStream ops = channel.getOutputStream(); PrintStream ps = new PrintStream(ops); channel.connect(); ps.println("pwd"); ps.println("exit"); ps.flush(); ps.close(); InputStream in = channel.getInputStream(); BufferedReader reader = new BufferedReader(new InputStreamReader(in)); System.out.println("Opening..."); String jarOutput; while ((jarOutput = reader.readLine()) != null) System.out.println(jarOutput); reader.close(); channel.disconnect(); Output - Opening... user@host:~> pwd /home/user user@host:~> user@host:~> exit logout
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/q/25798964
favorite count: 0
has comment: http://stackoverflow.com/comment/40354011
upvote count: 2
type: UnansweredQuestion
tagged with: stencil-buffer
score: 2
tagged with: opengl
has answer: http://stackoverflow.com/a/25800007
tagged with: java
tagged with: lwjgl
type: Question
has comment: http://stackoverflow.com/comment/40353759
downvote count: 0
has title: opengl stencils seem to have no effect
answer count: 1
linked to: http://stackoverflow.com/q/16690304
has body: I am attempting to create slightly-rounded rectangles - the idea is that these would be platforms in a game - by creating a solid white rectangle, outlining it with black rectangles, and putting circles in the corners. To keep things simple, my problem is essentially the same as this: How to set blend function on opengl for two overlapping objects I want to tackle this using stencil testing, since I've looked it up and it seems to be a good way to do it. This is what the render function of a platform object looks like: GL11.glClear(GL11.GL_STENCIL_BUFFER_BIT); // Setup stencil such that stencil = 0x01 isn't drawn over GL11.glEnable(GL11.GL_STENCIL_TEST); GL11.glStencilFunc(GL11.GL_ALWAYS, 1, 0xFF); // Do not draw if stencil byte = 1 GL11.glStencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE); // stencil is on (mask is all 1s) GL11.glStencilMask(0xFF); inside.render(st); GL11.glStencilFunc(GL11.GL_EQUAL, 1, 0xFF); // Do not draw if stencil byte = 1 left.render(st); bottom.render(st); top.render(st); right.render(st); GL11.glDisable(GL11.GL_STENCIL_TEST); inside, left, bottom, top, and right are all objects of my own Polygon class, which basically just draws the triangles for a given polygon (actually, right now it can only draw rectangles I just realized... but I digress) As far as I understand it, this is how my program should be working: Stencil test is turned on, then my first calls to glStencilFunc and glStencilOp make anything drawn also change that area on the stencil buffer to 1. Inside rectangle for the platform is drawn. This area should be all 1s on the stencil buffer now. A call to glStencilFunc now prevents drawing over areas with a stencil value of 1 The borders of the platform are drawn. Technically these rectangles overlap the inner-rectangle half way into the border's width, but since the inner-rectangle is all 1s on the stencil buffer nothing should be drawn there. Eventually, I'll have circles rendered on the corners. (which is why drawing the bor…

http://stackoverflow.com/a/25844066
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25836192
accepted answer of: http://stackoverflow.com/q/25836192
score: 1
has body: I think the error comes from this line: if(keyLine[4].equals("_s")), My solucion would be ckecking if keyLine is null or if keyLine &lt; 4: if(ss == null || ss.length()&lt;4){ return; }

http://stackoverflow.com/a/25801767
has body: You have to change the order Change return (currentEarnedCr &gt;= 120)?(REQUIRED_CR - currentEarnedCr):0; To return (currentEarnedCr &gt;= 120)?0:(REQUIRED_CR - currentEarnedCr); Why? In Ternary Operator result = someCondition ? value1 : value2; if someCondition is true result become value1 else result become value2
answers question: http://stackoverflow.com/q/25801706
score: 0
type: Answer

storage
tag name: storage
type: Tag
tags question: http://stackoverflow.com/q/25798565
tags question: http://stackoverflow.com/q/25806885

http://stackoverflow.com/comment/40441930
type: Comment
type: QuestionComment
has text: You cannot represent a network with cycles in JSON. The network must be a pure tree with no cross-connections.
score: 1
comment on: http://stackoverflow.com/q/25847561

http://stackoverflow.com/comment/40211702
type: Comment
type: QuestionComment
has text: Thank you, but that doesn't work. Rows are drawn now over eachother + I don't know at the beginning how many rows there will be.
comment on: http://stackoverflow.com/q/25721899
score: 0

http://stackoverflow.com/comment/40388980
comment on: http://stackoverflow.com/a/25817521
type: Comment
has text: Thanks! new problem: it doesn't follow the format I expect: dd/mm/yyyy, it accepts 1/9/2014 for example
score: 0
type: AnswerComment

http://stackoverflow.com/q/25788973
has title: The best way to use fragments
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25789105
tagged with: android-fragments
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25789147
has body: Problem Description In my application I'm using tabs which contains Fragments, for that purpose I use FragmentPagerAdapter in which function getItem(int position) always creates a new instance of my Fragment and return it. Question What is the best way to use Fragment Adapter Version 1 or Version 2? Source Code FragmentFavorites.java public class FragmentFavorites extends Fragment { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { /** Gets Fragmnet view. */ View rootView = inflater.inflate(R.layout.fragment_main, container, false); Logger.d("onCreateView(FragmentFavorites)"); return rootView; } }; FragmentCategories.java public class FragmentCategories extends Fragment { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { /** Gets Fragmnet view. */ View rootView = inflater.inflate(R.layout.fragment_main, container, false); Logger.d("onCreateView(FragmentCategories)"); return rootView; } }; FragmentHome.java public class FragmentHome extends Fragment { @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { /** Gets Fragmnet view. */ View rootView = inflater.inflate(R.layout.fragment_main, container, false); Logger.d("onCreateView(FragmentHome)"); return rootView; } }; FragmentFactory.java public class FragmentFactory { private static final int F_FAVORITES_INDEX = 0; private static final int F_HOME_INDEX = 1; private static final int F_CATEGORY_INDEX = 2; /** Keeps the fragments which are put in the tabs of the main screen. */ private static final ArrayList<Fragment> fragmentsList = new ArrayList<Fragment>(); static { fragmentsList.add(F_FAVORITES_INDEX, new FragmentFavorites()); fragmentsList.add(F_HOME_INDEX, new FragmentHome()); fragmentsList.add(F_CATEGORY_INDEX, new FragmentCategories()); } public static int getCount() { return fragm…
score: 0
answer count: 2

http://stackoverflow.com/comment/40426288
comment on: http://stackoverflow.com/a/25838791
has text: You'd better use @isomarcte's approach.
type: AnswerComment
score: 1
type: Comment

http://stackoverflow.com/a/25739520
has body: Instead of using addStyledParagraphOfText, I'd suggest you upload a docx sample containing what you want to the docx4j code generator, then copy/paste the code for the paragraph you want. Then just add it: wordPackage.getMainDocumentPart().getContent().add(yourp)
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25728132
score: 1
downvote count: 0

http://stackoverflow.com/a/25769543
has comment: http://stackoverflow.com/comment/40302169
has comment: http://stackoverflow.com/comment/40299548
type: Answer
has comment: http://stackoverflow.com/comment/40304142
has comment: http://stackoverflow.com/comment/40302742
has comment: http://stackoverflow.com/comment/40299372
has body: In your handler: while((s = reader.readLine()) != null) { writer.write(s + "\n"); writer.flush(); System.out.println(s); } You are only writing the string back to the sender, not to all connected sockets
answers question: http://stackoverflow.com/q/25769206
score: 0
has comment: http://stackoverflow.com/comment/40299631

http://stackoverflow.com/comment/40333080
comment on: http://stackoverflow.com/a/25788029
type: AnswerComment
has text: that's because it's known as one of the 'simple' sorts - if you're learning about advanced sorts, you might want to look at the 'advanced sorts'
score: 0
type: Comment

http://stackoverflow.com/comment/40406503
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25790336
has text: this is my run of the project: https://gist.github.com/ipolevoy/b50352c3148d60e8af35
score: 0

http://stackoverflow.com/q/25838954
type: Question
has title: I need help about pass a child as a father in a method [Java]
accepted answer: http://stackoverflow.com/a/25838983
tagged with: inheritance
has body: I need help about passing a Child in a method that expects a father, I have the class Person as superclass, Student and Teacher are subclasses of that class, so here is a code about what I'm trying :/ public static void orderByName(ArrayList&lt;Person&gt; pArray){ Collections.sort(pArray, new Comparator&lt;Person&gt;(){ @Override public int compare(Person o1, Person o2) { return o1.getName().compareTo(o2.getName()); } }); } public static void main(String[] args) { ArrayList&lt;Student&gt; estudiantes = new ArrayList&lt;Student&gt;(); familiares.add(new Student("1235", "Name2", "SecondName2", "LastParameter2")); familiares.add(new Student("1234", "Name1", "SecondName1", "LastParameter1")); orderByName(estudiantes); //Pass an ArrayList of child but expects an ArrayList of father } I need this method also with an ArrayList of Teachers, so, is posible to pass a subtype when it expects the supertype ? Thanks I hope you can help me ^_^
answer count: 3
possible better answer: http://stackoverflow.com/a/25838975
downvote count: 0
has answer: http://stackoverflow.com/a/25838975
favorite count: 0
has answer: http://stackoverflow.com/a/25839002
has answer: http://stackoverflow.com/a/25838983
tagged with: parameters
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/40479551
score: 2
type: AnswerComment
has text: +1 some good advice here. To add, code at 50% of your ability so you can debug at 100%.
type: Comment
comment on: http://stackoverflow.com/a/25868374

http://stackoverflow.com/comment/40379393
type: QuestionComment
has text: run your jar on command line: [java -jar yourJarFile.jar] and tell about what you see as exception.
score: 0
comment on: http://stackoverflow.com/q/25813325
type: Comment

http://stackoverflow.com/q/25810548
has title: JVM first 4 booleans optimized, not 5th
downvote count: 0
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/25810877
upvote count: 4
has answer: http://stackoverflow.com/a/25810736
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40374350
tagged with: java
has answer: http://stackoverflow.com/a/25810811
tagged with: memory
accepted answer: http://stackoverflow.com/a/25810811
has comment: http://stackoverflow.com/comment/40373835
type: Question
tagged with: micro-optimization
score: 4
possible better answer: http://stackoverflow.com/a/25810736
has body: I'm currently profiling some Java application using the Eclipse Memory Analyzer plugin (using a standard jconsole hprof dump), and I noticed some strange results on computed object size: private static class B1 extends B { } // 16 bytes private static class B2 extends B { boolean d1; boolean d2; boolean d3; boolean d4; } // also 16 bytes! private static class B3 extends B { boolean d1; boolean d2; boolean d3; boolean d4; boolean d5; } // 24 bytes Apparently the first 4 booleans are somehow stuffed away in the object header, how is this? Note: Tested with Oracle JDK1.7 and JDK1.8, 64 bits, running on Linux x64.
answer count: 3

http://stackoverflow.com/comment/40409653
type: Comment
comment on: http://stackoverflow.com/a/25829810
score: 0
type: AnswerComment
has text: @GurupratapSaini I think you misunderstand. I'm not suggesting making a double-linked list. I'm suggesting that your `insert()` method keep track of two links as you search for the location to insert the new node: the `previous` link as well as the `current` one. This is absolutely required to implement this correctly.

http://stackoverflow.com/a/25762049
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25760764
has body: You will see why it fails if you replace your ctx.write("Ack"); ctx.flush(); in your serverHandler with the following: ChannelFuture cf = ctx.write("Ack"); ctx.flush(); if (!cf.isSuccess()) { System.out.println("Send failed: " + cf.cause()); } It should give you a message saying that String is not supported. ByteBuf should work though: ctx.write(Unpooled.copiedBuffer("Ack", CharsetUtil.UTF_8)); ctx.flush(); on the client side edit the channelRead method: ByteBuf in = (ByteBuf) msg; System.out.println("Client received: " + in.toString(CharsetUtil.UTF_8));
type: Answer
has comment: http://stackoverflow.com/comment/40285860
score: 25
downvote count: 0
upvote count: 25
accepted answer of: http://stackoverflow.com/q/25760764

http://stackoverflow.com/a/25796085
upvote count: 3
has comment: http://stackoverflow.com/comment/40356102
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40353104
has body: When you bring the wav file in via an AudioInputStream, use the AudioFileFormat info to convert the bytes to PCM. The data for the right and left alternates. So, if the line is 16-bit, you will have 4 bytes per frame. The first two will be assembled into the left channel and the second two will be assembled into the right channel. (Or vice versa--I have trouble keeping straight in my mind which channel is left or right.) Here's a good tutorial with example on how to read a line: http://docs.oracle.com/javase/tutorial/sound/converters.html Some of the earlier tutorials in the trail might be needed to help clarify. Also, if you have questions about converting bytes to PCM and back, there are several explanations already on StackOverflow to reference. Should not be too hard to find them.
has comment: http://stackoverflow.com/comment/40352825
type: Answer
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25776803
answers question: http://stackoverflow.com/q/25776803
has comment: http://stackoverflow.com/comment/40358276

http://stackoverflow.com/a/25835575
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25834397
answers question: http://stackoverflow.com/q/25834397
has body: If I'm understanding your question correctly, you just want the same font for when you are editing as well as the font being rederered. And you can't get the editor to work right. First off... Don't mix the concept of editors and renderers. Rendering should be left to the renderer, and editing left to the editors. For further reading, see See How to use Tables: Editors and Renderers As for your case... Rendering No need for custom renderer for something as simple as setting font. Just override prepareRenderer. You can use the column value to determine which column should be which font. For instance JTable table = new JTable(data, cols) { @Override public Component prepareRenderer(TableCellRenderer renderer, int row, int col) { Component c = super.prepareRenderer(renderer, row, col); if (col == IMPACT_COL) { c.setFont(IMPACT_FONT); } else if (col == ARIAL_COL) { c.setFont(ARIAL_BOLD_FONT); } return c; } }; Editing Just set the font to a text field, then set a new cell editor for the column you want, so that it matches the same font you chose to render the column with. This way you will see the same font rendered, as well as while editing. Something like: private static final int IMPACT_COL = 0; private static final Font IMPACT_FONT = new Font("impact", Font.PLAIN, 20); ... JTextField impactField = getFontEditorField(IMPACT_FONT); TableColumn impactColumn = table.getColumnModel().getColumn(IMPACT_COL); impactColumn.setCellEditor(new DefaultCellEditor(impactField)); ... public JTextField getFontEditorField(Font font) { JTextField field = new JTextField(); field.setFont(font); return field; } Complete Example import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import javax.swing.DefaultCellEditor; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; public class Change…

http://stackoverflow.com/q/25813941
tagged with: spring
possible better answer: http://stackoverflow.com/a/25814043
answer count: 4
score: 8
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25815639
has body: I am migrating an existing project to boot. I created a brand new project using start.spring.io and copied over the source code, etc. Everything compiles, but when I do a 'mvn test' it compiles the classes but then only executes the default 'ApplicationTests' (created by start.spring.io). Here's an excerpt from the maven output: [INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ pendview --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\dev\pendview2\src\test\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ pendview --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 26 source files to C:\dev\pendview2\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.15:test (default-test) @ pendview --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ What's even stranger is that if I pass '-Dtest=TestAuthController' then it does run that specific unit test: [INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ pendview --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 26 source files to C:\dev\pendview2\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.15:test (default-test) @ pendview --- [INFO] Surefire report directory: C:\dev\pendview2\target\surefire-reports (skipped output of AuthControllerTest for brevity) ------------------------------------------------------- T E S T S -------------------------------------------------------Results : Tests run: 6, Failures: 0, Errors: 0, Skipped: 0 What am I doing wrong? Does spring boot setup a surefire config that I'm not conforming to? Any help would be greatly appreciated! -Trey
tagged with: maven
type: Question
accepted answer: http://stackoverflow.com/a/25815639
tagged with: spring-boot
tagged with: java
has answer: http://stackoverflow.com/a/35722232
has answer: http://stackoverflow.com/a/48746404
has title: Spring Boot - My unit tests are being skipped
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25814043
upvote count: 8

http://stackoverflow.com/comment/40609223
comment on: http://stackoverflow.com/a/25879993
score: 0
type: AnswerComment
has text: hi Chuk I tried using the Action builder at next step but it wont move to next as long as the page is not loaded
type: Comment

http://stackoverflow.com/a/25801384
has comment: http://stackoverflow.com/comment/40358470
has body: I would try and avoid a complicated regex, I would use String.substring() and indexOf(). That is, something like String name = "Last, First Middle"; int comma = name.indexOf(','); int lastSpace = name.lastIndexOf(' '); String lastName = name.substring(0, comma); String firstName = name.substring(comma + 2, lastSpace); String middleName = name.substring(lastSpace + 1); System.out.printf("first='%s' middle='%s' last='%s'%n", firstName, middleName, lastName); Output is first='First' middle='Middle' last='Last'
downvote count: 0
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/40357990
has comment: http://stackoverflow.com/comment/40359999
score: 6
answers question: http://stackoverflow.com/q/25801247

http://stackoverflow.com/q/25757448
has comment: http://stackoverflow.com/comment/40277762
has answer: http://stackoverflow.com/a/25757602
has comment: http://stackoverflow.com/comment/40277832
type: Question
has comment: http://stackoverflow.com/comment/40277758
has comment: http://stackoverflow.com/comment/40277796
has comment: http://stackoverflow.com/comment/40278807
has comment: http://stackoverflow.com/comment/40277939
tagged with: arrays
has title: How to determine duplicate elements in an array?
score: 0
has answer: http://stackoverflow.com/a/25757955
has comment: http://stackoverflow.com/comment/40277717
has comment: http://stackoverflow.com/comment/40277755
answer count: 4
has answer: http://stackoverflow.com/a/25757514
has comment: http://stackoverflow.com/comment/40278354
has comment: http://stackoverflow.com/comment/40278862
has answer: http://stackoverflow.com/a/25757599
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40586568
has body: I try to compare elements of array with each other during for loop. In my case, I have some duplicate values that I couldn't delete for some reasons but I have to determine them. Here is what I have and it's not working for me int x; int table[] = {1, 2, 2, 3, 4, 5, 5, 6, 7, 8, 9, 9, 10}; for (x = 0; x &lt;= table.length; x++) { if (x == 0 || x + 1 &lt; table.length) { //determine that element is not last if (table[x] == table[x + 1]) { //determine if next element is the same System.out.println(table[x] + "if x = x + 1"); } //determine that element is equal to previous but not equal to next if (table[x] != table[x + 1] &amp;&amp; table[x] == table[x - 1]) { System.out.println(table[x] + " if x != x + 1 but x = x - 1"); } else { System.out.println(table[x]); } } if (x + 1 == table.length) { //determine that element is last System.out.println(table[x]); } }
tagged with: java

http://stackoverflow.com/a/25873524
downvote count: 1
has body: Make one array which contains both arrays. In your case int[2][][] = { {{1,2},{2,3},{4,5}}, {{1,2},{2,3},{4,5}} }; Or better, make an object which contains both arrays.
type: Answer
answers question: http://stackoverflow.com/q/25873507
score: 5
upvote count: 6
has comment: http://stackoverflow.com/comment/40490276

http://stackoverflow.com/comment/40257554
type: Comment
type: QuestionComment
has text: Just added the ArrayList -> TreeSet code
comment on: http://stackoverflow.com/q/25746280
score: 0

wildfly-8
tags question: http://stackoverflow.com/q/25766872
type: Tag
tag name: wildfly-8
tags question: http://stackoverflow.com/q/25853651
tags question: http://stackoverflow.com/q/25760025
tags question: http://stackoverflow.com/q/25748932
tags question: http://stackoverflow.com/q/25856580

http://stackoverflow.com/comment/40461459
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25858105
has text: It is not clear to me what your issue is?
score: 0

http://stackoverflow.com/comment/40535060
comment on: http://stackoverflow.com/a/25878352
score: 1
type: AnswerComment
has text: what you need is to match the value of a literal to an individual. By this I mean that you need to find `i`, in my example, where lit has lexical form "1", nd get the other values for stringValue for that individual
type: Comment

http://stackoverflow.com/a/25724776
type: Answer
answers question: http://stackoverflow.com/q/25724455
has body: Try this: System.out.printf ("%-20s %-15s %10s %n" , heading1, heading2, heading3); System.out.printf ("%-20s %-15.2f %.2f %n" , num1, square1, sqrt1); System.out.printf ("%-20s %-15.2f %.2f %n" , num2, square2, sqrt2); System.out.printf ("%-20s %-15.2f %.2f %n" , num3, square3, sqrt3);
score: 0

http://stackoverflow.com/comment/40470306
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25863059
has text: Would be helpful to post how you register your filter (e.g. `web.xml`) and your filter code (not necessarily the whole).

http://stackoverflow.com/q/25806469
has title: Java exception client authentication TLS: password must not be null
type: Question
answer count: 2
tagged with: ssl
score: 4
tagged with: ejbca
has answer: http://stackoverflow.com/a/30188382
favorite count: 0
has body: I wrote this code to communicate with ejbca server (JBoss 5.1.0.GA-jdk6, EJBCA 4.0.10 and openjdk-6-jdk ): CryptoProviderTools.installBCProvider(); String urlstr = "https://ejbca05:8443/ejbca/ejbcaws/ejbcaws?wsdl"; System.setProperty("javax.net.ssl.trustStore","C:\\Users\\l.\\keystore.jks"); System.setProperty("javax.net.ssl.trustStorePassword","provae"); System.setProperty("javax.net.ssl.keyStore","C:\\Users\\l.\\keystore.jks"); System.setProperty("javax.net.sslews.keyStorePassword","provae"); QName qname = new QName("http://ws.protocol.core.ejbca.org/", "EjbcaWSService"); EjbcaWSService service = null; try { service = new EjbcaWSService(new URL(urlstr),qname); } catch (MalformedURLException e) { // TODO Auto-generated catch block System.out.println("errore nell'url"); } EjbcaWS ejbcaraws = service.getEjbcaWSPort(); but I have this exception: Exception in thread "main" javax.xml.ws.WebServiceException: Failed to access the WSDL at: https://ejbca05:8443/ejbca/ejbcaws/ejbcaws?wsdl. It failed with: Got java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) while opening stream from https://ejbca05:8443/ejbca/ejbcaws/ejbcaws?wsdl. at com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser.tryWithMex(RuntimeWSDLParser.java:173) .......... ....... Caused by: java.security.UnrecoverableKeyException: Password must not be null at sun.security.provider.JavaKeyStore.engineGetKey(JavaKeyStore.java:124) at sun.security.provider.JavaKeyStore$JKS.engineGetKey(JavaKeyStore.java:55) at java.security.KeyStore.getKey(KeyStore.java:792) The keystore is superadmin.p12 converted to jks. I have also tried with other keystore created with ejbca or with keytool but i get the same error. Anyone know why?
has answer: http://stackoverflow.com/a/25810052
accepted answer: http://stackoverflow.com/a/25810052
tagged with: keystore
has comment: http://stackoverflow.com/comment/81508896
upvote count: 4
possible better answer: http://stackoverflow.com/a/30188382
tagged with: passwords
type: AnsweredQuestion
downvote count: 0
tagged with: java

jboss6.x
tag name: jboss6.x
type: Tag
tags question: http://stackoverflow.com/q/25807950
tags question: http://stackoverflow.com/q/25789584
tags question: http://stackoverflow.com/q/25804948
tags question: http://stackoverflow.com/q/25802910
tags question: http://stackoverflow.com/q/25726532

http://stackoverflow.com/comment/134499484
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/74208102
has text: I had to use version 11 of the JDK for Apache Directory Studio, it wasn't working with either version 17 or 16.

http://stackoverflow.com/q/25797441
downvote count: 0
accepted answer: http://stackoverflow.com/a/25797902
favorite count: 0
has body: I was running a java application roughly like the one below: InputStreamReader isReader = new InputStreamReader(System.in); BufferedReader bufReader = new BufferedReader(isReader); while (true) { try { String inputStr = null; if ((inputStr=bufReader.readLine()) != null) { //DO SOMETHING } else { System.out.println("input is null"); } } catch (Exception e) { //DO SOMETHING } } using this command java test &lt; textfilename but after all the things are read in, the application starts to keep printing input is null. Of course I can add break; below System.out.println("input is null");, but does there exist a way that can clears the input buffer and starts to get input from command line? PS: An example of a file I am using: 11111111 11111112 11111113 11111114
has comment: http://stackoverflow.com/comment/40351713
has title: How to "reset" or "clear" System.in using java application?
type: AnsweredQuestion
score: 3
upvote count: 3
possible better answer: http://stackoverflow.com/a/25798091
tagged with: java
has answer: http://stackoverflow.com/a/25798091
has answer: http://stackoverflow.com/a/25797902
type: Question
has comment: http://stackoverflow.com/comment/40350827
has answer: http://stackoverflow.com/a/25797988
tagged with: bash
answer count: 3

http://stackoverflow.com/q/25756242
tagged with: java
has comment: http://stackoverflow.com/comment/40275728
type: AnsweredQuestion
has body: So, simple question that seems to be baffling me. I have a series of ArrayList because they need to be expandable. Now, I would like to be able to pull the nth object from each one with a simple for loop. public ArrayList&lt;String&gt; name = new ArrayList&lt;String&gt;(); public ArrayList&lt;Integer&gt; stamina = new ArrayList&lt;Integer&gt;(); public ArrayList&lt;Integer&gt; heart = new ArrayList&lt;Integer&gt;(); public ArrayList&lt;Integer&gt; intel = new ArrayList&lt;Integer&gt;(); public ArrayList&lt;Integer&gt; speed = new ArrayList&lt;Integer&gt;(); I'll be adding/pulling information from these later in my code, so I would like it to be easily accessible via a single 2D array. With something like, racerInfo[][] = { name, stamina, heart, intel, speed }; Then if I want information for, say, racer number 7 for ( int i=0; i&lt;=racerInfo.length - 1; i++ ) { System.out.println(racerInfo[i][7]); } How would I go about setting up the racerInfo field? I can't seem to figure out the right setup. If you have any better suggestions for the rest I am completely open as I am still very new to this and just attempting to cobble something together that works.
tagged with: arrays
possible better answer: http://stackoverflow.com/a/25756264
accepted answer: http://stackoverflow.com/a/25756281
tagged with: arraylist
has answer: http://stackoverflow.com/a/25756264
type: Question
has comment: http://stackoverflow.com/comment/40275836
has title: An array of ArrayLists?
has comment: http://stackoverflow.com/comment/40275723
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25756281

http://stackoverflow.com/comment/40306334
type: QuestionComment
score: 0
has text: [This post](https://github.com/playgameservices/android-basic-samples/issues/48) isn't the same issue as yours but *may* help. Scroll down to the guys with multiple G+ accounts problem.
comment on: http://stackoverflow.com/q/25772915
type: Comment

http://stackoverflow.com/a/25737962
upvote count: 1
has comment: http://stackoverflow.com/comment/40256404
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25737778
has comment: http://stackoverflow.com/comment/40249718
has body: You can use ArrayaList to for quicker comparison.Assign the string array to an Array list and use the .equals () ? Method Here is an example: String[] array1 = {"1", "2", "3"}; String[] array2 = {"1", "2", "3"}; String[] array3 = {"1", "2", "3"}; List&lt;List&lt;String&gt;&gt; lst1 = new ArrayList&lt;&gt;(); lst1.add(Arrays.asList(array1)); List&lt;List&lt;String&gt;&gt; lst2 = new ArrayList&lt;&gt;(); lst2.add(Arrays.asList(array2)); List&lt;List&lt;String&gt;&gt; lst3 = new ArrayList&lt;&gt;(); lst3.add(Arrays.asList(array3)); System.out.println(lst1.equals(lst2) &amp;&amp; lst1.equals(lst3)); //prints true

http://stackoverflow.com/q/25712918
score: 0
has answer: http://stackoverflow.com/a/25712965
answer count: 3
possible better answer: http://stackoverflow.com/a/25712961
has title: How to make dialog show multiple line?
has answer: http://stackoverflow.com/a/25712961
has answer: http://stackoverflow.com/a/25712983
accepted answer: http://stackoverflow.com/a/25712983
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: dialog
has body: I am trying to make dialog show the all answers in one dialog but in multiple lines and I got no idea because after I add \n it show \n in the line too here is my code (I just deleted \n line as it doesn't work at all) Scanner keyboard= new Scanner (System.in); int firstnumber= Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter the first number")); int secondnumber= Integer.parseInt(JOptionPane.showInputDialog(null, "Please enter the second number")); int minus= firstnumber - secondnumber; int sum= firstnumber + secondnumber; //sum the first number and second number JOptionPane.showMessageDialog (null,"" + firstnumber + " + " + secondnumber + " = " + sum + ""+firstnumber+"-"+secondnumber+"="+minus, "Result", JOptionPane.INFORMATION_MESSAGE);

http://stackoverflow.com/comment/40318482
has text: what exactly the output after `final KafkaStream<String, String> stream = streams.get(0);` line ? did you use any debugger ?
score: 0
comment on: http://stackoverflow.com/q/25777178
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25830760
tagged with: android-context
has answer: http://stackoverflow.com/a/25830916
tagged with: android
tagged with: sqlite
has answer: http://stackoverflow.com/a/25830796
has title: Android : Scheduling a database call in future
upvote count: 1
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/25830796
tagged with: java
type: Question
has body: I want to schedule some code to be executed in future. What I want to be done in future is that the future process should call a webservice and do something, after that it should call the local database that I have (SQLite) and do some update on it. I was going to use Handler for this purpose. Wherein I'll pass the Runnable object to it, and inside runnable I'll call AsyncTask to call the webservice, and on the onPostExecute I'll call my local db and do the update. But the problem is that when I call the db, it is going to require a context to open itself. Now I looked up if I can pass null to it, but then it says that it will create an inmemory database, instead of giving my database that I've created already. Now, I can pass the context info from the place where I am creating the runnable instance, but what exactly happens if I keep my 'context' object alive. That context is not going to be used anywhere but in the database. What will be the best way to work this through? Thanks
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40411606
favorite count: 0
possible better answer: http://stackoverflow.com/a/25830916

http://stackoverflow.com/comment/40343299
type: QuestionComment
comment on: http://stackoverflow.com/q/25793575
has text: What does `currentType.getClass().getName()` return? I think it isn't what you expect. I suggest you google the javadocs for this method.
score: 0
type: Comment

http://stackoverflow.com/comment/40411416
score: 0
has text: So that is your problem. you are trying to access a view from the activity which is clearly not there. You should gain a reference in your corresponding fragment instead of the activity
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25830811

http://stackoverflow.com/comment/40241421
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25737503
has text: thanks.how to retrieve two product_code? eg.first product_code when customer buy and second product if customer buy frist product_code git free second product_code. I want to do this action.
score: 0

http://stackoverflow.com/q/25732430
has comment: http://stackoverflow.com/comment/40350701
has comment: http://stackoverflow.com/comment/40290853
has comment: http://stackoverflow.com/comment/40349582
answer count: 0
has comment: http://stackoverflow.com/comment/40233506
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40311280
has comment: http://stackoverflow.com/comment/40257395
has comment: http://stackoverflow.com/comment/40271806
tagged with: spring-remoting
tagged with: java
has comment: http://stackoverflow.com/comment/40373073
type: Question
tagged with: spring-amqp
tagged with: amqp
has title: java/spring remoting options
has body: I have a java method that returns a byte array and the size can very from few KB to a few hundred MB. I want to make this method available for remote execution maintaining good performance so that clients can get the data and process it further. I looked at Apache Thrift, ICE, and zeromq so far but i was curious to find something which can be used as library (jar) alone in a all java/spring environment involving a standalone application. Is there any such thing available, i would appreciate any recommendation on this subject. Thank you
score: 0
tagged with: remoting

http://stackoverflow.com/q/25859178
has answer: http://stackoverflow.com/a/25860770
tagged with: java
tagged with: sleep
type: Question
has body: So I've had an idea in my head today... And I would like to hear some feed-back. I have a Java app which needs to check a directory every 5 minutes. Plain and simple the app needs to run every five minutes. Seems like a good candidate for cronjob, but I was wondering... why not keep the logic/timing all within the app like so (simplified obviously): public static void main(String[] args) { while(true) { // repeatedly execute... // do the work/job Thread.sleep(600 * 1000); // make the thread sleep for 5 minutes } } One significant downside I see is "How do we stop this app once it starts? Deleting it? Are there any other significant draw-backs to this besides that one? Should I stop daydreaming and just use cron jobs?
tagged with: infinite-loop
has answer: http://stackoverflow.com/a/25859229
has answer: http://stackoverflow.com/a/25859246
tagged with: cron
downvote count: 1
accepted answer: http://stackoverflow.com/a/25860783
favorite count: 0
possible better answer: http://stackoverflow.com/a/25859229
tagged with: multithreading
has title: Infinite loop + Thread.sleep replace cron job
upvote count: 4
has answer: http://stackoverflow.com/a/25860783
answer count: 4
type: AnsweredQuestion
score: 3

http://stackoverflow.com/comment/40364926
score: 0
has text: Can you add spring configuration, Customer and Create classes? ... furthermore why to method marshalSendAndReceive you dont put directly create object?
comment on: http://stackoverflow.com/q/25805166
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40463411
type: QuestionComment
has text: `to have a void always running` what?
score: 0
comment on: http://stackoverflow.com/q/25859081
type: Comment

http://stackoverflow.com/comment/40210226
score: 0
has text: @matthelliwell here is one of my queries select CompanyInfo._id, CompanyInfo.name_en, ContactInfo.telephones, ContactInfo.location, CompanyInfo.websites, ContactInfo.address_en, ContactInfo.location, ContactInfo.position, TopFirmsByCode.Level, ContactInfo.name_en from CompanyInfo, ContactInfo, TopFirmsByCode where CompanyInfo._id=TopFirmsByCode.RegNo AND CompanyInfo._id=ContactInfo._id AND TopFirmsByCode.Code = '458' order by TopFirmsByCode.Level ASC, CompanyInfo.rating_ordering_en ASC
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25718356

http://stackoverflow.com/a/25770948
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25770890
upvote count: 2
has body: when you do Character x = 'B' it invokes Character.valueOf(C) 2: invokestatic #16 // Method java/lang/Character.valueOf:(C)Ljava/lang/Character; which caches This method will always cache values in the range '\u0000' to '\u007F', inclusive, and may cache other values outside of this range. public static Character valueOf(char c) { if(c &lt;= 127) { // must cache return CharacterCache.cache[(int)c]; } return new Character(c); } Similar Integer wrapper class and == operator - where is behavior specified?

http://stackoverflow.com/a/25819036
downvote count: 0
score: 1
upvote count: 1
has body: input is not defined before its used. Retry with following code. import java.util.Scanner; public class CodeSnippetm01 { public static void main(String[] args, int len) { //0. Variable declarations. String greeting = "Welcome to CST242!"; String question1 = "What is your name?:"; //1. Print Statement. System.out.println(greeting); System.out.println(question1); Scanner keyboard = new Scanner(System.in); String input = keyboard.nextLine(); len = input.length(); //2. Code for prompt and input while (len &gt; 0) { input = keyboard.nextLine(); System.out.println("String Length is : " + len); //3. Loop code and loop body. } //4. Multiway If block. } }
type: Answer
answers question: http://stackoverflow.com/q/25818992

http://stackoverflow.com/comment/40363432
type: AnswerComment
comment on: http://stackoverflow.com/a/25804505
score: 0
type: Comment
has text: I did what Ruchira did just a little differently String str = "123665985"; StringBuilder builder = new StringBuilder(str); builder.insert(3, '-'); builder.insert(6, '-'); builder.toString();

http://stackoverflow.com/comment/40329156
has text: when i am opening the same downloaded(.xlsx) file in notepad++ , able to view the content.
type: Comment
comment on: http://stackoverflow.com/a/25783264
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40471401
has text: Thanks for your suggestion but this was the question actually what you suggested.
type: AnswerComment
comment on: http://stackoverflow.com/a/25863219
score: 0
type: Comment

http://stackoverflow.com/comment/40231637
type: Comment
comment on: http://stackoverflow.com/a/25732565
type: AnswerComment
score: 5
has text: Sure, if you completely change the OP's code, it will behave differently.

http://stackoverflow.com/comment/40400099
type: QuestionComment
has text: Maybe you are looking for ThreadLocal (http://docs.oracle.com/javase/7/docs/api/java/lang/ThreadLocal.html) state variables instead of static?
comment on: http://stackoverflow.com/q/25824604
score: 0
type: Comment

file
tags question: http://stackoverflow.com/q/25858947
type: Tag
tags question: http://stackoverflow.com/q/25832838
tags question: http://stackoverflow.com/q/25786334
tags question: http://stackoverflow.com/q/25770561
tags question: http://stackoverflow.com/q/25744779
tags question: http://stackoverflow.com/q/25720727
tags question: http://stackoverflow.com/q/25847296
tags question: http://stackoverflow.com/q/25747583
tags question: http://stackoverflow.com/q/25821845
tags question: http://stackoverflow.com/q/25830046
tags question: http://stackoverflow.com/q/25764837
tags question: http://stackoverflow.com/q/25847089
tags question: http://stackoverflow.com/q/25748270
tag name: file
tags question: http://stackoverflow.com/q/25792346
tags question: http://stackoverflow.com/q/25833942
tags question: http://stackoverflow.com/q/25779952
tags question: http://stackoverflow.com/q/25760676
tags question: http://stackoverflow.com/q/25759894
tags question: http://stackoverflow.com/q/25728280
tags question: http://stackoverflow.com/q/25855059
tags question: http://stackoverflow.com/q/25780721
tags question: http://stackoverflow.com/q/25808785
tags question: http://stackoverflow.com/q/25813115
tags question: http://stackoverflow.com/q/25819640
tags question: http://stackoverflow.com/q/25778285
tags question: http://stackoverflow.com/q/25714779
tags question: http://stackoverflow.com/q/25797966
tags question: http://stackoverflow.com/q/25824706
tags question: http://stackoverflow.com/q/25843424
tags question: http://stackoverflow.com/q/25856919
tags question: http://stackoverflow.com/q/25787641
tags question: http://stackoverflow.com/q/25721366
tags question: http://stackoverflow.com/q/25833253
tags question: http://stackoverflow.com/q/25720294
tags question: http://stackoverflow.com/q/25860696
tags question: http://stackoverflow.com/q/25777253
tags question: http://stackoverflow.com/q/25812976
tags question: http://stackoverflow.com/q/25740672
tags question: http://stackoverflow.com/q/25739088
tags question: http://stackoverflow.com/q/25742248
tags question: http://stackoverflow.com/q/25840762
tags question: http://stackoverflow.com/q/25740352
tags question: http://stackoverflow.com/q/25854729
tags question: http://stackoverflow.com/q/25740468
tags question: http://stackoverflow.com/q/25759907
tags question: http://stackoverflow.com/q/25763205

encode
tags question: http://stackoverflow.com/q/25852380
type: Tag
tags question: http://stackoverflow.com/q/25774823
tag name: encode
tags question: http://stackoverflow.com/q/25766671
tags question: http://stackoverflow.com/q/25739773

http://stackoverflow.com/a/25851727
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25850950
has body: The @Async documentation can be found here. In short, to get @Async to work, you need to declare an Executor. This Executor will be responsible for executing your @Async annotated method. In a typical application, you would declare a thread pool backed Executor. When you invoke your @Async method, a proxy will intercept the invocation, create a Runnable (or Callable) and submit it to the Executor. It will then return immediately. So the call to the @Async method is never blocking. However, if your Executor doesn't have any available threads, ie. they are all busy executing other submitted tasks, the @Async task you submitted will remain in a queue until a thread becomes available.
answers question: http://stackoverflow.com/q/25850950
type: Answer

http://stackoverflow.com/q/25859509
type: AnsweredQuestion
tagged with: jdbc
score: 1
has answer: http://stackoverflow.com/a/25860560
linked to: http://stackoverflow.com/q/7284161
favorite count: 0
tagged with: ruby
type: Question
has body: My code depends on some gems that are only available in C Ruby so I cannot use JRuby. Is there any way to use java libraries such as JDBC drivers in C Ruby?
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40464021
tagged with: rubygems
tagged with: java
accepted answer: http://stackoverflow.com/a/25860560
has comment: http://stackoverflow.com/comment/40464741
has title: How do I use a Java library (like JDBC) in C Ruby?
downvote count: 0

http://stackoverflow.com/comment/40428071
type: QuestionComment
comment on: http://stackoverflow.com/q/25839613
score: 0
type: Comment
has text: does ur project includes any game lib?

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/25775856
tags question: http://stackoverflow.com/q/25727660
tags question: http://stackoverflow.com/q/25799325
type: Tag

http://stackoverflow.com/comment/40202346
type: Comment
type: QuestionComment
has text: Try to hit your server URL in a browser. Most likely the returned certificated/chain is not proper.
comment on: http://stackoverflow.com/q/25716988
score: 0

http://stackoverflow.com/comment/40523502
type: Comment
has text: Excuse me: could you confirm I just need: buildscript { dependencies { classpath 'com.android.tools.build:gradle:0.11.1' } } apply plugin: 'android' android { compileSdkVersion 19 buildToolsVersion "19.0.0" } for my project following all conventions. That tool seems to allow things I do not really need.
type: AnswerComment
comment on: http://stackoverflow.com/a/25820929
score: 0

http://stackoverflow.com/a/25776311
score: 0
type: Answer
has body: As stated in the comments, having 2 times response.sendRedirect(...) is a nonsense. By issuing response.sendRedirect(...) you're actually sending response to the client like this: HTTP/1.1 302 Found Location: http://redirectmehere.com The client's browser then makes a new request to the url which is passed in Location http header. GET / HTTP/1.1 Host: redirectmehere.com Browser couldn't choose where to really redirect, if you would redirect 2 times in a single request. However you could make a redirect chain. So that redirectmehere.com would redirect you further to redirectmehere-b.com. So your user would end on redirectmehere-b.com.
answers question: http://stackoverflow.com/q/25775604

http://stackoverflow.com/q/25737493
upvote count: 2
type: UnansweredQuestion
tagged with: loops
has title: How to use looping in selenium webdriver java when every next generated element will have different names
tagged with: java
type: Question
answer count: 2
tagged with: for-loop
score: 2
has answer: http://stackoverflow.com/a/25738513
downvote count: 0
has answer: http://stackoverflow.com/a/25742998
has body: UI Project The scenario of the image above is the user can fill in all the details per partner, the user can add a maximum of 20 partners by clicking the add partner button, every time the user will add a new partner details the webpage elements will generate a new elements for example: given name textbox for partner 1 is = partner[0][person][given_name] . if the user adds another set of partner details the element for partner 2 given name will be: given name textbox for partner 2 is = partner[1][person][given_name] . so every time the user adds a partner details the index for elements will increment. Here is my code im using selenium webdriver using java and hybrid automation framework. I want to use looping on this code, is it possible to use looping in this kind of framework? cause if i don't have to use loop, i have to write my action class like 20 times and i will need to find all the elements for each partner which is not logical thing to do. Please guide me. on how to make these code easier specially on making my code shorter. // Here's my Page Object repository (its where i store my web page elements) // I have put a parameter (value) on my elements index public class RegistrationPage extends BaseClass { private static WebElement element; public RegistrationPage(WebDriver driver){ super(driver); } public static WebElement txtbx_GivenName(int value){ try{ element = driver.findElement(By.name("partner["+value+"][person][given_name]")); Log.info("Given name textbox found"); }catch (Exception e){ Log.error("Given name textbox is not found on the Register Page"); throw(e); } return element; } public static WebElement txtbx_LastName(int value){ try{ element = driver.findElement(By.name("partner["+value+"][person][last_name]")); Log.info("Last name textbox found"); }catch (Exception e){ Log.error("Last name textbox is not found on the Register Page"); throw(e); } return element; } public static WebElement txtbx_Email(int value){ try{ element = driver.findElement(By…
favorite count: 0
tagged with: selenium-webdriver

http://stackoverflow.com/a/25836127
has comment: http://stackoverflow.com/comment/40426380
type: Answer
has comment: http://stackoverflow.com/comment/40423671
answers question: http://stackoverflow.com/q/25835325
score: 1
has comment: http://stackoverflow.com/comment/40427609
has body: If the input ranges are already ordered from smallest to largest (B[i] &lt;= A[i+1]): int bottomRangeIndex = 0; int topRangeIndex = numberOfABRangesYouHave - 1; int answerCounter = 0; C.sort(); // Sort C so that it goes from smallest to largest number. for number in C: { if (number &lt; A[bottomRangeIndex]) { continue; } else if (number &gt; B[topRangeIndex]) { return answerCounter; } else { while ((number &gt; B[bottomRangeIndex++]) &amp;&amp; (bottomRangeIndex &lt;= topRangeIndex)) { // Just keeps incrementing bottomRangeIndex. } if (bottomRangeIndex &gt; topRangeIndex) { return answerCounter; } else { answerCounter++; bottomRangeIndex++; } } } This might have some bug that I am not thinking of, but basically what this does is: Sorts C. I know you say you can't do this, but I fail to see why unless it's a homework problem. Skips checking anything in the A,B ranges if the number from C falls completely outside of those ranges. If the current number is greater than the biggest number in the A,B ranges (B[topRangeIndex]), return the current answer counter because no further element from C (sorted) could be in the A,B ranges again. Since C is sorted and the current number is greater than the bottom element in all A,B ranges, starts checking if the number in C falls inside the B end of each A range. The number being checked is always the smallest element in C, so if it fails to fall within the B end of an A range, that A,B range should never be checked again so the bottomRangeIndex is incremented. If every range has been eliminated by the while loop, we are done checking (the current element in C is greater than the biggest number in any A,B range, we do not need to check anything else. If the number in C being checked was NOT greater than a number at the end of an A,B range (located at bottomRangeIndex), that A,B range contained an element from C. We increment the answer counter, move the bottomRangeIndex up, and continue. Try this and see if it works. If this is home…
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/25756900
has answer: http://stackoverflow.com/a/25756949
has answer: http://stackoverflow.com/a/25756925
has comment: http://stackoverflow.com/comment/40276831
has comment: http://stackoverflow.com/comment/40277666
has comment: http://stackoverflow.com/comment/40278701
downvote count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/40301496
has body: I wrote a Java web based program to display ASCII value of given character. but it is not working properly. pls help me. this is my code. no need to add characters to the database. main bean public mainbean() {} private String charTest; public String getCharTest() { return charTest; } public void setCharTest(String charTest) { this.charTest = charTest; } public String DoDisplay() throws IOException { BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); // System.out.println("Enter the char:"); // String str = buff.readLine(); String str = buff.readLine(); // for ( int i = 0; i < str.length(); ++i){ int i = 0; char c = str.charAt(i); int j = (int) c; FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "ASCII OF" + c + "=" + j, "")); return null; } this is my xhtml page <h:head> Complain System </h:head> <h:body> <h:form id="form"> <h:outputText value="name"/> <p:inputText value="#{mainbean.charTest}"/> <p:commandButton value="submit" ajax="false" action="#{mainbean.doDisplay()}"/> </h:form> </h:body> This is Ctrl page public class charCtrl { private EntityManager em; public static void add() throws IOException { BufferedReader buff = new BufferedReader(new InputStreamReader(System.in)); String str = buff.readLine(); int i = 0; char c = str.charAt(i); int j = (int) c; FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "ASCII OF" + c + "=" + j, "")); } }
has comment: http://stackoverflow.com/comment/40276833
score: 1
tagged with: java
tagged with: ascii
answer count: 2
upvote count: 1
has title: Display an ASCII value of a given character
favorite count: 0

http://stackoverflow.com/comment/139475857
type: Comment
comment on: http://stackoverflow.com/a/54446094
has text: He had a totally valid point: Serializing default values is waste of space. If you accept missing values on deserialization (and hence then get the default value), it makes no sense to send over userId = 0 - because it would become that anyway. It is obvious will nulls, but all numbers and booleans also have default values - as you yourself point out.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25825834
accepted answer: http://stackoverflow.com/a/25897192
has comment: http://stackoverflow.com/comment/40404682
has comment: http://stackoverflow.com/comment/40532064
has comment: http://stackoverflow.com/comment/40440427
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40403435
downvote count: 0
has comment: http://stackoverflow.com/comment/40506796
type: Question
score: 3
has answer: http://stackoverflow.com/a/25897192
has body: I am building a java robot that after a search of a keyword in a browser the mouse will move directly to this instance of this keyword (which is highlighted). My problem is a I do not know the position (x,y) in advance I cannot use mouseMove(x,y).
favorite count: 0
upvote count: 3
answer count: 1
has title: Java Robot : how to click on first text highlighted (using the search function) in a browser?
has comment: http://stackoverflow.com/comment/40404051
tagged with: bots
tagged with: java
has comment: http://stackoverflow.com/comment/40404158

http://stackoverflow.com/q/25763848
tagged with: java
has body: I how a lot of controllers that can return null as result. My goal is to verify it for correctness and throw appropriate exception. Will be good to know your thoughts: How it can be achived using spring stuff(Is already exist any filter to filter ajax call in sping mvc)? Will be it corect to create some servlet filter or interceptor in this case? Another way how it can be achived. Thanks in advance!
answer count: 1
has answer: http://stackoverflow.com/a/25766398
score: 0
tagged with: filter
tagged with: interceptor
has title: Verifying response for AJAX calls in Spring MVC
type: UnansweredQuestion
tagged with: spring
type: Question
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40290874

http://stackoverflow.com/q/25790288
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/28187782
linked to: http://stackoverflow.com/q/18954873
has answer: http://stackoverflow.com/a/28187782
score: 1
tagged with: java
tagged with: sonarqube
has title: May expose internal representation by incorporating reference to mutable object
has body: I have the following in my code: But why is this giving the Sonar error? Error is on line: this.lastAccessTime = lastAccessTime; The date here is already declared private. public class myClass{ @Temporal(TemporalType.TIMESTAMP) @Column(name = "LAST_ACCESS_TIME", nullable = false) private Date lastAccessTime; /** * Constructor * * @param userId the user id * @param screenName the name of screen * @param lastAccessTime time of last access */ public userTO(String userId, String screenName, Date lastAccessTime) { this.userId = userId; this.screenName = screenName; this.lastAccessTime = lastAccessTime; } }
duplicate of: http://stackoverflow.com/q/18954873
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25790638
favorite count: 0
accepted answer: http://stackoverflow.com/a/25790638
upvote count: 1

http://stackoverflow.com/q/25863309
has answer: http://stackoverflow.com/a/25867313
downvote count: 0
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25867313
tagged with: jsp
favorite count: 0
type: Question
upvote count: 2
has title: How to get accurate path of the uploaded file in jsp?
has comment: http://stackoverflow.com/comment/40472205
answer count: 1
has comment: http://stackoverflow.com/comment/40470919
has body: I am trying to upload file from my local system using &lt;INPUT NAME="file1" TYPE="file" &gt; in jsp file.and i try to get actual path of the uploaded file with the file name. but i can't get correct path. I am using the bellow code String filename = request.getParameter("file1"); System.out.println(filename); String r= request.getRealPath(filename); Output : /home/raptor/vinoth/vinoth.k/apache-tomcat-7.0.50/wtpwebapps/LoginMonitor/file.txt instead of /home/raptor/vinoth/file.txt Every time it search the file in my web application folder but the about code not giving actual path. i am using firefox browser. can any one help me to fix this problem?? Thanks in advance
has comment: http://stackoverflow.com/comment/40470681
tagged with: java
has comment: http://stackoverflow.com/comment/40470708

http://stackoverflow.com/q/25756453
answer count: 1
has comment: http://stackoverflow.com/comment/40276119
score: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40276071
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40276107
downvote count: 2
has comment: http://stackoverflow.com/comment/40276102
has answer: http://stackoverflow.com/a/25756498
has body: Return true if the given string contains an appearance of "xyz" where the xyz is not directly preceeded by a period (.). So "xxyz" counts but "x.xyz" does not. I am trying this problem out and cant seem to find why "abc.xyzxyz" is still returning false public boolean xyzThere(String str) { if(str.contains("xyz")) { int xyz = str.indexOf("xyz"); if(xyz!=0 &amp;&amp; str.substring(xyz-1,xyz).equals(".")) { return false; } return true; } return false; }
tagged with: java
type: Question
has title: CodingBat xyzThere

http://stackoverflow.com/a/35108713
type: Answer
upvote count: 7
has body: You need to ensure that you are not passing in a listener object that has already been registered. You can see the commit that resulted in this behavior change here. Here is the commit message text: Document and enforce "one request per Listener" rule The API and implementation of NsdManager imply that a separate Listener is to be used for each active registration or discovery request. This isn't formally documented or properly enforced, and weird and unpredictable things happen if an application uses a Listener for more than one request at a time. Update documentation to make this an explicit requirement. Enforce the restriction when a new request is submitted for processing; if the Listener is already being used to track an active request, throw an exception. Document the fact that apps should unregister services and cancel service discoveries when the app is stopped (in KitKat and prior releases, they'll leak if this isn't done.) Re-order "release the Listener" operation to occur before the Listener callback, so that the Listener can be reused by the application once the callback has been entered - this eliminates a race condition. Document this. Pass 2: typos, added documentation about API level, changed to using an explicitly defined return value for "busy listener". Also, just a warning that if you downloaded the NsdChat sample project from the Android Developers site (i.e. NsdChat.zip or something along those lines), that project code is likely out of date. Try using the latest code on the master branch instead... you can copy and paste it into your sample project from here.
score: 7
downvote count: 0
answers question: http://stackoverflow.com/q/25815162

http://stackoverflow.com/q/25748294
has answer: http://stackoverflow.com/a/25748479
has comment: http://stackoverflow.com/comment/40260938
has comment: http://stackoverflow.com/comment/40262288
downvote count: 0
accepted answer: http://stackoverflow.com/a/25748354
has answer: http://stackoverflow.com/a/25748543
favorite count: 0
has answer: http://stackoverflow.com/a/25748371
has comment: http://stackoverflow.com/comment/40319997
has body: I saw the below code under practice questions in SCJP book Object obj = new Object(); First I thought it might be an error since I didn't use statement like this. Now I understand it is a valid statement. I just want to understand what is the practical use of this if any. What can you use an object of the Object type (rather than of a class derived from Object) for?
answer count: 4
has comment: http://stackoverflow.com/comment/40261089
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40260707
upvote count: 3
tagged with: java
has title: What are objects of the Object type useful for
tagged with: new-operator
type: Question
tagged with: object
linked to: http://stackoverflow.com/q/710362
has comment: http://stackoverflow.com/comment/40260759
possible better answer: http://stackoverflow.com/a/25748479
has answer: http://stackoverflow.com/a/25748354

http://stackoverflow.com/comment/40330294
comment on: http://stackoverflow.com/q/25786708
type: QuestionComment
type: Comment
has text: @AndrewThompson Either someone knows the answer or they do not. Since that is the only code relevant, I do not understand the point of putting in code that would work in the IDE. No idea what your second link is going on about :/.
score: 1

http://stackoverflow.com/a/25720464
upvote count: 1
answers question: http://stackoverflow.com/q/25720282
score: 1
has body: String number = cursor.getString(col_number).replaceAll("^\\+\\d{2}", "0").replaceAll("[^\\d]", "")
downvote count: 0
has comment: http://stackoverflow.com/comment/40208996
type: Answer

http://stackoverflow.com/a/25750383
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25747415
answers question: http://stackoverflow.com/q/25747415
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/102809330
has body: I resolved the issue by refreshing and updating the dependencies. Somewhere it was not referring to the correct Loggable annotation. Just made sure that it is pointing to the annotation, it is referring to.

http://stackoverflow.com/comment/40343341
has text: Like I said, unless you run as root(or a user with sufficient privileges) You just cant. Its the OS security, it wont let you do something you are not allowed to. (unless you find a bug in the OS which, makes it hacking.) If you are authorized to do this, ask your school Sys Admin to give your user a permission for this particular thing.
comment on: http://stackoverflow.com/a/25793528
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40414947
type: QuestionComment
comment on: http://stackoverflow.com/q/25832583
score: 0
type: Comment
has text: Well, how about a criteria or hql?

http://stackoverflow.com/q/25817947
has comment: http://stackoverflow.com/comment/40388664
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40388562
has answer: http://stackoverflow.com/a/25818192
type: AnsweredQuestion
tagged with: android-edittext
tagged with: android-fragments
score: 1
tagged with: java
has body: this is my last desperate attempt to fix this problem. i am using dialogfragment to make my dialog window MyDialog. the window is supposed to show a score I have sent with and the user can then write in their name and confirm. i am then supposed to be able to retrieve their name. My first problem is that the edittext that are supposed to show the score, doesn't want to show the score i set the edittext to be (it will only show new text if it was in the xml file). I can however still retrieve the correct score(text) afterwards from the same edittext. The second problem is that the text that the user writes in can't be retrieved since the edittext isn't updating. However the text that was in the field from the xml file can be retrieved. It seems like the edittext doesn't want to refresh after they are made in the xml file. the dialog class (imports taken out): public class MyDialog extends DialogFragment { private EditText scoreEdit; private EditText userEdit; private DialogClickListener callback; public interface DialogClickListener { public void onFinishedClick(); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); try { callback = (DialogClickListener) getActivity(); }catch(ClassCastException e) { throw new ClassCastException("called class must implement interface"); } } public static MyDialog newInstance(int title) { MyDialog frag = new MyDialog(); Bundle args = new Bundle(); args.putInt("tittel",title); frag.setArguments(args); return frag; } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder dialog = new AlertDialog.Builder(getActivity()); LayoutInflater inflater = getActivity().getLayoutInflater(); View inflatedView = inflater.inflate(R.layout.dig_lay, null); scoreEdit = (EditText) inflatedView.findViewById(R.id.dialogScoreEdit); userEdit = (EditText) inflatedView.findViewById(R.id.dialogUsernameEdit); scoreEdit.setText("score supposed to change"); // scoreEdit (edittext) is not …
type: Question
has title: Android - EditText dosen't refresh in dialogfragment
tagged with: android-dialogfragment
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25818192
tagged with: android

http://stackoverflow.com/a/25859791
downvote count: 0
answers question: http://stackoverflow.com/q/25858328
type: Answer
has body: "How to configure eclipse organize imports to separate imports from different groups by new lines." Go: [Window] &rarr; [Preferences] &rarr; [Java] &rarr; [Code Style] &rarr; [Formatter] At the top of the diaolog, you should see the "Active Profile" combo box. Select the Edit.... Go to [Blank Lines] tab, and edit [Between Import Groups]. Set it to 1 if you want one space
score: 4
upvote count: 4

http://stackoverflow.com/comment/40340554
comment on: http://stackoverflow.com/q/25770447
score: 0
type: QuestionComment
type: Comment
has text: I've remembered. You should never call swing components from any other thread except EDT (Event Dispatch Thread). This may be the reason of your program's hangs. See [this answer](http://stackoverflow.com/a/8890060/383688) on how to use it.

http://stackoverflow.com/comment/40492468
has text: I was able to get a little further. I created TestMeSoapPortImpl class and it compiled. See Error when creating service. Pasted in above text
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25873358
score: 0

http://stackoverflow.com/q/25868856
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25868929
has answer: http://stackoverflow.com/a/25868929
duplicate of: http://stackoverflow.com/q/4772425
tagged with: java
tagged with: date
type: Question
score: 0
has answer: http://stackoverflow.com/a/25869054
has answer: http://stackoverflow.com/a/25868941
accepted answer: http://stackoverflow.com/a/25868941
answer count: 4
has comment: http://stackoverflow.com/comment/40480657
has body: I need help to format the date in the code that is below. Should be the date shown on the form: 05. May 2014. Please give me suggestions how to do it. package person; public class Person { public static void main(String[] split) { String text = "John.Davidson/05051988/Belgrade Michael.Barton/01011968/Krakov Ivan.Perkinson/23051986/Moscow"; String[] newText = text.split("[./ ]"); for(int i=0; i&lt;newText.length; i+=4) { String name = newText[i].split(" ")[0]; String lastName = newText[i+1].split(" ")[0]; String dateOfBirth = newText[i+2].split(" ")[0]; String placeOfBirth = newText[i+3].split(" ")[0]; System.out.println("Name: " + name + ", last name: " + lastName + ", date of birth: " + dateOfBirth + ", place of birth: " + placeOfBirth); } } }
has title: Java - Formatting the date printing
has answer: http://stackoverflow.com/a/25868977
linked to: http://stackoverflow.com/q/4772425

http://stackoverflow.com/a/25835122
has comment: http://stackoverflow.com/comment/40419483
answers question: http://stackoverflow.com/q/25835078
type: Answer
has comment: http://stackoverflow.com/comment/40421051
has comment: http://stackoverflow.com/comment/40419139
downvote count: 0
has comment: http://stackoverflow.com/comment/40419585
score: 1
has comment: http://stackoverflow.com/comment/40420423
has comment: http://stackoverflow.com/comment/40420283
has comment: http://stackoverflow.com/comment/40419943
has body: you are sending empty list to adapter: list=new ArrayList&lt;String&gt;();// empty list adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, list); // get data from intent(to your list) before initializing your adapter and you don't need to notify list = i.getStringArrayListExtra("country&amp;year"); adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, list); lv.setAdapter(adapter);
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40419421
has comment: http://stackoverflow.com/comment/40423016
accepted answer of: http://stackoverflow.com/q/25835078

http://stackoverflow.com/comment/40304519
has text: Not like thats a big deal `removeall.(collection.singleton("Becky"))`
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25754411

http://stackoverflow.com/q/25871878
score: 0
tagged with: jaas
has comment: http://stackoverflow.com/comment/48388431
has title: JAAS custom LoginModule error messages with Struts 1 and Tomcat
has comment: http://stackoverflow.com/comment/48410587
has body: I have an application that is using JAAS LoginModule for authorization. I need to show different error messages. One message when user entered wrong login or password and other message when user's account was blocked after X unsuccessful attemps. LoginModule supports only one error page. The only way that I see is to pass message to JSP-page. How can I pass custom message to JSP-page from LoginModule? The only way that I see is to store this message in session and retrieve it on JSP-page. But I don't know how to get session in LoginModule. I know there is PolicyContext in JBoss and ActionContext in Struts 2. But I am using Struts 1 (legacy code) and Tomcat. Is there any solution?
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: struts-1
type: Question
tagged with: jsp
tagged with: tomcat

http://stackoverflow.com/a/25799662
score: 0
has body: It does not seem like this is a Thrift issue at all... it seems like it is inside the library that you are using ("twitter commons" or whatever). I presume that their library is trying to create a dynamic proxy for your interface, but your interface it unable to handle whatever checked exception is being thrown. You might want to try declaring "throws java.lang.Throwable" on your interface temporarily if you are having trouble ascertaining the underlying exception and are unable to fix the implementation of the Invocation Handler itself. At least the root cause won't be buried by the UndeclaredThrowableException if you do that. Alternatively, just set a breakpoint in a graphical debugger and step through the invocation to be able to see your program's state.
answers question: http://stackoverflow.com/q/25783758
type: Answer

http://stackoverflow.com/q/25782897
answer count: 0
type: UnansweredQuestion
tagged with: apache-camel
has title: Apache Camel overriding ExchangePattern.InOut behaviour to return body is this possible to do
has body: I had an issue with Apache Camel that timeouts for after 20 seconds. I was getting timeout errors after 20 seconds. I have a custom processor the implements Processor. I injected a DAO and when finding the data within the custom processor it took longer to find the data on the Apache Camel side and it timed out. If I run the same code without Apache Camel it runs instantly. By doing a SELECT inside the CustomProcessor it took longer to find the data. The memory reference for the DAO are the same, so in the test the data is fetched immediately and the CustomProcessor hangs for 20 seconds before the data is receieved and it throws an Exception. I figured out that I need to add ?disableReplyTo=true as below: source=activemq:queue:notification?disableReplyTo=true This fixed the timeout issue, but nothing was being added to the queue. When I request the body of the message it returns the input XML that was sent. By default, by adding ?disableReplyTo=true sets the ExchangePattern to InOnly. Is there any way of overriding this to ExchangePattern.OutOnly? I want the message to be sent to the queue and also I want to get the body of the message that is set through producerTemplate.requestBody(). What I noted that going from one processor to another the other processor can access the exchange.setOut() as as exchange.getIn(). I have located the code on Githib: https://github.com/rajivj2/example2 I tried something like this: public class ContentEnricherProcessor implements Processor { @Resource private StatusDAO statusDAO; private Logger logger; public ContentEnricherProcessor(StatusDAO statusDAO) { this.statusDAO = statusDAO; logger = LoggerFactory.getLogger(ContentEnricherProcessor.class); } public void process(Exchange exchange) throws Exception { exchange.setPattern(ExchangePattern.OutOnly); // by doing producerTemplate.requestBody() this does not work Message message = exchange.getIn(); Entity entity = (Entity) message.getBody(); Status status = process(entity); message.se…
downvote count: 0
score: 1
tagged with: jms
favorite count: 0
type: Question
tagged with: spring
tagged with: java
upvote count: 1

selenium
tags question: http://stackoverflow.com/q/25866545
tags question: http://stackoverflow.com/q/25804102
tags question: http://stackoverflow.com/q/25736172
tags question: http://stackoverflow.com/q/25762707
tags question: http://stackoverflow.com/q/25792526
tags question: http://stackoverflow.com/q/25845916
tags question: http://stackoverflow.com/q/25869502
tags question: http://stackoverflow.com/q/25834002
tags question: http://stackoverflow.com/q/25853333
tags question: http://stackoverflow.com/q/25737468
tag name: selenium
tags question: http://stackoverflow.com/q/25815565
tags question: http://stackoverflow.com/q/25819208
tags question: http://stackoverflow.com/q/25757034
tags question: http://stackoverflow.com/q/25836902
tags question: http://stackoverflow.com/q/25784375
tags question: http://stackoverflow.com/q/25809722
tags question: http://stackoverflow.com/q/25722397
tags question: http://stackoverflow.com/q/25860587
tags question: http://stackoverflow.com/q/25733877
tags question: http://stackoverflow.com/q/25809970
tags question: http://stackoverflow.com/q/25848874
tags question: http://stackoverflow.com/q/25816634
tags question: http://stackoverflow.com/q/25791004
tags question: http://stackoverflow.com/q/25870873
tags question: http://stackoverflow.com/q/25787305
tags question: http://stackoverflow.com/q/25723459
tags question: http://stackoverflow.com/q/25816400
tags question: http://stackoverflow.com/q/25763472
tags question: http://stackoverflow.com/q/25726303
tags question: http://stackoverflow.com/q/25850351
tags question: http://stackoverflow.com/q/25762115
tags question: http://stackoverflow.com/q/25798988
tags question: http://stackoverflow.com/q/25720724
tags question: http://stackoverflow.com/q/25838402
tags question: http://stackoverflow.com/q/25727340
tags question: http://stackoverflow.com/q/25721263
type: Tag
tags question: http://stackoverflow.com/q/25767640
tags question: http://stackoverflow.com/q/25850869
tags question: http://stackoverflow.com/q/25794721
tags question: http://stackoverflow.com/q/25730229
tags question: http://stackoverflow.com/q/25771073
tags question: http://stackoverflow.com/q/25770652

http://stackoverflow.com/a/25738182
has comment: http://stackoverflow.com/comment/40267680
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: You can do following: open [projectFolder]/nbproject/plugins.properties file paste following at the end of file SpeechRecognizer=https://github.com/poiuytrez/SpeechRecognizer.git build project The plugins.properties file contains list of used plugins. Some "core" plugins can be added/removed easily in project properties but for 3rd party/unknown plugins, you need to manually modify the file (it is also mentioned in project properties dialog ->Cordova->Plugins) Edit: The pasted line could look like com.phonegap.plugins.speech=https://github.com/poiuytrez/SpeechRecognizer.git or com.phonegap.plugins.speech.SpeechRecognizer=https://github.com/poiuytrez/SpeechRecognizer.git in case of some issues (I was able to build the project with the 1st line with friendly name but in case there is some catch, try this name instead)
answers question: http://stackoverflow.com/q/25730702
has comment: http://stackoverflow.com/comment/40268691

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/25771518
tags question: http://stackoverflow.com/q/25872404
tags question: http://stackoverflow.com/q/25852042
type: Tag
tags question: http://stackoverflow.com/q/25734138

http://stackoverflow.com/q/25808165
has title: Loss of messages in RabbitMQ
type: Question
score: 5
upvote count: 5
has body: I try to build persistent message queue with some delay per message. In Java-code it's looks like this: ConnectionFactory factory = new ConnectionFactory(); factory.setHost("localhost"); Connection connection = factory.newConnection(); Channel channel = connection.createChannel(); channel.exchangeDeclare("WorkExchange", "direct"); channel.queueDeclare("WorkQueue", true, false, false, null); channel.queueBind("WorkQueue", "WorkExchange", ""); Map&lt;String, Object&gt; args = new HashMap&lt;&gt;(); args.put("x-dead-letter-exchange", "WorkExchange"); channel.exchangeDeclare("RetryExchange", "direct"); channel.queueDeclare("RetryQueue", true, false, false, args); channel.queueBind("RetryQueue", "RetryExchange", ""); channel.confirmSelect(); BasicProperties properties = new BasicProperties(); properties.setDeliveryMode(2); properties.setExpiration("120000"); channel.basicPublish("RetryExchange", "", properties, "Hello world!".getBytes()); channel.waitForConfirmsOrDie(); connection.close(); However, I have some problem with persistency. When I stop server, wait some time and start it again, messages which have to move to WorkQueue just disappear. What I do wrong? Or it's by design?
tagged with: message-queue
answer count: 1
downvote count: 0
tagged with: persistence
favorite count: 0
tagged with: rabbitmq
has answer: http://stackoverflow.com/a/25808426
accepted answer: http://stackoverflow.com/a/25808426
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40205488
has text: if you using any IDE, it can generate proper equals and hashcode method for you.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25718617
type: QuestionComment

http://stackoverflow.com/comment/40264305
score: 0
comment on: http://stackoverflow.com/q/25749427
type: QuestionComment
has text: What version of JIRA? Does your Java version match the system requirements for the version of JIRA you are using?
type: Comment

http://stackoverflow.com/a/25789834
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/40336117
has comment: http://stackoverflow.com/comment/40336047
answers question: http://stackoverflow.com/q/25789729
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40336705
has body: Concept: It is kind of awful. It is wasteful, compared to using configuration files outside of the jar. It doesn't really add value. Users usually don't care where the configuration files live. It saves state in the program. Why is this bad? Because they're not seperated, users cannot easily transfer the configuration without copying the whole program, or share the program without sharing their configuration. If you can read and rewrite the jar, you can also write configuration files to the same directory. Usually. Assuming it does work flawlessly, it complicates your code, possibly unnecessarily. If it doesn't work, your users might be left with a broken executable. Not a good user experience. You don't need to put it into the same jar. Being able to export a snapshot of the jar, bundled with the configuration into the program, might be a feature, but it likely isn't valuable enough to have it by default. Implementation: What happens when the host OS runs out of resources? File descriptors, space... You might get a NullPointerException in java.io.File.&lt;init&gt;, but what state did you leave on the hard-drive? Can your program handle existing files? All this is unneeded complexity, that you could avoid by using files outside of the jar. The writing could fail at any moment, due to external causes. And since you don't use finally blocks to close your streams, I'm not sure if the changes will be flushed. Conclusion: Facing the persistence problem you're having with Processing, this is a clever hack, but still a hack. It will blow up, sometime, for someone. If you can avoid, do it. On the other hand, I might misunderstand the problem with Processing, so there might be solution that is more appropriate.
has comment: http://stackoverflow.com/comment/40336096
has comment: http://stackoverflow.com/comment/40337208
has comment: http://stackoverflow.com/comment/40337037

http://stackoverflow.com/q/25796973
tagged with: session
downvote count: 0
answer count: 1
has body: I am referring to https://developer.jboss.org/wiki/SessionsAndTransactions and currently trying to understand demarcation with JTA. It states that within a particular transaction using getCurrentSession() always gives the same current session. Does it mean: If another user is executing the same piece of code (which fetches a transaction by lookup, then uses getCurrentSession() and then closes the transaction) in another thread - that user will have his own transaction and his own current session i.e. the current sessions of 2 users are same for themselves but different from each other? If 1 is true and based on the code shown in the link for JTA demarcation - how does the system (read Hibernate) understand which session to respond to which user when getCurrentSession() is used? After all we don't pass the transaction as argument to getCurrentSession(). Any pointers/help is much appreciated. Thanks
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28740965
has title: Hibernate JTA multiuser session-transaction mapping
upvote count: 1
tagged with: transactions
score: 1
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/a/25732112
type: Answer
has comment: http://stackoverflow.com/comment/40231024
has body: To get a list of all the installed apps final Intent mainIntent = new Intent(Intent.ACTION_MAIN, null); mainIntent.addCategory(Intent.CATEGORY_LAUNCHER); final List pkgAppsList = context.getPackageManager().queryIntentActivities( mainIntent, 0);
has comment: http://stackoverflow.com/comment/40230802
answers question: http://stackoverflow.com/q/25732072
score: 0

http://stackoverflow.com/a/25745804
accepted answer of: http://stackoverflow.com/q/25745693
type: Answer
answers question: http://stackoverflow.com/q/25745693
has comment: http://stackoverflow.com/comment/40287299
score: 3
downvote count: 0
has body: ResultSet.getString() will return a String object and ResultSet.getInt() returns an int value. ResultSet.getString() will work in all cases because all objects can be converted to String with Object.toString(). ResultSet.getInt() will only work if the underlying SQL datatype is a number and it fits into an int. So the ResultSet.getString() is more flexible but is obviously less effective if the number is already an integer. Plus it is less likely that anyone would store a number as a string in the database (which would require this conversion). null values are not really a concern because the javadoc of ResultSet.getInt() states that the value 0 is returned if the data is SQL NULL (altough this may not be what you want). And new Integer(rs.getString(1)) would throw a NumberFormatException!
has comment: http://stackoverflow.com/comment/40257276
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40280766
upvote count: 3

http://stackoverflow.com/q/25807046
tagged with: java
has comment: http://stackoverflow.com/comment/40367729
tagged with: listview
has comment: http://stackoverflow.com/comment/40368703
score: 0
has comment: http://stackoverflow.com/comment/40368789
has comment: http://stackoverflow.com/comment/40368520
has comment: http://stackoverflow.com/comment/40367650
answer count: 1
has title: Problems in ListView in Android
has comment: http://stackoverflow.com/comment/40367585
has comment: http://stackoverflow.com/comment/40368476
has body: My listview is transparent. I changed it. But still it has a slight transparency. How to disable it as the text aren't viisble. <?xml version="1.0" encoding="utf-8"?> <ListView android:id="@+id/list" android:layout_width="fill_parent" android:layout_height="310dp" android:layout_alignParentBottom="true" android:background="#FFffffff" android:divider="@color/lists_divider" android:dividerHeight="1dp" android:paddingLeft="10dp" android:paddingRight="10dp" android:paddingTop="0dp" />
has comment: http://stackoverflow.com/comment/40368839
has answer: http://stackoverflow.com/a/25808031
tagged with: android
has comment: http://stackoverflow.com/comment/40367616
has comment: http://stackoverflow.com/comment/40368277
has comment: http://stackoverflow.com/comment/40368939
has comment: http://stackoverflow.com/comment/40367533
has comment: http://stackoverflow.com/comment/40368470
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8587323
has comment: http://stackoverflow.com/comment/40368535
has comment: http://stackoverflow.com/comment/40368575
type: Question
has comment: http://stackoverflow.com/comment/40367700

http://stackoverflow.com/comment/40318254
type: AnswerComment
has text: thank u @waitingmyself..but it shows exception Exception in thread "main" java.lang.RuntimeException: no more
type: Comment
comment on: http://stackoverflow.com/a/25779577
score: 0

http://stackoverflow.com/q/25823217
has answer: http://stackoverflow.com/a/32035739
has comment: http://stackoverflow.com/comment/40397591
tagged with: java
has title: NotificationListenerService.cancelNotification throws NullPointerException
has comment: http://stackoverflow.com/comment/40397555
type: Question
has comment: http://stackoverflow.com/comment/40397596
answer count: 2
has answer: http://stackoverflow.com/a/25823346
score: 0
has comment: http://stackoverflow.com/comment/40397650
has body: I am trying to cancel/remove a notification from the status bar, by using the cancelNotification() method from within my NotificationListenerService, using the following code: public final void mcancelNotification(String pkgn, String t, int i){ cancelNotification(pkgn, t, i); //line 84 } However I am getting a NullPointerException(see below) and after doing some tests I noticed that it was the tag t that was null. This is how I got the pkgn, t and i values from within the onNotificationPosted method: packageName = sbn.getPackageName(); tag = sbn.getTag(); id = sbn.getId(); How can I remove the notification if the tag is equal to null? Am I missing something? Would really appreciate some help, thanks NPE: 09-13 14:23:30.270: E/AndroidRuntime(29456): FATAL EXCEPTION: main 09-13 14:23:30.270: E/AndroidRuntime(29456): Process: com.project.now, PID: 29456 09-13 14:23:30.270: E/AndroidRuntime(29456): java.lang.NullPointerException 09-13 14:23:30.270: E/AndroidRuntime(29456): at android.os.Parcel.readException(Parcel.java:1471) 09-13 14:23:30.270: E/AndroidRuntime(29456): at android.os.Parcel.readException(Parcel.java:1419) 09-13 14:23:30.270: E/AndroidRuntime(29456): at android.app.INotificationManager$Stub$Proxy.cancelNotificationFromListener(INotificationManager.java:469) 09-13 14:23:30.270: E/AndroidRuntime(29456): at android.service.notification.NotificationListenerService.cancelNotification(NotificationListenerService.java:116) 09-13 14:23:30.270: E/AndroidRuntime(29456): at com.project.now.NoLiSes.mcancelNotification(NoLiSes.java:84)
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/25736189
tagged with: java
tagged with: nodes
has title: How to compare objects in a Node List?
upvote count: 2
has comment: http://stackoverflow.com/comment/40238892
answer count: 1
has answer: http://stackoverflow.com/a/25736221
favorite count: 0
has comment: http://stackoverflow.com/comment/40238820
type: UnansweredQuestion
has body: I am trying to write a method that accepts an Object and compares it to a Node list. And then it adds every element of that list that is smaller than it to a new list. I am pretty close but two of the first elements aren't copying over. public LList&lt;String&gt; getAllLessThan(Comparable&lt;T&gt; anObject) { LList&lt;String&gt; newList = new LList(); Node currentNode = firstNode; for (int i = 0; i &lt; length; i++) { if (currentNode.data.compareTo((T) anObject) == -1) { newList.add((String) currentNode.data); } currentNode = currentNode.next; } return newList; } The first two elements of the list should be included but are being left out. String[] names = {"Abby", "Bobby", "Carla", "Doug"}; LList&lt;String&gt; nameList = new LList(names, 4); String[] newNames = {"Edgar", "Frank"}; nameList.addAll(newNames); System.out.println("Output should be Abby, Bobby, Carla, Doug, Edgar, Frank"); nameList.display(); System.out.println(); nameList.add("Carrie"); LList&lt;String&gt; newList = nameList.getAllLessThan("Doug"); System.out.println("Output should be Abby, Bobby, Carla, Carrie"); newList.display(); System.out.println();
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40238900
type: Question

java-native-interface
tags question: http://stackoverflow.com/q/25782353
tags question: http://stackoverflow.com/q/25859293
tags question: http://stackoverflow.com/q/25732685
tags question: http://stackoverflow.com/q/25746812
tags question: http://stackoverflow.com/q/25758113
tags question: http://stackoverflow.com/q/25860251
tags question: http://stackoverflow.com/q/25867666
tags question: http://stackoverflow.com/q/25852147
type: Tag
tags question: http://stackoverflow.com/q/25739967
tag name: java-native-interface
tags question: http://stackoverflow.com/q/25748096
tags question: http://stackoverflow.com/q/25819907
tags question: http://stackoverflow.com/q/25727601
tags question: http://stackoverflow.com/q/25774801
tags question: http://stackoverflow.com/q/25840829
tags question: http://stackoverflow.com/q/25748273

spring-mvc
tags question: http://stackoverflow.com/q/25716056
tags question: http://stackoverflow.com/q/25800804
tags question: http://stackoverflow.com/q/25837461
tags question: http://stackoverflow.com/q/25792200
tags question: http://stackoverflow.com/q/25730500
tags question: http://stackoverflow.com/q/25840394
tags question: http://stackoverflow.com/q/25749498
tags question: http://stackoverflow.com/q/25805236
tags question: http://stackoverflow.com/q/25800387
tags question: http://stackoverflow.com/q/25800324
tags question: http://stackoverflow.com/q/25849567
tags question: http://stackoverflow.com/q/25725040
tags question: http://stackoverflow.com/q/25830631
tags question: http://stackoverflow.com/q/25861379
tags question: http://stackoverflow.com/q/25777637
tags question: http://stackoverflow.com/q/25796945
tags question: http://stackoverflow.com/q/25791100
tags question: http://stackoverflow.com/q/25751254
tags question: http://stackoverflow.com/q/25725714
tags question: http://stackoverflow.com/q/25797959
tags question: http://stackoverflow.com/q/25730874
tags question: http://stackoverflow.com/q/25807418
tags question: http://stackoverflow.com/q/25715891
tags question: http://stackoverflow.com/q/25744172
tags question: http://stackoverflow.com/q/25853804
tags question: http://stackoverflow.com/q/25829367
tags question: http://stackoverflow.com/q/25759814
tags question: http://stackoverflow.com/q/25751929
tags question: http://stackoverflow.com/q/25870583
tags question: http://stackoverflow.com/q/25870764
tags question: http://stackoverflow.com/q/25844859
tags question: http://stackoverflow.com/q/25759723
tags question: http://stackoverflow.com/q/25873446
tags question: http://stackoverflow.com/q/25772152
tags question: http://stackoverflow.com/q/25765015
tags question: http://stackoverflow.com/q/25828060
tags question: http://stackoverflow.com/q/25780378
tag name: spring-mvc
tags question: http://stackoverflow.com/q/25786537
tags question: http://stackoverflow.com/q/25865429
tags question: http://stackoverflow.com/q/25717566
tags question: http://stackoverflow.com/q/25782299
tags question: http://stackoverflow.com/q/25810767
tags question: http://stackoverflow.com/q/25784063
tags question: http://stackoverflow.com/q/25742984
tags question: http://stackoverflow.com/q/25756309
tags question: http://stackoverflow.com/q/25860213
tags question: http://stackoverflow.com/q/25864956
tags question: http://stackoverflow.com/q/25723473
tags question: http://stackoverflow.com/q/25813941
tags question: http://stackoverflow.com/q/25868218
type: Tag
tags question: http://stackoverflow.com/q/25740458
tags question: http://stackoverflow.com/q/25768304
tags question: http://stackoverflow.com/q/25768400
tags question: http://stackoverflow.com/q/25770703
tags question: http://stackoverflow.com/q/25815281
tags question: http://stackoverflow.com/q/25757365
tags question: http://stackoverflow.com/q/25731951
tags question: http://stackoverflow.com/q/25871647
tags question: http://stackoverflow.com/q/25793549
tags question: http://stackoverflow.com/q/25746956
tags question: http://stackoverflow.com/q/25811417
tags question: http://stackoverflow.com/q/25855244
tags question: http://stackoverflow.com/q/25729844
tags question: http://stackoverflow.com/q/25849070
tags question: http://stackoverflow.com/q/25766765
tags question: http://stackoverflow.com/q/25728539
tags question: http://stackoverflow.com/q/25861430
tags question: http://stackoverflow.com/q/25827079
tags question: http://stackoverflow.com/q/25788569
tags question: http://stackoverflow.com/q/25763848
tags question: http://stackoverflow.com/q/25807872
tags question: http://stackoverflow.com/q/25750380
tags question: http://stackoverflow.com/q/25721112
tags question: http://stackoverflow.com/q/25797895
tags question: http://stackoverflow.com/q/25749598
tags question: http://stackoverflow.com/q/25792321
tags question: http://stackoverflow.com/q/25730809
tags question: http://stackoverflow.com/q/25762320

http://stackoverflow.com/comment/40281429
score: 2
has text: This will count and print the same words multiple times (e.g. `"Hello"`).
comment on: http://stackoverflow.com/a/25759613
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25731217
answer count: 1
has comment: http://stackoverflow.com/comment/40229009
favorite count: 0
has comment: http://stackoverflow.com/comment/40229022
tagged with: conways-game-of-life
upvote count: 2
type: UnansweredQuestion
score: 1
tagged with: java
downvote count: 1
has title: Conway's game of life in looping through the algorithm
has comment: http://stackoverflow.com/comment/40229003
has comment: http://stackoverflow.com/comment/40229011
type: Question
has comment: http://stackoverflow.com/comment/40229224
has body: The code is not finished yet, but I am having some weird problem in the algorithm. When it loops through it crashes at the same spot at neighbors5 every time unless I make the game a 3 by 3. I am not sure what is wrong with the loop it looks like the algorithm should work and it was programmed correctly so far. package dsa.hw1; import java.util.Random; import java.util.Scanner; public class DSAHW1 { public static void main(String[] args) { Scanner kb = new Scanner(System.in); System.out.println("what would you like to be the height?"); int height = kb.nextInt(); System.out.println("what would you like to be the width?"); int width = kb.nextInt(); boolean[][] GameBoard = new boolean[height][width]; Random number = new Random(); for(int i =0; i &lt; GameBoard.length; i++){ for(int j = 0; j &lt; GameBoard[i].length; j++){ int theRandomNumber = number.nextInt(2); System.out.print(theRandomNumber); if(theRandomNumber == 1){ GameBoard[i][j] = true; } else{ GameBoard[i][j] = false; } } } System.out.println(""); String[][] Display = new String[height][width]; for(int i =0; i &lt; GameBoard.length; i++){ for(int j = 0; j &lt; GameBoard[i].length; j++){ if(GameBoard[i][j]){ Display[i][j] = "*"; } else{ Display[i][j] = "-"; } System.out.print(Display[i][j] + " "); } System.out.println(""); } int heightAlg = height -1; int widthAlg = width - 1; //algorithm int neighbors1 = 0, neighbors2 = 0, neighbors3 = 0, neighbors4 = 0, neighbors5 = 0; int neighbors6 = 0, neighbors7 = 0, neighbors8 = 0, neighbors9 = 0, neighbors10 = 0; for(int i =0; i &lt; widthAlg; i++){ for(int j = 0; j &lt; heightAlg; j++){ if(i == 0 &amp; j == 0){ if(GameBoard[i][j++]) {neighbors1++;} if(GameBoard[i++][j]) {neighbors1++;} if(GameBoard[i++][j++]) {neighbors1++;} } else if( i == 0 &amp;&amp; j &gt; 0 &amp;&amp; j &lt; widthAlg ){ if(GameBoard[i][j--]) {neighbors2++;} if(GameBoard[i++][j--]) {neighbors2++;} if(GameBoard[i][j++]) {neighbors2++;} if(GameBoard[i++][j]) {neighbors2++;} if(GameBoard[i++][j++]) {…
has answer: http://stackoverflow.com/a/25731322
has comment: http://stackoverflow.com/comment/40228987

http://stackoverflow.com/comment/40208919
comment on: http://stackoverflow.com/q/25720447
has text: Is there a specific reason that you need each page to be an Activity? I think it would be easier to create an Activity once and just change the contents based on the page #.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25864154
linked to: http://stackoverflow.com/q/26891383
tagged with: java
has answer: http://stackoverflow.com/a/26946814
answer count: 2
downvote count: 0
has title: embed java code inside a template
has body: Is it possible to embed executable java code inside a ST4 template? eg if I want to pass a string to my template, which sometimes prints the string as-is, and sometimes prints it in caps, so I want a java code to do the necessary conversion. Without this feature, I see 3 ways to achieve the same functionality: (1) pre-compute the alternative values in java, and pass them all to the template at one shot (but this may result in too many arguments): // in the below code, if the template can compute DESCRIPTION_CAPS from DESCRIPTION, using embedded java code, that reduces one argument test(DESCRIPTION, DESCRIPTION_CAPS) ::= &lt;&lt; this is original &lt;DESCRIPTION&gt; this is caps &lt;DESCRIPTION_CAPS&gt; &gt;&gt; (2) If there become too many such arguments, the other option is to break up the temlpate into smaller parts, but that makes the code ugly and unreadable: test1(DESCRIPTION) ::= &lt;&lt; this is original &lt;DESCRIPTION&gt; &gt;&gt; test2(DESCRIPTION_CAPS) ::= &lt;&lt; this is caps &lt;DESCRIPTION_CAPS&gt; &gt;&gt; (3) Pre-compute all relevant values inside a class, and let the template call the getter functions (without arguments) to simply get the relevant values from the class. test() ::= &lt;&lt; this is original &lt;values.description&gt; this is caps &lt;values.description_caps&gt; &gt;&gt; As of now (if the embedding java class is not available) the 3rd option looks like the best solution. Please advise if a better solution exists. Note: in the above example, I have used CAPS as only as an example, there could be more complex java functions also needed.
has answer: http://stackoverflow.com/a/27291910
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: stringtemplate
tagged with: stringtemplate-4
type: Question
score: 1

http://stackoverflow.com/comment/40225593
comment on: http://stackoverflow.com/q/25728995
has text: @pskink I could not create a service in java wehere I can connect to from native code. How would you do this? Using another native binary creating the server, connecting on this service was no problem.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40470655
has text: @ChristofferHammarström what if this variable could be `null` ?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25863255

http://stackoverflow.com/q/25806018
has comment: http://stackoverflow.com/comment/40365758
has answer: http://stackoverflow.com/a/25806064
linked to: http://stackoverflow.com/q/798545
possible better answer: http://stackoverflow.com/a/25806072
has answer: http://stackoverflow.com/a/25806079
has answer: http://stackoverflow.com/a/25806072
duplicate of: http://stackoverflow.com/q/798545
answer count: 9
has answer: http://stackoverflow.com/a/25806076
has title: what does "this.x = x < 0? 0 : x; this.y = y < 0? 0 : y;" mean?
has answer: http://stackoverflow.com/a/25806077
downvote count: 4
has answer: http://stackoverflow.com/a/25806035
type: AnsweredQuestion
has body: I have no idea what does this mean: this.x = x &lt; 0 ? 0 : x; this.y = y &lt; 0 ? 0 : y; I could not find the meaning of these operators, any help will be greatly appreciated!
has answer: http://stackoverflow.com/a/25806110
has answer: http://stackoverflow.com/a/25806058
favorite count: 0
type: Question
score: -2
has answer: http://stackoverflow.com/a/25806081
accepted answer: http://stackoverflow.com/a/25806035
upvote count: 2
tagged with: java

http://stackoverflow.com/a/25809240
type: AcceptedAnswer
upvote count: 14
type: Answer
has body: If we talk about a Java 8 API, why not use the Java 8 features consequently… static long daysBetween(LocalDate start, LocalDate end, List&lt;DayOfWeek&gt; ignore) { return Stream.iterate(start, d-&gt;d.plusDays(1)) .limit(start.until(end, ChronoUnit.DAYS)) .filter(d-&gt;!ignore.contains(d.getDayOfWeek())) .count(); } Starting with Java 9, we can use the even simpler static long daysBetween(LocalDate start, LocalDate end, List&lt;DayOfWeek&gt; ignore) { return start.datesUntil(end) .filter(d-&gt;!ignore.contains(d.getDayOfWeek())) .count(); } Though, it might be worth using a Set with a better-than-linear lookup rather than the List: static long daysBetween(LocalDate start, LocalDate end, List&lt;DayOfWeek&gt; ignore) { if(ignore.isEmpty()) return start.until(end, ChronoUnit.DAYS); EnumSet&lt;DayOfWeek&gt; set = EnumSet.copyOf(ignore); return start.datesUntil(end) .filter(d-&gt;!ignore.contains(d.getDayOfWeek())) .count(); } You may consider changing the parameter to Set&lt;DayOfWeek&gt;, as it is not only more efficient but better suited to the actual use cases. Instead of Arrays.asList(DayOfWeek.SUNDAY, DayOfWeek.WEDNESDAY, DayOfWeek.FRIDAY), you can pass EnumSet.of(DayOfWeek.SUNDAY, DayOfWeek.WEDNESDAY, DayOfWeek.FRIDAY), but you can also use constructs like EnumSet.range(DayOfWeek.MONDAY, DayOfWeek.FRIDAY), to denote the typical working days. You can avoid iterating over all days, but it requires special care about corner cases and hence, thorough testing. And will only pay off for really large ranges. For completeness, this is the optimized variant: static long daysBetween(LocalDate start, LocalDate end, Set&lt;DayOfWeek&gt; ignore) { long d1 = start.toEpochDay(), d2 = end.toEpochDay(); if(d1 &gt; d2) throw new IllegalArgumentException(); if(ignore.isEmpty()) return d2 - d1; int incompleteWeek = 0; DayOfWeek startDoW = start.getDayOfWeek(), endDoW = end.getDayOfWeek(); if(startDoW != endDoW) { for(int v1 = startDoW.getValue(), v2 = endDoW.getValue(); v1 != v2 &a…
has comment: http://stackoverflow.com/comment/40391277
answers question: http://stackoverflow.com/q/25798876
has comment: http://stackoverflow.com/comment/40391312
downvote count: 0
has comment: http://stackoverflow.com/comment/40396250
accepted answer of: http://stackoverflow.com/q/25798876
score: 14
has comment: http://stackoverflow.com/comment/40421291
has comment: http://stackoverflow.com/comment/101490151

http://stackoverflow.com/q/25750641
accepted answer: http://stackoverflow.com/a/25750686
has answer: http://stackoverflow.com/a/25750796
tagged with: java
answer count: 5
has comment: http://stackoverflow.com/comment/40265082
has comment: http://stackoverflow.com/comment/40265044
has comment: http://stackoverflow.com/comment/40265536
score: 2
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/25750697
favorite count: 0
type: Question
has body: So I've used this: System.out.println("Of what race do you belong?\n[H]uman\t [E]lf\t [D]warf\t [O]rc\t [G]nome"); And gotten a print with very random spacing where \t has been placed. I've also used this same type of thing with this: System.out.println("Which of the following are you?\n[W]arrior\t [R]ogue\t [M]agician"); And gotten perfectly spaced breaks for the \t. Any reason why it would give me such odd spacing with the 1st one?
has answer: http://stackoverflow.com/a/25750686
has comment: http://stackoverflow.com/comment/40265079
has comment: http://stackoverflow.com/comment/40265349
upvote count: 2
has title: \t not consistent with spacing in Java
linked to: http://stackoverflow.com/q/6000810
has answer: http://stackoverflow.com/a/25750701
possible better answer: http://stackoverflow.com/a/25750796
has answer: http://stackoverflow.com/a/25750694
tagged with: format

http://stackoverflow.com/q/25743267
type: Question
has comment: http://stackoverflow.com/comment/40251605
has comment: http://stackoverflow.com/comment/40252439
has title: simpleJdbcCall returning only 1 row
has comment: http://stackoverflow.com/comment/40252483
has comment: http://stackoverflow.com/comment/40252883
downvote count: 0
favorite count: 0
tagged with: postgresql
has comment: http://stackoverflow.com/comment/40256270
tagged with: spring-jdbc
has comment: http://stackoverflow.com/comment/82980227
answer count: 0
type: UnansweredQuestion
tagged with: plpgsql
upvote count: 1
has body: I have written a stored procedure in pl/pgsql and it is working fine in pgAdmin. And i am using simpleJBDCCall to call the procedure which returns a set of record. When i call the stored procedure from java using SimpleJdbcCall execute function only 1 row is returned to java, the same procedure when called in pgAdmin returns multiple rows. my stored procedure is : CREATE OR REPLACE FUNCTION get_instruments_list(userName varchar, OUT a int,out b int,out c int) RETURNS setof Record AS $$ DECLARE BEGIN RETURN query select 1,2,3; RETURN QUERY select 5,2,3; RETURN query select 6,2,3; return; END; $$ LANGUAGE 'plpgsql' VOLATILE; my java function to call the stored procedure is : public static void main(String[] a){ ApplicationContext applicationContext = new ClassPathXmlApplicationContext("/config/applicationContext-postgreSQL.xml"); JdbcTemplate jdbcTemplate = (JdbcTemplate) applicationContext.getBean("pgJdbcTemplate"); SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate); jdbcCall.setSchemaName("dhapic"); jdbcCall.setProcedureName("get_instruments_list"); Map&lt;String, String&gt; inputParamater = new HashMap&lt;&gt;(); inputParamater.put("userName", "dhanush"); jdbcCall.returningResultSet("result", new RowMapper() { @Override public InstrumentList mapRow(ResultSet rs, int rowNum) throws SQLException { InstrumentList instrumentList = new InstrumentList(); instrumentList.setInstrumentId(rs.getInt(1)); instrumentList.setInstrumentToken(rs.getInt(2)+""); instrumentList.setUserRole(rs.getInt(3)+""); return instrumentList; } }); Map&lt;String,Object&gt; response = jdbcCall.execute(inputParamater); System.out.println("response"+response); } JdbcTemplet values is pass using spring. response object just contains 1 row, but i am expecting 3 rows. Please help me debug the problem.
has comment: http://stackoverflow.com/comment/40266741
tagged with: stored-procedures
has comment: http://stackoverflow.com/comment/40253159
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40252849

http://stackoverflow.com/q/25801264
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40370417
tagged with: java
tagged with: mysql
type: Question
has body: I have about 200 millions of text files in a folder and i need to load them in mysql. I can not use LOAD LOCAL DATA command since my text files are in raw format and i need to parse them first. I am using Java for this. Issue is that I am able to process only 1500 files at a time (takes 5 to 10 minutes for processing) and after that I get Java heap source error, I have tried -xms arguments but still the problem is same. Is there a way to parse all files and load them in mysql in reasonable time. Thanks.
has title: how to load huge number of files in mysql using java?
score: 0
has comment: http://stackoverflow.com/comment/40359381
has comment: http://stackoverflow.com/comment/40378307
has comment: http://stackoverflow.com/comment/40358031
has comment: http://stackoverflow.com/comment/40370353
answer count: 0
has comment: http://stackoverflow.com/comment/40357683
type: UnansweredQuestion

http://stackoverflow.com/a/25862755
upvote count: 2
has comment: http://stackoverflow.com/comment/40469840
has body: (?&lt;!\d\.)(\d+)(?!\.) Try this .Replace by $1.0 See demo. http://regex101.com/r/jT3pG3/24
has comment: http://stackoverflow.com/comment/40498232
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40469762
has comment: http://stackoverflow.com/comment/40469787
answers question: http://stackoverflow.com/q/25862727
type: Answer
accepted answer of: http://stackoverflow.com/q/25862727

http://stackoverflow.com/q/25857568
type: Question
has body: I have a new application that will be inserting a lot of data, and must be able to handle many inserts per second. The database schema consists of two tables, a HEADER and DETAIL table. The HEADER table contains some minimal information, the DETAIL table has the bulk of the data that will not be updated. The HEADER record has a PK constraint on the ID field. The ID value is created by a sequence generator on insert. The DETAIL.HEADER_ID field has FK constraint on the HEADER.ID field. My question is which option will perform the fastest inserts? This will be running on Weblogic 11g, Oracle 11g. Looking at upwards of 1000+ inserts/sec. 1) Use JDBC's Statement.RETURN_GENERATED_KEYS option on the HEADER insert, get the generated key, then insert the DETAIL record. 2) First call sequence.nextval, then insert the HEADER record, then insert the DETAIL record. 3) Somehow grab a block of sequence ids, insert all HEADER records, then insert all DETAIL records. (how can I grab a block of sequence ids?).
answer count: 1
score: 0
tagged with: oracle-database
tagged with: jdbc
has answer: http://stackoverflow.com/a/25857689
accepted answer: http://stackoverflow.com/a/25857689
has title: Inserting into two tables with minimal overhead
type: AnsweredQuestion
tagged with: weblogic
has comment: http://stackoverflow.com/comment/40464138
tagged with: java

http://stackoverflow.com/comment/40287356
score: 0
comment on: http://stackoverflow.com/q/25759740
type: Comment
type: QuestionComment
has text: I do not know, a link, a private message maybe.

http://stackoverflow.com/comment/40487219
has text: And what do you mean by *"open a particular JPanel "*? You can't strictly open a `JPanel`, what exactly is the operation you want to do?
type: Comment
comment on: http://stackoverflow.com/q/25872055
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40396602
score: 0
type: QuestionComment
type: Comment
has text: You also have a typo "Class.forName("org.h2.Driver"));" not sure if it would compile that way though...
comment on: http://stackoverflow.com/q/25822359

http://stackoverflow.com/comment/40494699
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25873898
type: AnswerComment
has text: We use only Tomcat and hence I am asking for in Tomcat 7

http://stackoverflow.com/a/25788368
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25786907
has body: That happens because you have installed one package named sox that brings a play command. So when you run play something you are executing that program and not the play framework one. So you should: Remove that package: it is not installed by default in Ubuntu so unless you really need it for other purposes you should remove it apt-get remove sox Add play framework to your PATH. Supposing your play installation is in /opt/play, just do something like export PATH=/opt/play/bin:$PATH You should add those commands in the required file (ex: bootstrap.sh).
type: Answer
has comment: http://stackoverflow.com/comment/40333424
has comment: http://stackoverflow.com/comment/40333292
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25786907
upvote count: 1

http://stackoverflow.com/comment/40212275
has text: You should ***not*** use `getString()` you *have* to use `getObject()` and then cast it to a `ResultSet` as I have done in my code.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25720667

http://stackoverflow.com/q/25743090
tagged with: java-web-start
answer count: 2
has answer: http://stackoverflow.com/a/25743818
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has title: Java Web Start is not working
tagged with: jdbc
score: 1
upvote count: 1
type: Question
has body: I have been working on a Java project. It is now over but Java Web start is not working. I compile the program and put dist files in my Tomcat Server. I want clients to download my program and use as a desktop application. I can run the program inside Netbeans IDE just fine, however when I try it using .jnlp file it is giving errors. Until a while ago I managed to run the program using jnlp, somehow it is giving below errors. I can still run the program with executable jar but I desperately need to use Java Web Start. `Exception in thread "Abandoned connection cleanup thread" java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "setContextClassLoader") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at com.sun.javaws.security.JavaWebStartSecurity.checkPermission(Unknown Source) at java.lang.Thread.setContextClassLoader(Unknown Source) at com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:38) Exception in thread "AWT-EventQueue-2" java.lang.ExceptionInInitializerError at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:298) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at dbo.dealSave.user(dealSave.java:364) at TradeX.uyegiris.jButton1ActionPerformed(uyegiris.java:177) at TradeX.uyegiris.access$100(uyegiris.java:20) at TradeX.uyegiris$2.actionPerformed(uyegiris.java:81) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at jav…
tagged with: java
has answer: http://stackoverflow.com/a/25743859

http://stackoverflow.com/q/25753835
answer count: 0
type: UnansweredQuestion
has body: this is my xml file &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.interadd.MainActivity" &gt; &lt;com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="ca-app-pub-2961758853938686/9050318854"/&gt; &lt;/LinearLayout&gt; this is my mainfest file &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!DOCTYPE xml&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.interadd" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-permission android:name="android.permission.INTERNET"/&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/&gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="21" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" &gt; &lt;meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/&gt; &lt;activity android:name=".MainActivity" android:label="@string/app_name" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|…
has title: The following classes could not be instantiated:com.google.android.gms.ads.AdView(Open Class, Show Error Log)
tagged with: java
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40281747
tagged with: android
has comment: http://stackoverflow.com/comment/40272143

http://stackoverflow.com/q/25873158
tagged with: jira
type: Question
has title: How can I upgrade my Jira client?
has body: I want to upgrade from 2.0.0-m2 to the latest version of the Java Jira client. What do I need to do?
score: 0
upvote count: 1
answer count: 1
favorite count: 0
tagged with: jira-rest-api
downvote count: 1
has answer: http://stackoverflow.com/a/25873159
accepted answer: http://stackoverflow.com/a/25873159
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40254892
type: QuestionComment
has text: [What is the XY problem?](http://meta.stackexchange.com/q/66377) - I think we have one here. Rather than discussing a weird solution to your problem, please provide a bit more background about your problem and let us suggest better solutions. Why is this file being used at all?
comment on: http://stackoverflow.com/q/25745168
type: Comment
score: 1

http://stackoverflow.com/q/25841877
tagged with: java
has comment: http://stackoverflow.com/comment/40651694
type: Question
tagged with: ppm
upvote count: 1
answer count: 1
favorite count: 0
tagged with: regex
downvote count: 0
has answer: http://stackoverflow.com/a/25842782
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40432077
has comment: http://stackoverflow.com/comment/40432432
has title: Using a regex for importing dimensions in a ppm file
has body: I’ve a problem finding the proper regex to read a ppm file dimensions. I don’t know if it’s because my regex is wrong or if I misuse the Pattern.compile method, but I get a java.util.NoSuchElementException. Below my regex and the code along to it. It reads the whole file since my regex always return null. Thanks. package projet; import java.awt.Color; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Pattern; public class Ppm extends File{ private Dimensions d; private Color[][] p; public Ppm(String pathname) { super(pathname); } public void read(){ try { Scanner s=new Scanner(new FileReader(this.getPath())); while(s.findInLine(Pattern.compile("/^\\d* \\d*\\s$/")) == null &amp;&amp; s.hasNext()){ System.out.println(s.nextLine()); } s.close(); } catch (FileNotFoundException ex) { Logger.getLogger(Ppm.class.getName()).log(Level.SEVERE, null, ex); System.out.println("Check filepath."); } } } Here's my sample file : https://www.dropbox.com/s/z35dvi90zdfkws0/carte1.ppm?dl=0 EDIT : I tried with a matcher, but it still doesn't work, following the corrected regex. Here's my code, it never matches the pattern... public class Ppm extends File{ private Dimensions d; private Color[][] p; public Ppm(String pathname) { super(pathname); d=new Dimensions(0, 0); } public void read(){ try { Scanner s=new Scanner(new FileReader(this.getPath())); Pattern p=Pattern.compile("^\\d+ \\d+\\s$"); Matcher m; while(s.hasNext()){ m=p.matcher(s.nextLine()); if(m.matches()){ System.out.println("Found"); } } //System.out.println("W : "+d.getWidth()+" H: "+d.getHeight()); } catch (FileNotFoundException ex) { Logger.getLogger(Ppm.class.getName()).log(Level.SEVERE, null, ex); System.out.println("Check filepath."); } } }
score: 1

http://stackoverflow.com/q/25868440
has body: For this question, say, we have a MVC configuration class: @Configuration public class MvcConfig extends WebMvcConfigurationSupport { @Bean public ViewResolver viewResolver() { return new InternalResourceViewResolver(); } // bla-bla } I have several bean definitions as usual in a configuration class. The question is while enabling some features such as @EnableCaching, @EnableMBeanExport, @EnableAspectJAutoProxy, how can i control enabling process of those features, ie: @Configuration // @EnableCaching instead of this public class MvcConfig extends WebMvcConfigurationSupport { @Autowired SomeResource someResource; @Bean public SomeBean someBean() { if(someResouce.someEvaluation(someParam)) { enableCaching(); // is that enabling possible? } } @Bean public ViewResolver viewResolver() { return new InternalResourceViewResolver(); } // bla-bla } NOTE: I'm using spring 3.2.x
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40480547
downvote count: 0
has comment: http://stackoverflow.com/comment/40481601
has title: spring conditional feature enabling
has comment: http://stackoverflow.com/comment/40508639
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40480836
tagged with: spring-annotations
tagged with: spring

http://stackoverflow.com/comment/40289384
score: 0
type: AnswerComment
has text: What do you mean by fully qualified package name?
type: Comment
comment on: http://stackoverflow.com/a/25764076

http://stackoverflow.com/comment/40395628
type: Comment
has text: I'd rather sync with a `Snowfield` (non-static) object (eg passed to the constructor) or whatever defines the coordinates that require locking. But that's just from a software engineering point of view. The class lock will work, too.
type: AnswerComment
comment on: http://stackoverflow.com/a/25822106
score: 0

http://stackoverflow.com/q/25827965
has body: Hey everyone I am really new to libgdx and Open GL so I am having trouble with this sample project I have to do. Here is my code it should be simply displaying a three buttons from a .batch file any help is greatly appreciated. After going through the debugger the only thing I could see was that the call to get draw able returned object[o] but if it didn't find anything why didn't it error out? public MainScreen() { spriteBatch = new SpriteBatch(); stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false, spriteBatch); font = new BitmapFont(Gdx.files.internal("assets/font.fnt"), Gdx.files.internal("assets/font.png"), false); buttons = new TextureAtlas("assets/GameButtons.pack"); images = new Skin(); images.addRegions(buttons); SFXButton = new Button(images.getDrawable("sfxButton")); SFXButton.setPosition(295, 310); APIButton = new Button(images.getDrawable("apiButton")); APIButton.setPosition(405, 310); GameButton = new Button(images.getDrawable("gameButton")); GameButton.setPosition(515, 310); SFXClick = Gdx.audio.newSound(Gdx.files.internal("assets/button_click.wav")); } @Override public void dispose() { spriteBatch.dispose(); stage.dispose(); } @Override public void render(float delta) { stage.act(delta); stage.draw(); stage.addActor(SFXButton); stage.addActor(APIButton); stage.addActor(GameButton); spriteBatch.begin(); font.setColor(Color.RED); font.draw(spriteBatch, "PennyPop", 455 - font.getBounds("PennpyPop").width/2, 460 + font.getBounds("PennyPop").height/2); if (SFXButton.isPressed()) SFXClick.play(); spriteBatch.end(); }
has answer: http://stackoverflow.com/a/25828046
type: Question
tagged with: graphics
tagged with: libgdx
answer count: 1
has title: libgdx not displaying anything
type: UnansweredQuestion
score: 0
tagged with: java

http://stackoverflow.com/comment/40370752
has text: Remove these two lines from standalone-full.xml 1- <extension module="org.jboss.as.jaxrs"/> 2- <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
comment on: http://stackoverflow.com/a/25808043
type: AnswerComment
score: 0
type: Comment

web-inf
tags question: http://stackoverflow.com/q/25853804
tag name: web-inf
type: Tag

http://stackoverflow.com/comment/40306950
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25773380
type: Comment
has text: @prime as ajb said, the formula for n>0 needs to be adapted to the concrete S.

http://stackoverflow.com/comment/40397650
type: Comment
type: QuestionComment
has text: @sunil that is all there is to that method it should simply remove the notification. I call the method from another class of mine using an instance of the NLS class. I have checked the values (parameters) and all seems well apart from the tag t value, sorry
comment on: http://stackoverflow.com/q/25823217
score: 0

objective-c
tags question: http://stackoverflow.com/q/25797150
type: Tag
tag name: objective-c
tags question: http://stackoverflow.com/q/25730427

http://stackoverflow.com/a/25751847
upvote count: 2
answers question: http://stackoverflow.com/q/25751814
type: Answer
score: 2
downvote count: 0
has body: public static void main(String[] args) declares a method, but its body is missing. What is supposed to do? For instance: public static void main(String[] args) { Rectangle r = new Rectangle(10, 3); System.out.println("Area: " + r.findArea()); }

http://stackoverflow.com/comment/40365758
type: QuestionComment
has text: look for ternary operation....
score: 0
comment on: http://stackoverflow.com/q/25806018
type: Comment

http://stackoverflow.com/comment/40250967
type: Comment
type: AnswerComment
has text: Please include relevant information from links in the answer itself. Answer are supposed to be self-contained and offer all the details required. Stack overflow is a question and answer site, not a question and "oh look over there" site, Google exists for that.
comment on: http://stackoverflow.com/a/25742830
score: 0

http://stackoverflow.com/q/25788390
has answer: http://stackoverflow.com/a/25900608
type: UnansweredQuestion
tagged with: java
has title: Class instance of generics type T BUT which extends a super class with generics
type: Question
linked to: http://stackoverflow.com/q/3437897
tagged with: inheritance
score: 0
has body: I've use this method to retrieve the type of my generic, and no problem... until now Now, I've got this kind of structure: public class Toto&lt;T&gt; extends OtherOne&lt;X,Y,Z&gt; {...}` and when I use the ((ParameterizedType)getClass().getGenericSuperclass()).getActualTypeArguments()[0];` it's return me the type Class&lt;X&gt; of my OtherOne class, not Class&lt;T&gt;! Has anyone ever encountered this problem? Whatever I've tried didn't work, and I don't want to use this solution of getting the class as an argument of my Constructor.
answer count: 1
tagged with: generics

http://stackoverflow.com/q/25852639
answer count: 1
tagged with: shared-libraries
favorite count: 0
tagged with: c++
has body: I´m using Visual Studio 2010 to create a DLL file and woks fine with the code bellow: System.load("c:\\sharedFiles\\dll\\VisualDLL.dll"); Now I need the library to be static, because I can not install on the other machine the other libraries what I used when I created the DLL and so I need to come all in one package. After compile the same code to a lib, my application call the method bellow: System.load("c:\\sharedFiles\\dll\\VisualDLL.lib"); But the following error appeared after creating .LIB create a file with Visual Studio 2010 to run the application appears: c:\sharedFiles\dll\VisualDLL.dll: %1 is not valid Win32 application The version of java is 1.7.09 64bits and Visual Studio it's compiling to 64bit machine target. what happened? I cannot load lib file with this approach?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/79693474
score: 2
has answer: http://stackoverflow.com/a/25853204
downvote count: 0
tagged with: java
tagged with: visual-studio-2010
has title: DLL to LIB - Can´t open LIB file with JNI and System.load call
type: Question
tagged with: dll
upvote count: 2

http://stackoverflow.com/q/25779050
upvote count: 1
type: Question
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/40317310
tagged with: bubble-sort
tagged with: sorting
has title: 2d array multiple movement selection sort
answer count: 1
favorite count: 0
tagged with: multidimensional-array
type: UnansweredQuestion
has body: I am trying to write a method that sorts (using bubble sort) the items in every other row of a 2d array. When a movement happens in the first row, I want the category number in the row immediately under the row being sorted to also move. The bubble sort works correctly for the first half of the array, but then stops half way through the array and the movement for the row underneath does not happen correctly. for(int i = 0; i&lt;differencearray.length; i= i+2){ //skips every other row for(int j = 0; j&lt;differencearray[i].length; j++){ for(int l = 0; l&lt;differencearray[i].length-1; l++){ if(differencearray[j][l]&gt;differencearray[j][l+1]){ int temp = differencearray[j][l]; //moves row being sorted differencearray[j][l] = differencearray[j][l+1]; differencearray[j][l+1] = temp; int temp1 = differencearray[i+1][j]; //moves row immediately below what is being sorted differencearray[i+1][j] = differencearray[i+1][l]; differencearray[i+1][l] = temp1; } } } } Expected output: 9 13 15 24 2147483647 3 4 2 5 1 15 16 17 18 2147483647 1 4 5 3 2 9 12 18 27 2147483647 1 4 2 5 3 12 13 16 25 2147483647 3 1 2 5 4 17 24 25 27 2147483647 2 1 4 3 5 Actual output: 9 13 15 24 2147483647 1 2 3 4 5 15 16 17 18 2147483647 1 2 3 4 5 9 12 18 27 2147483647 1 4 3 2 5 13 16 12 2147483647 25 1 4 2 3 5 24 17 27 25 2147483647 2 4 3 1 5 Any idea of what I am doing wrong? Thank you in advance!
has answer: http://stackoverflow.com/a/25779235
score: 1
tagged with: java

http://stackoverflow.com/q/25717421
has comment: http://stackoverflow.com/comment/40203717
upvote count: 0
has answer: http://stackoverflow.com/a/25717465
has body: So I have an abstract class, Player. Then I have classes, thePlayer, and Dealer, which extend Player. I have a method initHand, which is an array of BlackJackCard. in thePlayer and Dealer I call this method to assign to my own array to use. However, I get null exceptions as if there are no cards in the array, meaning somethings wrong but what I've done seems to make logical sense. public BlackJackCard[] initHand(BlackJackDeck myDeck) { PlayerHand = new BlackJackCard[x]; PlayerHand[0] = mydeck.deal(); PlayerHand[1] = mydeck.deal(); return PlayerHand; } and then my ThePlayer class public BlackJackCard[] initHand(BlackJackDeck adeck) { return super.initHand(adeck); } public BlackJackCard[] PlayerHand = initHand(deck); EDIT: so since formatting in comments is weird i'll do this here. Here is my main method, where I create myDeck and feed it too my ThePlayer and Dealer classes. myDeck = new BlackJackDeck(); myDeck.createDeck(); myDeck.shuffleDeck(); thePlayer myPlayer = new thePlayer(myDeck); Dealer theDealer = new Dealer(myDeck); Then in thePlayer I have my constructor BlackJackDeck deck; public thePlayer(BlackJackDeck mydeck) { deck = mydeck; } the error it gives Exception in thread "main" java.lang.NullPointerException at blackjack.thePlayer.presenthand(thePlayer.java:79) at blackjack.Blackjack.main(Blackjack.java:36) Java Result: 1 line 79=`@Override public String presenthand() { String myhand = ""; for (int i = 0; i &lt; currentCard; i++) { (79)myhand += (PlayerHand[i].getSuit() + " of " + PlayerHand[i].getNum() + " "); } return myhand; }` and then line 39 is the line in the main class where I call presenthand
type: UnansweredQuestion
tagged with: abstraction
has comment: http://stackoverflow.com/comment/40203201
has comment: http://stackoverflow.com/comment/40203507
has comment: http://stackoverflow.com/comment/40203140
has comment: http://stackoverflow.com/comment/40204503
favorite count: 0
has comment: http://stackoverflow.com/comment/40203113
type: Question
score: -2
tagged with: java
downvote count: 2
answer count: 1
has title: with initializing arrays from methods

http://stackoverflow.com/comment/40277093
has text: How much do you understand about interfaces? I would suggest you learn the core concepts of the language before you start using Selenium, or indeed doing anything "serious".
score: 1
type: Comment
comment on: http://stackoverflow.com/q/25757034
type: QuestionComment

http://stackoverflow.com/q/25765825
has comment: http://stackoverflow.com/comment/40292833
has comment: http://stackoverflow.com/comment/40292749
has comment: http://stackoverflow.com/comment/40293532
has answer: http://stackoverflow.com/a/25766921
has comment: http://stackoverflow.com/comment/40292577
has comment: http://stackoverflow.com/comment/40293314
linked to: http://stackoverflow.com/q/1272130
has comment: http://stackoverflow.com/comment/40292690
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40292497
has comment: http://stackoverflow.com/comment/40292843
has comment: http://stackoverflow.com/comment/40293274
has body: I am creating simple function to check weather I have write/delete permission to a folder I want to know whether the operating system will allow writing into the folder or not ? public static String PermissionCheck(String FilePath) { //File f = new File(FilePath); String actions = "read,write"; try { AccessController.checkPermission(new FilePermission(FilePath, actions)); return ("You have read/write permition to use : " + FilePath); } catch (SecurityException e) { return ("You don't have read/write permition to use : " + FilePath); } } When I call either with correct path or incorrect path the method it always returns message from cathc. I know its duplicate question I have already gone through many links but no luck !! Similar Question Similar Question 1 Example : PreChecks.PermissionCheck("C:/TEST/G2"); PreChecks.PermissionCheck("C:/Program Files/SAP"); Both calls return the message from catch block where I have all permission on "C:/TEST/G2" and no write permission on "C:/Program Files/SAP". I have also tried canWrite but it says I have write permissions to "C:/Program Files/SAP" but I know I don't have those.
tagged with: java
linked to: http://stackoverflow.com/q/6231779
type: Question
has comment: http://stackoverflow.com/comment/40292707
answer count: 1
has comment: http://stackoverflow.com/comment/40292352
has title: Issue with checking permission of a folder in java
has comment: http://stackoverflow.com/comment/40292713
has comment: http://stackoverflow.com/comment/40292350
score: 0
has comment: http://stackoverflow.com/comment/40292770

http://stackoverflow.com/q/25808633
tagged with: richfaces
tagged with: web.xml
accepted answer: http://stackoverflow.com/a/28724021
has comment: http://stackoverflow.com/comment/40370583
has comment: http://stackoverflow.com/comment/40370852
possible better answer: http://stackoverflow.com/a/25975094
has answer: http://stackoverflow.com/a/25975094
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40370349
tagged with: java
answer count: 2
has title: Richfaces 4.3 - Disable resource (JS/CSS) loading
has answer: http://stackoverflow.com/a/28724021
score: 0
has body: Is there a way to to prevent loading richfaces resources on 4.3.* version? Old RF version's settings as well as any other relevant settings I found on google don't work: org.richfaces.resourceOptimization.enabled true org.richfaces.LoadStyleStrategy NONE org.richfaces.LoadScriptStrategy NONE

http://stackoverflow.com/a/25857778
accepted answer of: http://stackoverflow.com/q/25857667
answers question: http://stackoverflow.com/q/25857667
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40461035
has body: Your program could use some restructuring. Here's how I might approach it: Minimize your field declarations. You don't need the initial definitions of line or words String fileName = "phillip.txt"; String line; int count = 0; BufferedReader in; Be careful with streams. You should handle when there are exceptions to reading files: try { in = new BufferedReader(new FileReader(fileName)); Next, assign line and check if the result of the assignment operator is null. When there are no more lines in the file, the test will fail and the loop will exit. while ((line = in.readLine()) != null) { You can increment count all in one line. You don't seem to be doing anything with loop or words, so for now I've omitted that from this example. count += line.split(" ").length; } Close the buffered reader (no matter what!) and exit. } finally { if (in != null) in.close(); } System.out.print(count);
type: Answer
has comment: http://stackoverflow.com/comment/40461005
has comment: http://stackoverflow.com/comment/40461272
score: 1
has comment: http://stackoverflow.com/comment/40461313
upvote count: 1
downvote count: 0

http://stackoverflow.com/q/25715521
favorite count: 0
has comment: http://stackoverflow.com/comment/40199727
has comment: http://stackoverflow.com/comment/40200092
has comment: http://stackoverflow.com/comment/40199703
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40199744
has body: I am having some trouble preventing the user from entering numbers with the scanner class. This is what I have: package palindrome; import java.util.Scanner; public class Palindrome { public static void main(String[] args) { Scanner input = new Scanner(System.in); String word; String inverse = ""; System.out.println("Write a sentence or word: "); while (!input.hasNext("[A-Za-z]+")) { System.out.println("Not valid! Try again: "); input.nextLine(); } word = input.nextLine(); word = word.replaceAll("\\s+",""); word = word.toLowerCase(); int length = word.length(); length = length - 1; for (int i = length; i &gt;= 0; i--) { inverse = inverse + word.charAt(i); } if (word.equals(inverse)) { System.out.println("Is a palindrome."); } else { System.out.println("Is not a palindrome."); } } } Basically when I enter a word or sentence I want it to check if it has any numbers anywhere in the input, if it has then you need to enter another one until it doesn't. Here is an example of output: Write a sentence or word: --> 11 Not valid! Try again: --> 1 test Not valid! Try again: --> test 1 Is not a palindrome. As you can see it works for most cases, but when I enter a word FIRST and then a space followed by a number it evaluates it without the number. I am assuming this is happening because in the while loop is checking for only input.hasNext but it should be input.hasNextLine I believe to check the entire string. However I cannot have any arguments if I do that. Help much appreciated!
has comment: http://stackoverflow.com/comment/40199806
has comment: http://stackoverflow.com/comment/40199876
tagged with: java.util.scanner
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40199758
type: Question
has answer: http://stackoverflow.com/a/25715714
has comment: http://stackoverflow.com/comment/40199936
has comment: http://stackoverflow.com/comment/40199706
has comment: http://stackoverflow.com/comment/40199796
has title: Prevent the user entering numbers in java Scanner?
has comment: http://stackoverflow.com/comment/40199812
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25715714

http://stackoverflow.com/comment/63976276
comment on: http://stackoverflow.com/a/25851499
has text: Why not use Internet Search for "Java Data Objects" or JDO?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40484953
has text: what I understand is that you suggest to test it from inside to outside. am I correct?
comment on: http://stackoverflow.com/a/25868848
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40471222
has text: For what purpose you need to do that?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25863585

http://stackoverflow.com/q/25830358
tagged with: canvas
upvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25856295
accepted answer: http://stackoverflow.com/a/25856295
has body: In my app, I have a class that acts as a Swing component to render a 3D window using LWJGL. When I go to run the app, I get the error from Display.create() that Parent.isDisplayable() must be true. I've tried looking, and most people say it happens when you call Display.create() before calling setVisible(). However, that's not the case here, and I can't seem to figure out why I'm getting the error. My control looks like this: public class WorldCanvas extends JPanel { private final Canvas canvas = new Canvas(); public WorldCanvas() { ... add(canvas, BorderLayout.CENTER); try { Display.setParent(canvas); setVisible(true); canvas.setVisible(true); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); return; } } } It's being added directly to a JFrame, and setVisible(true) is also called on the JFrame before this is added (however this error is being generated before it can even be added, given it's in the constructor). Why am I getting this error?
type: AnsweredQuestion
downvote count: 0
tagged with: lwjgl
has title: Canvas not displayable in LWJGL app
tagged with: swing
type: Question
tagged with: opengl
score: 1
tagged with: java

http://stackoverflow.com/comment/40444997
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25848370
has text: I can't think what would cause such an issue. How are the date fields stored in your table (datatype and the date format)?
score: 0

http://stackoverflow.com/q/25734400
accepted answer: http://stackoverflow.com/a/25734678
upvote count: 1
tagged with: swing
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40237672
tagged with: java
tagged with: icons
linked to: http://stackoverflow.com/q/18224184
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40236096
favorite count: 0
has answer: http://stackoverflow.com/a/25734678
has comment: http://stackoverflow.com/comment/40236356
has body: I do not want my jframe to display any icon in taskbar. Basically if we don't specify any IconImage to it, then it shows default icon. But in my program I don't want any icon to be displayed. setUndecorated(true); setSize(208, 58); setImageIcon(null); // same result If I will use transparent image as Icon, even then the system will show a transluscent rectangle for icon. My question is straight forward. I don't think I need to give any coding for it. If there exist any method to do that, let me know. 1 way by which it could be done is to use JWindow or Window, but there are many drawbacks for using it and I don't want to do it this way.
type: Question
has title: Prevent JFrame from showing any Icon
tagged with: jframe
score: 0

http://stackoverflow.com/q/25774846
has answer: http://stackoverflow.com/a/25774917
favorite count: 0
has comment: http://stackoverflow.com/comment/40309749
has title: java error not a statement and ';' expected
score: -3
has comment: http://stackoverflow.com/comment/40309677
has body: Fairly new to Java and I cannot understand why I keep getting these errors. Can anyone assist with this? Here's where the error is: if (paramInt == 1) Process localProcess = Runtime.getRuntime().exec new StringBuilder().append("/").append(paramString2).append("/").toString()); public static String downloadFile(String paramString1, String paramString2, int paramInt) { try { File localFile = new File(paramString2); if (localFile.exists()) { localFile.delete(); } URLConnection localURLConnection = new URL(paramString1).openConnection(); FileOutputStream localFileOutputStream = new FileOutputStream(new File(paramString2)); InputStream localInputStream = localURLConnection.getInputStream(); byte[] arrayOfByte = new byte[localURLConnection.getContentLength()]; int j = 0; int i; while ((i = localInputStream.read(arrayOfByte)) &gt; -1) { localFileOutputStream.write(arrayOfByte, 0, i); j += i; } String str = new StringBuilder().append(" ").append(localFile.length()).append(" ").append(paramString2).toString(); localInputStream.close(); localFileOutputStream.close(); try { if (paramInt == 1) Process localProcess = Runtime.getRuntime().exec(new StringBuilder().append("/").append(paramString2).append("/").toString()); } catch (Exception localException) { } return str; } catch (IOException localIOException) { localIOException.printStackTrace(); } return paramString1; }
type: AnsweredQuestion
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/40309686
accepted answer: http://stackoverflow.com/a/25774917
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40309712
tagged with: java
has comment: http://stackoverflow.com/comment/40309579
downvote count: 4
answer count: 1

http://stackoverflow.com/q/25832564
accepted answer: http://stackoverflow.com/a/25962661
has comment: http://stackoverflow.com/comment/40414579
answer count: 1
has body: I have gone thru this Link and got some questions on Major Garbage collection and Parallel collector Question1:- Link says "Often a major collection is much slower because it involves all live objects" , i did not get how working on live objects make major collection slower in comparison Minor collection which works on mix of unreachable objects and live objects. Question2:- Link says "Major garbage collection are also Stop the World events". On other hand it says "CMS collector attempts to minimize the pauses due to garbage collection by doing most of the garbage collection work concurrently with the application threads" So does CMS collector stop the main application thread till it completes or it runs concurrently with application thread Question3:- As there objects is moved from eden >(Minor GC) surivivor >(Minor GC) old generation > (Major GC) > Clean up old generation and compact it. As per my understanding object memory location is changed when object is either moved from surivivor to old generation or when compaction is done major GC( though object memory location is not changed when its moved fron eden to survivor space)
score: 0
tagged with: memory-management
has title: Major Garbage collection with Concurrent Mark Sweep Collector?
tagged with: garbage-collection
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25962661

http://stackoverflow.com/comment/93181667
has text: You need to strictfp this.
type: AnswerComment
comment on: http://stackoverflow.com/a/25768502
score: 0
type: Comment

http://stackoverflow.com/comment/40391148
comment on: http://stackoverflow.com/a/25813398
has text: Update: I fixed it, the problem was it was recording from the wrong mic. Is there a way to determine what device I'm recording with, and/or display all possible devices and then choose which one to use?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40395730
type: Comment
has text: Thanks, This Worked. But I am still facing -"Error msg: Operand type clash: nvarchar is incompatible with image SQLSTATE: S0002 Error code: 206 Error code: 0 " Issue.
comment on: http://stackoverflow.com/a/25822135
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40480541
score: 0
type: Comment
has text: `t.remove("2")` ?? where `t` is a String ??
type: QuestionComment
comment on: http://stackoverflow.com/q/25868906

http://stackoverflow.com/comment/40511649
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25848460
type: QuestionComment
has text: Having said the above, I'm not sure it will help either. I just found [this other SO question](http://stackoverflow.com/questions/18195820/how-should-i-use-easymocks-mock-annotation-new-in-version-3-2) that suggests that it is trying to do the injection reflectively based on the type. It looks like you might have to build your own mocks and set them yourself. Perhaps have a constructor that can take both the Param values and then use that in your test.

http://stackoverflow.com/q/25872832
tagged with: java
type: Question
answer count: 2
score: -1
has answer: http://stackoverflow.com/a/25872882
downvote count: 1
possible better answer: http://stackoverflow.com/a/25872882
favorite count: 0
upvote count: 0
has title: The constructor is undefined error?
has body: I am making a login logout module with swipe views I extended the class to fragments for the swipe views then I got this error "The constructor AlertDialog.Builder(Android) is undefined" this happened after I extended the class to a fragment it worked before when I was using activity my whole code Android.java import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; 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.view.Window; import android.view.WindowManager; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; import com.learn2crack.library.DatabaseHandler; import com.learn2crack.tab.Android; import java.util.HashMap; public class Android extends Fragment { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View android = inflater.inflate(R.layout.android_frag, container, false); DatabaseHandler db = new DatabaseHandler(getActivity()); HashMap&lt;String,String&gt; user = new HashMap&lt;String, String&gt;(); user = db.getUserDetails(); /** * Displays the registration details in Text view **/ final ImageButton logoutbtn = (ImageButton)android.findViewById(R.id.logoutbtn); final TextView fname = (TextView)android.findViewById(R.id.fname); final TextView lname = (TextView)android.findViewById(R.id.lname); final TextView uname = (TextView)android.findViewById(R.id.uname); final TextView email = (TextView)android.findViewById(R.id.email); final TextView created_at = (TextView)android.findViewById(R.id.regat); fname.setText(user.get("fname")); lname.setText(user.get("lname")); uname.…
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40487948
tagged with: android-fragments
has answer: http://stackoverflow.com/a/25872910
accepted answer: http://stackoverflow.com/a/25872910

http://stackoverflow.com/comment/40518989
type: QuestionComment
has text: I have getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); in onCreate . If i remove this UI does not flicker but the framelayout which contains mic part come above keyboard. And I need full screen.
score: 0
comment on: http://stackoverflow.com/q/25836860
type: Comment

http://stackoverflow.com/comment/40329844
type: Comment
type: QuestionComment
score: 3
has text: Different look and feels treat the laying out of components differently. Your custom implementation may not work on all the look and feels. Consider maybe just using `JFileChooser.setAcessory` to avoid this problem. As seen [here](http://stackoverflow.com/a/24291619/2587435). Or seen in [the tutorial](http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html#accessory)
comment on: http://stackoverflow.com/q/25786269

http://stackoverflow.com/comment/40201212
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25716176
has text: @Semm: "not working" tells us little that would allow us to understand what is going on. Please elaborate. Have you tested the before and after arrays to see what they contain?
score: 0

http://stackoverflow.com/a/26248093
answers question: http://stackoverflow.com/q/25809970
has body: Here is the link of Selenium API, all actions can be found here.
has comment: http://stackoverflow.com/comment/77901616
score: 0
type: Answer

http://stackoverflow.com/comment/40462238
type: QuestionComment
comment on: http://stackoverflow.com/q/25858545
type: Comment
score: 2
has text: Look carefully at your input() method. Input is clearly not being assigned a value other than null.

http://stackoverflow.com/q/25815165
has comment: http://stackoverflow.com/comment/40382986
score: 0
linked to: http://stackoverflow.com/q/19896870
has comment: http://stackoverflow.com/comment/40383016
has comment: http://stackoverflow.com/comment/40383115
has answer: http://stackoverflow.com/a/25815242
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/19896870
tagged with: spring
has body: I am learning Spring framework using the online material, and implemented a simple program as below: I am using the methodology of "Coding to interface" and this is the interface: package com.vipin.math; public interface MathOperations { public int add(int a, int b); public int sub(int a, int b); } One of the implementations that i did: package com.vipin.math; public class MathOperationsImpl implements MathOperations { public int add(int a, int b) { return a+b; } public int sub(int a, int b) { return a-b; } } The main class which depends on this is: package com.vipin.app; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.vipin.math.MathOperations; import com.vipin.math.MathOperationsImpl; public class MainApp { public static void main(String[] args) { MathOperations mathOperations; ApplicationContext appContext = null; appContext = new ClassPathXmlApplicationContext("spring.xml"); mathOperations = appContext.getBean("mathOperationsImpl", MathOperationsImpl.class); System.out.println(mathOperations.add(10, 20)); } Now, since MainApp is dependent on MathOperations (to specific implementing class), and we doing this using getBean() on ApplicationContext. I tried using @Resource / @Autowire instead of using getBean(), like this in Main itself: @Resouce("MathOperationsImpl") MathOperations mathOperations; Also like this: @Autowired() @Qualifire("MathsRelated") MathOperations mathOperations; However, i am getting null pointer exception when i am invoking the add() method. Isn't DI supposed to work in such scenarios? Any clue would be appreciated. Here is spring.xml, only relevant portions shown here &lt;beans &lt;bean id="mathOperationsImpl" class="com.vipin.math.MathOperationsImpl"&gt; &lt;qualifier value="MathsRelated"&gt; &lt;/bean&gt; &lt;bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/&gt;
tagged with: java
type: Question
answer count: 1
has title: Dependency injection in spring framework - working

http://stackoverflow.com/comment/40312990
has text: Why not use the `String#charAt(int)` method?
comment on: http://stackoverflow.com/q/25776665
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25837470
downvote count: 0
answers question: http://stackoverflow.com/q/25837441
type: Answer
has body: The problem is in this block of code: if(coming == null) { coming.right = newnode; return; } If the object reference coming is null, then you cannot refer to coming.right because a null reference does not point to an actual object. And without an actual object, you cannot refer to an object field such as right. If you try to do something with a reference (or pointer) which is null then Java will throw a NullPointerException as you see in your case. What you need to do is to create an actual Node object and assign it to the reference coming and then you will be able to refer to the field right of that object with coming .right. Note that you will have exactly the same error thrown by the first block which begins if(coming == null) because it tries to refer to coming.left when coming is null.
score: 2
upvote count: 2

http://stackoverflow.com/comment/40260857
has text: Question 2 (the first one) you're writting the value 0 to a file, this is the null character according to most charsets so it won't show up in most text editors. At a higher level, why are you working with bits? Working with bytes is going to be much easier.
comment on: http://stackoverflow.com/q/25748270
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40472919
type: Comment
type: AnswerComment
score: 0
has text: I was away from my PC and answered on my iPhone, so sorry for the inexact answer. I think it had all the information you asked for (including point 3) but I will add the classnames now. The configuration (XML or otherwise) does not come into play here.
comment on: http://stackoverflow.com/a/25857846

http://stackoverflow.com/q/25858582
tagged with: port
has title: While Tomcat localhost is running, other War file is not running due to ports already in use
has body: I have my Tomcat up and running and I am able to run example files. But when I am try to run my war file which resides in websapps folder, Tomcat says 8080, 8009, 8005 are already in use and I am receiving 404 error when I run my code. I am wondering why I am receiving port conflicts when I run my war file but not when I am running tomcat example file.
has comment: http://stackoverflow.com/comment/40489428
answer count: 0
score: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40492142
type: Question
has comment: http://stackoverflow.com/comment/40462291
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40491383

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/25832672
tags question: http://stackoverflow.com/q/25757055
type: Tag
tags question: http://stackoverflow.com/q/25746173
tags question: http://stackoverflow.com/q/25728363

http://stackoverflow.com/q/25825289
has answer: http://stackoverflow.com/a/25825330
tagged with: arrays
has title: two-dimensional array java
has answer: http://stackoverflow.com/a/25825337
has answer: http://stackoverflow.com/a/25825413
has answer: http://stackoverflow.com/a/25826252
answer count: 5
has body: Can't understand what I am doing wrong :( I want to fill my array with spaces. But receive a mistake Exception in thread "main" java.lang.Error: Unresolved compilation problem: j cannot be resolved to a variable at Field.space(Field.java:11) at Main.main(Main.java:6) This is my simple code: public class Main { public static void main (String[] args){ Field field = new Field(); field.space(); } } public class Field { private static final int ArraySize = 3; private char spacesymbol = ' '; private char[][] array = new char [ArraySize][ArraySize]; public void space() { for (int i=0; i&lt;ArraySize; i++){ for (int j=0; j&lt;ArraySize; j++) array[i][j]= spacesymbol; System.out.println("[" + array[i][j] + "]"); } } }
has answer: http://stackoverflow.com/a/25825339
type: AnsweredQuestion
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25825330
type: Question
accepted answer: http://stackoverflow.com/a/25825413

http://stackoverflow.com/q/25865844
type: Question
has title: Oracle JDBC driver auto formatting the date column
tagged with: date-formatting
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40475077
has comment: http://stackoverflow.com/comment/40475091
has answer: http://stackoverflow.com/a/26515803
tagged with: oracle-database
upvote count: 1
has body: I am facing a problem where even though dates are stored in Oracle Database in default date format i.e dd-Mon-yy (for example 28-MAR-11) ,the date columns are automatically formatted into yyyy-MM-dd (for example 2011-03-28) while connecting to Oracle database from java using Oracle JDBC driver.Looked into the documentation but could not find any setting change that would effect the default date format. I want to resolve this problem by making the configuration changes instead of formatting the dates in java.Please let me know if there is a solution. Note:I am using spring JDBC.
favorite count: 0
tagged with: spring-jdbc
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5683728
score: 1
tagged with: java

http://stackoverflow.com/a/25760278
score: 1
has comment: http://stackoverflow.com/comment/40321113
has comment: http://stackoverflow.com/comment/40284892
answers question: http://stackoverflow.com/q/25759985
upvote count: 1
has body: This code can helpy ou : Analyzer ana = new StandardAnalyzer(LUCENE_30, Collections.emptySet()); Note that, the answer is version-dependent. For Lucene 4.0, use: Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40, CharArraySet.EMPTY_SET); Edit : Constructs a StandardTokenizer filtered by a StandardFilter, a org.apache.lucene.analysis.LowerCaseFilter and a org.apache.lucene.analysis.StopFilter. @Override public TokenStream tokenStream(String fieldName, Reader reader) { StandardTokenizer tokenStream = new StandardTokenizer(matchVersion, reader); tokenStream.setMaxTokenLength(maxTokenLength); TokenStream result = new StandardFilter(tokenStream); result = new LowerCaseFilter(result); result = new StopFilter(enableStopPositionIncrements, result, stopSet); return result; } private static final class SavedStreams { StandardTokenizer tokenStream; TokenStream filteredTokenStream; }
type: Answer
has comment: http://stackoverflow.com/comment/40282907
has comment: http://stackoverflow.com/comment/40283137
downvote count: 0

http://stackoverflow.com/comment/40395644
score: 0
type: Comment
has text: @5gon12eder definitely, that would be even better. I was just trying to illustrate what the issue was without adding any additional assumptions on the class' structure.
comment on: http://stackoverflow.com/a/25822106
type: AnswerComment

http://stackoverflow.com/q/25745790
downvote count: 0
has comment: http://stackoverflow.com/comment/40324383
has comment: http://stackoverflow.com/comment/40269803
favorite count: 0
has comment: http://stackoverflow.com/comment/40258277
tagged with: redis
has answer: http://stackoverflow.com/a/25746479
type: UnansweredQuestion
score: 4
has comment: http://stackoverflow.com/comment/40262486
tagged with: java
type: Question
upvote count: 4
tagged with: database
has body: I am about to start a project where read and writes will be large and frequent, Thereby looking around I found that in-memory databases are made exactly for that purposes itself. Investigating a little more took me to redis. Redis seems pretty cool(Just started reading, alot to know about it though). But I have primarily seen only relational databases and think of data in term of tuples and relations (I think this I can learn with time). I have following questions right now: Can I use only redis to store my data ? Reason why I am asking is that every article I have seen use Redis/memcached as an intermediate layer for caching. Can I just rely on redis to persist my data through out ? Where to host/run redis database ? Since Redis is an in-memory database, its requirement of host will definitely be different than applications that require more processing. Hosts which have more RAM will definitely be better here. So where do people normally go on to host their database ? Elasticcaching from AWS, can this be used to host redis(as a primary database, not just caching layer) Any resources ? I always ask this, I found lots of good documents online, but nothing really good to start with. Please share any good resource if you are aware of.
tagged with: amazon-web-services
tagged with: amazon-elasticache
has title: Key-value store as primary database
has comment: http://stackoverflow.com/comment/63975491
answer count: 1

http://stackoverflow.com/comment/52938445
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/32540466
has text: Thanks, Eugene H. Well, I tried your code changing colors with random values. It works, as it could work without color definitions. Due to NoActionBar.

http://stackoverflow.com/q/25724290
tagged with: mocking
tagged with: mockito
has answer: http://stackoverflow.com/a/25724460
accepted answer: http://stackoverflow.com/a/25724460
type: AnsweredQuestion
has title: Mocking a method which takes temporary file as input
tagged with: unit-testing
type: Question
possible better answer: http://stackoverflow.com/a/25724427
tagged with: java
has answer: http://stackoverflow.com/a/25724427
has body: I have a code like below: public start() { .............. .............. ImpAbc abc = extract(ImplObj); ............... } public ImpAbc extract(Impl ImplObj) { ................ File BuildPath = File.createTempFile("xyz", ".zip"); ImpAbc abc = ImplObj.downloadImp(Integer.parseInt(rev.trim()), BuildPath, conn); ................. return abc; } I am testing the method start() which calls extract() method. I want to mock the method downloadImp(..) as it is a 3rd party API and internally calls many other method. But the problem is downloadImp(..) takes a temporary file as input, and when I use when().thenReturn() like below, it doesn't calls mocked method, as the temporary file has a unique name each time. What I tried is: Impl mockImplObj = mock(Impl.class); ImpAbc mockImpAbc = mock(ImpAbc.class); when(mockImplObj.downloadImp(Integer.parseInt(rev.trim()), File.createTempFile("xyz", ".zip"), mockconn).thenReturn(mockImpAbc); Can anyone help in resolving the problem?
score: 0
answer count: 2

http://stackoverflow.com/a/25774824
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40318793
has body: Try this @JoinColumn(referencedColumnName = "id", insertable = false, name = "parent") @ManyToOne(fetch = FetchType.LAZY) private Person parent; @Column(name = "parent") private Integer parentId; If that don't work: Try this if parentId is the primary key of the Parent entity: @JoinColumn(referencedColumnName = "id", insertable = false, name = "parent") @ManyToOne(fetch = FetchType.LAZY) private Person parent; @Id @GeneratedValue(strategy = GenerateType.AUTO) @Column(name = "parent") private Integer parentId; Try this: @JoinColumn(referencedColumnName = "id", name = "parent") @ManyToOne(fetch = FetchType.LAZY) private Person parent; @Column(name = "parent") private Integer parentId; If that don't work: Try this: @JoinColumn(name = "parent") @ManyToOne(fetch = FetchType.LAZY) private Person parent; @Column(name = "parent") private Integer parentId;
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25774309

http://stackoverflow.com/q/25823593
has comment: http://stackoverflow.com/comment/40398337
type: Question
tagged with: gwt
has title: Connect Sencha Touch with (GXT or GWT)
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/40398242
has body: I've built GXT app using MVC model, but i have to build mobile client using Sencha Touch, how could i benefit from GXT or GWT java code in the first project ? should i choose to have some sort of RESTFUL webservice like described here, or should i use Sencha io ? or write entirely dedicated server side for the mobile ? any recommandations or experiences in this subject are welcomed.
tagged with: sencha-touch
tagged with: extjs
type: UnansweredQuestion
answer count: 0
tagged with: gxt

http://stackoverflow.com/comment/40410157
comment on: http://stackoverflow.com/q/25829683
score: 0
has text: One more thing though, shouldnt be the clear() method inside for loop? why is it outside?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25809581
has title: How can I write a Spring MVC controller method with variable number of form fields and files?
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40373584
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40372194
type: Question
accepted answer: http://stackoverflow.com/a/25810853
has body: I am developing a Spring MVC 3.1 app (using controller annotations) and I've encountered an issue I'm not sure how to resolve. I have a page that, depending on data, builds a form for a user to POST back. The form can contain a variable number of fields, and any number of files. I haven't been able to find an example of how to write the controller method to handle this. Most of the examples I've seen use static forms, so the developer can write an object to bind to the form data. In my case, however, since the form length varies, I don't really have that option (I think). Is this even possible using Spring?
upvote count: 3
answer count: 2
has comment: http://stackoverflow.com/comment/40373531
has answer: http://stackoverflow.com/a/25810853
favorite count: 0
has comment: http://stackoverflow.com/comment/40373185
possible better answer: http://stackoverflow.com/a/25810408
has answer: http://stackoverflow.com/a/25810408
has comment: http://stackoverflow.com/comment/40373740

http://stackoverflow.com/comment/40267033
type: Comment
comment on: http://stackoverflow.com/a/25733784
has text: Thank your for your answer. I've tried with @JsonIgnore it worked, but I do need actions information, and with FetchType.EAGER I had too much information, that I don't need and I don't know where it comes from.
type: AnswerComment
score: 0

twilio
tag name: twilio
tags question: http://stackoverflow.com/q/25757418
type: Tag

char
tags question: http://stackoverflow.com/q/25805385
tags question: http://stackoverflow.com/q/25793216
tags question: http://stackoverflow.com/q/25861585
type: Tag
tags question: http://stackoverflow.com/q/25734200
tag name: char
tags question: http://stackoverflow.com/q/25826859
tags question: http://stackoverflow.com/q/25736365

http://stackoverflow.com/a/25825429
type: Answer
score: 0
has body: You're mixing up some things: You're not checking if a is true, but setting it. Use a single equals sign (=) for an assignment of a value to a variable, and a double equals operator (==) for a comparison. while (a = true) must be while (a == true) or just while (a) In the method EndLoop(boolean a), you're taking one parameter, but you don't do anything with the parameter. You're just returning false, leaving the a argument unused. You should write something like this: static boolean a = true; public static void main(String[] args) { while (a == true) { // Or "while (a)", which is the same System.out.print("."); a = endLoop(); // a will be false // and there will be no next iteration of the while loop, // because a is not true anymore } } public static boolean endLoop(/* We don't need arguments here */) { return false; } May I also do a few suggestions: You should start a method name with a lowercase letter, see the Java Naming Conventions. Calling a method endLoop() where you only return false is useless, you should use break in the while loop. If you want to extend the endLoop() method with some variable checking, you should rename endLoop.
answers question: http://stackoverflow.com/q/25825365

http://stackoverflow.com/comment/40411558
type: Comment
type: QuestionComment
has text: Alright. Many thanks for your concern.
score: 0
comment on: http://stackoverflow.com/q/25830388

http://stackoverflow.com/q/25774560
tagged with: mobile
has comment: http://stackoverflow.com/comment/64756312
tagged with: focus
tagged with: events
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: swt
score: 2
has comment: http://stackoverflow.com/comment/64841753
tagged with: java
has title: SWT Mouse Events - Desktop vs Mobile
type: Question
upvote count: 2
has body: How do the effects of Mouse Events differ between standard Windows Desktop application usage and Windows Tablet usage? We have created an application that creates a pop-up virtual keyboard when certain text fields gain focus. This virtual keyboard can then be clicked on to type into the text field without causing the text field to lose focus. This works correctly when using a mouse on a standard desktop PC. However, when running on a mobile device such as a Windows Tablet and using touch commands, the keyboard behaves differently, losing focus. We have been under the impression that mobile touch commands largely simulated mouse click events, although that does not seem to be the case here. Why do these two input methods work differently? How can we make our keyboard work identically on both types of platforms? A small test program follows: import org.eclipse.swt.SWT; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlListener; import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class KeyboardEventTest { private Kbd kbd = null; protected Shell shell; private Label lblNoEvent; private Text txtNoEvent; private Label lblYesEvent; private Text txtYesEvent; private ControlListener _parentCont…

http://stackoverflow.com/a/25779311
answers question: http://stackoverflow.com/q/25779212
upvote count: 3
score: 3
has body: This is simply printing prime numbers between 2 -99. From the for loop it iterates numbers between 2 - 99. Inside for loop it checks whether particular number(i) is divisible by m without any remaining. If there are remaining increase the value of m by one until m &lt; i and iterate the process. If there is no remaining then it is a prime number, then make band to true and print the output. Since band is true now it will exit the while loop and go to next iteration of for loop.
downvote count: 0
type: Answer

http://stackoverflow.com/q/25810797
favorite count: 0
has comment: http://stackoverflow.com/comment/40384637
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40375558
upvote count: 1
has comment: http://stackoverflow.com/comment/40375329
has comment: http://stackoverflow.com/comment/40375745
downvote count: 1
has comment: http://stackoverflow.com/comment/40383573
has body: I have to restrict some field which are there in processtemplate class. Below is the method which i have developed. When i pass some id it gives me runtime exception. Please help me out public ProcessTemplate get(String id) throws GRIDRecordsDataManagerException { ProcessTemplate entity = null; try { BasicDBObject qry = new BasicDBObject(); Map&lt;String, Object&gt; whereMap = new HashMap&lt;String, Object&gt;(); whereMap.put("id", id); qry.putAll(whereMap); BasicDBObject field = new BasicDBObject(); field.put("name", 1); field.put("status", 1); field.put("description", 1); DBCursor results = dbCollection.find(qry, field); if (results != null &amp;&amp; results.hasNext()) { DBObject dbObj = results.next(); entity = new ProcessTemplate(); entity.setId((String) dbObj.get("id")); entity.setProcessName((String) dbObj.get("name")); entity.setStatus((String) dbObj.get("status")); entity.setDescription((String) dbObj.get("description")); System.out.println(entity); } } catch (Exception e) { } return entity; }
tagged with: java
has comment: http://stackoverflow.com/comment/40375223
has title: How to restrict the field in Mongodb
type: Question
tagged with: mongodb
score: 0
has comment: http://stackoverflow.com/comment/40375584
has comment: http://stackoverflow.com/comment/40374809
has answer: http://stackoverflow.com/a/25811988
answer count: 1

http://stackoverflow.com/q/25859418
type: Question
tagged with: bytecode
tagged with: java
answer count: 2
has body: I want to redefine the bytecode of the StackOverflowError constructor so I have a "hook" for when a stack overflow occurs. All I want to do is insert a single method call to a static method of my choosing at the start of the constructor. Is it possible to do this?
tagged with: instrumentation
downvote count: 0
possible better answer: http://stackoverflow.com/a/25865397
tagged with: stack-overflow
tagged with: jvm
favorite count: 0
has answer: http://stackoverflow.com/a/25865397
has answer: http://stackoverflow.com/a/25859673
score: 3
has comment: http://stackoverflow.com/comment/40463891
type: AnsweredQuestion
has title: Is it possible to redefine core JDK classes using instrumentation?
upvote count: 3
has comment: http://stackoverflow.com/comment/40463925
accepted answer: http://stackoverflow.com/a/25859673

http://stackoverflow.com/comment/40904324
type: AnswerComment
comment on: http://stackoverflow.com/a/25855603
type: Comment
score: 1
has text: Is there any other way to fix this stackoverflow error?

http://stackoverflow.com/q/25777287
linked to: http://stackoverflow.com/q/118463
has body: I want to encrypt data between a Java Server backend and a GWT Client. On the GWT client I use the sbn.js library. It works very fast and is much faster that gwt-crypto. Here is How I encrypt on the client side given (e,n) of RSA. I created a JSFiddle: var n = "BC86E3DC782C446EE756B874ACECF2A115E613021EAF1ED5EF295BEC2BED899D26FE2EC896BF9DE84FE381AF67A7B7CBB48D85235E72AB595ABF8FE840D5F8DB"; var e = "3"; var d = "7daf4292fac82d9f44e47af87348a1c0b9440cac1474bf394a1b929d729e5bbcf402f29a9300e11b478c091f7e5dacd3f8edae2effe3164d7e0eeada87ee817b"; function do_encrypt() { var before = new Date(); var rsa = new RSAKey(); rsa.setPublic(n, e); var res = rsa.encrypt($("#plaintext").val()); $("#ciphertext").val(res); $("#cipherb64").val(hex2b64(res)); console.log("res"); } $("#encrypt").click(function () { do_encrypt(); }); I use the hex representation of the encrypted plaintext to be decrypted on the server. Here is how I decrypt on the server. I use the following libs: compile 'org.bouncycastle:bcprov-jdk15on:1.51' compile 'org.bouncycastle:bcprov-ext-jdk15on:1.51' Here is how I decrypt on the server using (d,n) of RSA: try { BigInteger modulus = new BigInteger("BC86E3DC782C446EE756B874ACECF2A115E613021EAF1ED5EF295BEC2BED899D26FE2EC896BF9DE84FE381AF67A7B7CBB48D85235E72AB595ABF8FE840D5F8DB",16); BigInteger exponent = new BigInteger("3"); RSAKeyParameters publicKey = new RSAKeyParameters(false, modulus, exponent) BigInteger exponent2 = new BigInteger("7daf4292fac82d9f44e47af87348a1c0b9440cac1474bf394a1b929d729e5bbcf402f29a9300e11b478c091f7e5dacd3f8edae2effe3164d7e0eeada87ee817b", 16); RSAKeyParameters privateKey = new RSAKeyParameters(true, modulus, exponent2) String encryptedData = "a7f7d5c77c246729141cdfcc77f1f7b38d5f8066b0bc53b2e85119f3f1784f43be2140b5c382ad483bb57cc1b586962cbb1e831e6070a27e4880bbc549e20a372571d09c6b1269ddd7288916f10c96a9138f4165569c4767bfb489de2d44b450ed1495c99da985dc264dabadd9709ccd950ae55095373ccbc3344a26b3efd2dc"; ////// decrypt AsymmetricBlockCipher d = n…
type: Question
linked to: http://stackoverflow.com/q/1199058
tagged with: gwt
score: 3
tagged with: javascript
has comment: http://stackoverflow.com/comment/40329683
has answer: http://stackoverflow.com/a/25953053
has title: How Do I use RSA between Server and GWT Client?
has comment: http://stackoverflow.com/comment/40631614
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/7166275
type: UnansweredQuestion
tagged with: encryption
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/40315553
upvote count: 3
tagged with: java

http://stackoverflow.com/a/25818994
has comment: http://stackoverflow.com/comment/40391274
score: 1
type: AcceptedAnswer
downvote count: 0
has body: I suggest you split the logic into two methods, first countGoats(Animal[]) - private static int countGoats(Animal[] animals) { int count = 0; for (Animal a : animals) { if (Animal.goat == a) { count++; } } return count; } Since every element up to the goats count should be a goat in the array (and every element after a sheep) we can then iterate the array with something like, public static void reorder(Animal[] animals) { if (animals == null) { return; } int goats = countGoats(animals); for (int i = 0; i &lt; animals.length; i++) { // if (i &lt; goats) - it's a goat, otherwise it's a sheep. animals[i] = (i &lt; goats) ? Animal.goat : Animal.sheep; } } This is an example of a Counting sort and has a run-time complexity of O(n). As the Wikipedia article notes, Because counting sort uses key values as indexes into an array, it is not a comparison sort, and the Ω(n log n) lower bound for comparison sorting does not apply to it.
type: Answer
accepted answer of: http://stackoverflow.com/q/25818720
upvote count: 1
answers question: http://stackoverflow.com/q/25818720

http://stackoverflow.com/comment/40356326
has text: @ElliottFrisch it is meant to be a pool. do you know of any pools for android that act like caches?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25800342

http://stackoverflow.com/comment/40478313
comment on: http://stackoverflow.com/a/25867405
has text: Tried Scanner sc = new Scanner(System.in,"utf-8");, still the same output. I'll read your link and see what they say. Thanks!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40313031
has text: im only allowed to use the indexOf() method and the subString() method I cant use anything else :/
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25776665

http://stackoverflow.com/q/25763570
has title: Jpa Transaction for update is throwing exception for the 2nd update
score: 0
has answer: http://stackoverflow.com/a/25764612
has body: I am updating the row in the database using spring Propagation.REQUIRED, it is updating fine first time, but throwing exception second time. 03:44:58,206 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/wad].[springMain]] (http--127.0.0.1-8080-1) Servlet.service() for servle t springMain threw exception: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect ): [com.guthyrenker.wad.core.model.lookup.PublisherLookupItem#4025] at org.hibernate.event.internal.DefaultMergeEventListener.entityIsDetached(DefaultMergeEventListener.java:492) [hibernate-core-4.0.1.Final.jar:4.0.1.Fin al] Code: @RequestMapping(value = "/admin/updatePublisher.htm", method = RequestMethod.POST, produces = "application/json") public @ResponseBody JsonDataWrapper&lt;PublisherLookupItem&gt; updatePublisher(@RequestBody("PublisherLookupItem") publisherLookupItem, HttpServletRequest request) throws Exception { wadRepository.updatePublisher(publisherLookupItem); JsonDataWrapper&lt;PublisherLookupItem&gt; result = new JsonDataWrapper&lt;PublisherLookupItem&gt;(publishertList); return result; } package com.wad.service public interface WadRepository { @Transactional(propagation = Propagation.REQUIRED) public PublisherLookupItem updatePublisher(PublisherLookupItem publisherLookupItem); } package com.wad.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.wad.core.dao.WadDAO; import com.wad.core.model.lookup.PublisherLookupItem; import com.wad.core.service.ServiceException; import com.wad.core.service.WadRepository; @Repository public class WadRepositoryImpl implements WadRepository { @Autowired private WadDAO wadDAO; @Override public PublisherLookupItem updatePublisher(PublisherLookupItem publisherLookupItem) { return wadDAO.savePublishers(publisherLookupItem); } } @Repository public class WadDAO { public PublisherLooku…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40288612
tagged with: spring
has comment: http://stackoverflow.com/comment/40288540
tagged with: java
tagged with: hibernate
type: Question
tagged with: jpa
answer count: 1

http://stackoverflow.com/comment/40287407
type: AnswerComment
has text: In that case I think the issue is with the ${ADMIN_HOME} which is not known to spring when running a test. Maybe try to launch the test with additional -DADMIN_HOME=<path>
type: Comment
comment on: http://stackoverflow.com/a/25760747
score: 0

http://stackoverflow.com/comment/40300670
type: Comment
type: QuestionComment
has text: There are easily a dozen different version of Java, produced by different vendors. IBM has 2 or 3, Android has one, several other vendors have them. Oracle itself ships several.
score: 0
comment on: http://stackoverflow.com/q/25769178

http://stackoverflow.com/a/25862357
upvote count: 229
answers question: http://stackoverflow.com/q/25855795
downvote count: 2
has body: UPDATE: As the behaviour of spring.config.location now overrides the default instead of adding to it. You need to use spring.config.additional-location to keep the defaults. This is a change in behaviour from 1.x to 2.x When using Spring Boot the properties are loaded in the following order (see Externalized Configuration in the Spring Boot reference guide). Command line arguments. Java System properties (System.getProperties()). OS environment variables. JNDI attributes from java:comp/env A RandomValuePropertySource that only has properties in random.*. Application properties outside of your packaged jar (application.properties including YAML and profile variants). Application properties packaged inside your jar (application.properties including YAML and profile variants). @PropertySource annotations on your @Configuration classes. Default properties (specified using SpringApplication.setDefaultProperties). When resolving properties (i.e. @Value(&quot;${myprop}&quot;) resolving is done in the reverse order (so starting with 9). To add different files you can use the spring.config.location properties which takes a comma separated list of property files or file location (directories). -Dspring.config.location=your/config/dir/ The one above will add a directory which will be consulted for application.properties files. -Dspring.config.location=classpath:job1.properties,classpath:job2.properties This will add the 2 properties file to the files that are loaded. The default configuration files and locations are loaded before the additonally specified spring.config.location ones meaning that the latter will always override properties set in the earlier ones. (See also this section of the Spring Boot Reference Guide). If spring.config.location contains directories (as opposed to files) they should end in / (and will be appended with the names generated from spring.config.name before being loaded). The default search path classpath:,classpath:/config,file:,file:config/ is al…
has comment: http://stackoverflow.com/comment/40536083
has comment: http://stackoverflow.com/comment/85046347
score: 227
has comment: http://stackoverflow.com/comment/74821208
has comment: http://stackoverflow.com/comment/124487470
has comment: http://stackoverflow.com/comment/40506788
has comment: http://stackoverflow.com/comment/40493721
has comment: http://stackoverflow.com/comment/40546520
has comment: http://stackoverflow.com/comment/86903861
type: Answer
has comment: http://stackoverflow.com/comment/113625215

http://stackoverflow.com/comment/40260144
comment on: http://stackoverflow.com/a/25747549
score: 0
type: AnswerComment
has text: statcktrace: java.lang.NoClassDefFoundError: org/apache/maven/shared/filtering/MavenFilteringException at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) --- The only thing in my POM so far is the junit dependency and now the compiler plugin. My runtime is set to jdk-1.7 and I've added tools.jar as an extra library. I've not had this issue in Kepler
type: Comment

http://stackoverflow.com/q/25852380
has answer: http://stackoverflow.com/a/25973547
score: 0
has body: I've REST-based service on resygwt with API like this: @Path("/search") @GET List&lt;User&gt; search(@QueryParam("login") String loginMask) throws RemoteException; And I receive "malformed URI sequence" for this request: http://devsys23:8080/rest/search?login=%25spa%20ce%25 This is rather strange, since in JavaDoc mentioned, that such requests should be supported by default: Binds the value(s) of a HTTP query parameter to a resource method parameter, resource class field, or resource class bean property. Values are URL decoded unless this is disabled using the {@link Encoded} annotation. A default value can be specified using the {@link DefaultValue} annotation. I've try to edit tomcat connector in server.xml with useBodyEncodingForURI and URIEncoding="UTF-8". Also org.springframework.web.filter.CharacterEncodingFilter was included and forceEncoding set, but it still doesn't work =( What should I do to specify that login param should be decoded? Thank you for your advice if any.
answer count: 1
tagged with: resty-gwt
tagged with: encode
type: UnansweredQuestion
has title: Restygwt: malformed URI sequence
has comment: http://stackoverflow.com/comment/40668486
tagged with: java
type: Question

http://stackoverflow.com/comment/40201379
has text: I wish there's was an autoclose option on SO for all questions containing "html" and "regex"
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25716422
score: 1

http://stackoverflow.com/a/25810895
downvote count: 1
has body: Anyway, by convention, class names should always start with an upper case. This convention helps avoiding the problem you're describing.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25810791
has comment: http://stackoverflow.com/comment/40374382
upvote count: 1

http://stackoverflow.com/comment/40340743
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25791829
type: QuestionComment
has text: Do you want your bullets to go to an exact location at a conatant speed? If so I have the code for you, I can post it as an answer if you want

http://stackoverflow.com/q/25815381
score: 2
has answer: http://stackoverflow.com/a/36701496
has answer: http://stackoverflow.com/a/28324973
downvote count: 0
tagged with: java
type: Question
has title: Does OpenNLP have a stemmer?
has answer: http://stackoverflow.com/a/26695757
upvote count: 2
answer count: 3
favorite count: 0
type: UnansweredQuestion
has body: I'm working on a project and I'm using some features from OpenNLP. One feature I need is stemmer. I googled a bit and found that supposedly it has a Porter stemmer in a opennlp.tools.stemmer package, however the only thing my IDE (IntelliJ IDEA 13.1) finds is Stemmer interface. I'm using OpenNLP 1.5.3. Am I looking in a wrong place or OpenNLP doesn't have a stemmer implementation?
tagged with: opennlp

http://stackoverflow.com/comment/42985952
comment on: http://stackoverflow.com/q/25746472
type: Comment
has text: where can I get updated secret?
type: QuestionComment
score: 0

http://stackoverflow.com/a/25830855
answers question: http://stackoverflow.com/q/25830800
has body: Bitwise operators are used for bit manipulation, i.e. in cases when you want to go down to "gory details" of data structures that in the end of the day are sequences of bytes. There are a lot of tutorials that explain various usages of bitwise operators, however I will give you only one that (IMHO) is the most useful (at least for me). Sometimes you want to handle a lot of boolean flags. You can create Map&lt;String, Boolean&gt; and (for example) pass instance of such map to some method (let's call it foo()), i.e.: Map&lt;String, Boolean&gt; options = new HashMap&lt;&gt;(); // fill the map foo(options); Obviously we can use enum and EnumMap instead of string keys. Alternatively we can define a series of constants like: public static final int ONE = 1; public static final int TWO = 2; public static final int THREE = 4; public static final int FOUR = 8; etc. etc. Now we can change foo() to get int parameter and call it as following: foo(ONE | TWO); foo(ONE | FOUR); etc. In some cases this notation is more readable; in most cases it saves memory and gives some performance benefits. Please note that already mentioned EnumMap is implemented using this technique, so you can just use it in most cases and enjoy both efficiency and OOD.
score: 0
type: Answer

http://stackoverflow.com/a/25806457
score: 1
answers question: http://stackoverflow.com/q/25806366
downvote count: 0
type: Answer
upvote count: 1
has body: AFAIK the inverse is possible. You use Functions.forMap() and give it a Map which this call turns into a Function that can work as a mapping table. I'm not sure you can do that with Guava.

http://stackoverflow.com/comment/40199829
comment on: http://stackoverflow.com/q/25715535
has text: you should use j or other variable name for your inner loop index
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25782163
answers question: http://stackoverflow.com/q/25782057
type: Answer
accepted answer of: http://stackoverflow.com/q/25782057
has comment: http://stackoverflow.com/comment/114225178
has body: You can do this, but you should not do so in most cases. The key to a map needs to be constant and its equals and hashcode need to be set up to give the correct behavior. If you modify a key after adding it into the map then you invalidate the map. A HashMap can be modified so should not be used as a key. To explain why changing it is a problem you need to know how hashmaps work. This is very simplified but lets say you have a HashMap H containing two buckets. Lets call them B0 and B1. Whenever you add an Object to the HashMap it looks at that objects hashCode. If the final bit is 0 then it goes in B0, if it is 1 then it goes in B1. Now when looking up an object it looks at the hashCode and immediately goes to the right bucket, it then only needs to search the objects in that bucket to find the object it needs. By using more buckets than just 2 you can reduce the number of items in each bucket by 2, 4, 8 or more times and hence reduce the number of objects you need to check. However lets say you put an object in the map and it gets added to B0. You then change the object and the hashCode changes so the last bit is now 1. if you do map.contains(obj) you will get the result false because it will look at the hashCode, jump straight to B1 and only scan that for the object. But the object was placed in B0 because that is what the hashCode had at the time it was inserted. This is why the hashCode must be constant for any object being used as a key in a HashMap, as otherwise you can "lose" these keys.
score: 9
has comment: http://stackoverflow.com/comment/125986635
has comment: http://stackoverflow.com/comment/40324100
upvote count: 9
has comment: http://stackoverflow.com/comment/114207124
has comment: http://stackoverflow.com/comment/133502562
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40225646
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25729518
has text: Have you tried sticky sessions? Do you use jvmRoute in your tomcat engine configuration?
score: 0

http://stackoverflow.com/comment/40228259
type: QuestionComment
comment on: http://stackoverflow.com/q/25730843
has text: Do you have a class called `AnyType` somewhere or do you want the type to be anything?
score: 0
type: Comment

http://stackoverflow.com/q/25778994
upvote count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25779089
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40316998
has comment: http://stackoverflow.com/comment/40317088
has answer: http://stackoverflow.com/a/25779091
answer count: 2
has title: Incorrect text displayed on reading a text file
has body: I am writing a program to read a text file. When I am printing the read values, the values are displayed incorrectly. Text file contains following data This is line one This is line two This is line three This is line four Code to read text file is as follows: import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class SearchFile { public static void main(String[] args) { BufferedReader br = null; try { String sCurrentLine; br = new BufferedReader(new FileReader("C:\\test.txt")); while ((sCurrentLine = br.readLine()) != null) { System.out.println(sCurrentLine); } } catch (IOException e) { e.printStackTrace(); } finally { try { if (br != null)br.close(); } catch (IOException ex) { ex.printStackTrace(); } } } } Output is as follows: Please help to fix this issue. Why am I getting the output displayed as garbage characters.
has comment: http://stackoverflow.com/comment/40316996
has comment: http://stackoverflow.com/comment/40317014
favorite count: 0
tagged with: text-files
has comment: http://stackoverflow.com/comment/40317126
type: UnansweredQuestion

http://stackoverflow.com/comment/40320617
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25781087
type: AnswerComment
has text: No, you don't add objects, you add references to the list.

http://stackoverflow.com/q/25751044
tagged with: java
tagged with: naming
upvote count: 5
downvote count: 0
has answer: http://stackoverflow.com/a/25751130
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25751130
has body: Today I was naming a package in a project which would contain code related to a concept called an "access structure". Now, naming this package "com.myemployer.project.component.accessstructures" seems unappealing and difficult to read because of the triple "S". (The higher level packages are not actually named "project" and "component"). I was tempted to use "...component.access_structures" I couldn't find anything mentioned in the Java conventions on Oracle's site . And a brief web search brought up nothing. What is the official convention for names like this?
favorite count: 0
has comment: http://stackoverflow.com/comment/40265700
type: Question
has answer: http://stackoverflow.com/a/25751431
tagged with: package
answer count: 3
score: 5
has answer: http://stackoverflow.com/a/25751302
tagged with: conventions
has title: Java package naming. Underscores: A special case
accepted answer: http://stackoverflow.com/a/25751302

http://stackoverflow.com/a/25827986
score: 4
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25827804
has body: I hope it is obvious that you will need at least N/2 memory allocation (Unless you can re-iterate through your steam, reading the same data again) . Your algorithm uses M/2, given the fact that N is upper bounded by M would make it look like it doesn't matter which you will choose, since N can go up to M. But it doesn't have to. If you consider N being way smaller than M (for example N=5 and M=1 000 000) then you would waste a lot of resources. I would recommend some dynamic growth array structure, something like ArrayList, but that is not good for removing first element. Conclusion: You can have O(N) both time and memory complexity, and you can't get any better. Friendly edit regarding ArrayList: adding an element to an ArrayList is in "amortized constant time", so adding N items is O(N) in time. Removing them, however, is linear (per JavaDoc) so you can definitely get O(N) in time and space but ONLY IF you don't remove anything. If you do remove, you get O(N) in space (O(N/2) = O(N)), but your time complexity goes up.
has comment: http://stackoverflow.com/comment/51432104
downvote count: 0
has comment: http://stackoverflow.com/comment/51433041

http://stackoverflow.com/q/25717366
type: Question
has comment: http://stackoverflow.com/comment/40203117
has body: I have one condition where, the condition passes, I'll show a JDialog. If it fails, I just need to show a JOption pane and dispose the JDialog. EX. I have to show the dialog on a button click, import javax.swing.JDialog; import javax.swing.JLabel; public class MyDialog extends JDialog { public MyDialog(String name){ JLabel welcomeLable = new JLabel("Hi welcome"); add(welcomeLable); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setSize(100, 100); if(name.equals("pass")){ //Do nothing }else{ dispose(); } } public static void main(String[] d){ MyDialog dialog = new MyDialog("fail"); dialog.setModal(true); dialog.show(); } } The message box is shown with validation message but still the dialog is being displayed. How to solve this. How to solve this.
has title: Dispose JDialog in constructor
score: 0
has answer: http://stackoverflow.com/a/25717622
has comment: http://stackoverflow.com/comment/40202993
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25719279
answer count: 4
has answer: http://stackoverflow.com/a/47335765
tagged with: java
tagged with: swing
has answer: http://stackoverflow.com/a/25717802

http://stackoverflow.com/q/25772481
tagged with: pass-by-reference
has comment: http://stackoverflow.com/comment/40304826
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25772519
linked to: http://stackoverflow.com/q/40480
has comment: http://stackoverflow.com/comment/40304816
type: Question
duplicate of: http://stackoverflow.com/q/40480
possible better answer: http://stackoverflow.com/a/25772525
has body: In the code below why foo2 is null when printing its data at system.out.print? public class Helper { public void shadowCopy(Foo foo1, Foo foo2){ foo2 = foo1; } public static void main(String[] args) { Helper h = new Helper(); Foo foo1 = new Foo(50); Foo foo2= null; h.shadowCopy(foo1, foo2); System.out.println(foo2.data);// why java.lang.NullPointerException? } public static class Foo { public int data=0; public Foo(int data){ this.data = data; } } }
has answer: http://stackoverflow.com/a/25772525
has title: How does this fit in the "pass by value of refrences" in java?
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25772519
has comment: http://stackoverflow.com/comment/40304839
tagged with: pass-by-value

http://stackoverflow.com/comment/40375553
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25811316
has text: What do you mean? I do not want to have an Objects type, only primitive or at least Integer, but NOT the java.math.BigDecimal
score: 0

http://stackoverflow.com/q/25842777
accepted answer: http://stackoverflow.com/a/25843061
tagged with: java
score: 4
has comment: http://stackoverflow.com/comment/40433974
has answer: http://stackoverflow.com/a/25843061
answer count: 1
has body: I've run into a really weird case - I have the following code: new String(data, position, len, Charset.forName("windows-1255")); where data is a byte[], and position and len are ints. When I run it on jdk 1.6.0_38, it runs really slow (for a set iteration 411 seconds), and when I run this: new String(data, position, len); it runs the same iteration in less than 1 sec. Some more data: When I debug it, upon entering the Constructor (with the Charset) it throws a JVM ACCESS_VIOLATION_EXCEPTION and dies. When I run it on jdk 1.7.0_10 it runs fine (less than 1 sec) can anyone explain this weird behavior?
tagged with: string
favorite count: 0
tagged with: java-6
upvote count: 4
type: AnsweredQuestion
downvote count: 0
has title: JVM ACCESS_VIOLATION_EXCEPTION when constructing String from array on obsolete JVM
type: Question

http://stackoverflow.com/q/25817830
has title: What causes java to treat this two object types of ArrayLists and Integers differently?
accepted answer: http://stackoverflow.com/a/25817893
score: 0
has comment: http://stackoverflow.com/comment/40388330
answer count: 4
has comment: http://stackoverflow.com/comment/40388322
has comment: http://stackoverflow.com/comment/40388271
has answer: http://stackoverflow.com/a/25817923
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25817893
tagged with: java
has body: Both ArrayList and Integer are object data type, but why the code below treats the two differently? ar,br,a and b are all objects. Changing ar changes br, but changing a did not change b why? Isn't it both ArrayLists and Integers are objects? assignign an object to another object by using = statement simply does the shallow copy FOR BOTH? or no? import java.util.ArrayList; import java.util.Arrays; public class MyClass { public static void main(String[] args) { ArrayList &lt;Integer&gt; ar = new ArrayList&lt;&gt;(Arrays.asList(1,2,3)); ArrayList&lt;Integer&gt; br = ar; System.out.println(Arrays.toString(br.toArray()));// [1,2,3] ar.remove(0);// lets change ar // now lets see if br changed too System.out.println(Arrays.toString(br.toArray()));// [2,3] (yes did) Integer a= new Integer (5); Integer b = a; a = a+1;// lets change a and see if b changed too System.out.println(b);// b is still 5 //So changing ar changed br too, but changing a did not change b why? Ist it both br and b are objects? } }
linked to: http://stackoverflow.com/q/3131136
has comment: http://stackoverflow.com/comment/40388227
has comment: http://stackoverflow.com/comment/40388283
type: Question
has answer: http://stackoverflow.com/a/25817849
possible better answer: http://stackoverflow.com/a/25817915
has comment: http://stackoverflow.com/comment/40388310
has answer: http://stackoverflow.com/a/25817915

http://stackoverflow.com/q/25763935
type: Question
has title: how to check phone number format is valid or not from telephony manager?
accepted answer: http://stackoverflow.com/a/25765658
has body: For checking the phone number(I have the pattern phone number like +918172014908) validation I use libphonenumber.jar file.. It checks the phone number according to the country is valid or not. I use this:-- PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); PhoneNumber numberProto = phoneUtil.parse("phone_number", ""); phoneUtil.isValidNumber(numberProto) == true ? "valid" : "phone no not valid" Its working fine..But this jar file takes a bit of memory.. Is there another way for checking the phone number format validation without libphonenumber.jar??? can you suggests something???
has answer: http://stackoverflow.com/a/25764033
linked to: http://stackoverflow.com/q/5958665
tagged with: validation
possible better answer: http://stackoverflow.com/a/25764033
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/25765658
has answer: http://stackoverflow.com/a/25763983
tagged with: android
score: 6
has answer: http://stackoverflow.com/a/25764552
has answer: http://stackoverflow.com/a/62043951
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/8634139
has comment: http://stackoverflow.com/comment/40288846
upvote count: 7
downvote count: 1

http://stackoverflow.com/comment/40366448
type: Comment
score: 0
has text: This is a property set:`mobjSomeObject.setSomeProp(...)` The try/catch only assures the property'll have a number as a value. At the catch part you can set to 0 or send a message to the user or whatever... Why is it not good?
type: AnswerComment
comment on: http://stackoverflow.com/a/25806260

http://stackoverflow.com/q/25863034
tagged with: appium
downvote count: 0
type: UnansweredQuestion
favorite count: 0
type: Question
score: 3
has title: A new session could not be created. error in code for appium
has body: A new session could not be created. (Original error: Requested a new session but one was in progress) this error is show if I run my code second time . Works fine for the first time Writing a code for selenium public static void main(String[] args) throws MalformedURLException{ DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("appium-version", "1.0"); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("platformVersion", "4.4"); capabilities.setCapability("deviceName", "AndroidTest"); System.out.println("iii"); capabilities.setCapability("app", "/Users/gurpreet/Desktop/nimbuzz-3.2.0-rc4-debug.apk"); System.out.println("iii"); WebDriver driver = new RemoteWebDriver(new URL("http://0.0.0.0:4723/wd/hub"), capabilities); driver.findElement(By.id("com.nimbuzz:id/btnSignInSplash")).click(); } } Can anyone suggest a solution to this /
has comment: http://stackoverflow.com/comment/44794600
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/33124985
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25864381
has comment: http://stackoverflow.com/comment/40470259
has answer: http://stackoverflow.com/a/25910176
has answer: http://stackoverflow.com/a/28658543
has comment: http://stackoverflow.com/comment/40474931
answer count: 4

http://stackoverflow.com/comment/40514905
type: AnswerComment
has text: No, I want b.from being within from+toDate, as well as b.to being within from+toDate.
type: Comment
comment on: http://stackoverflow.com/a/25885304
score: 0

http://stackoverflow.com/comment/40446953
has text: After doing source ~/.bashrc i am getting /usr/lib/jvm/java-7-oracle as echo $JAVA_HOME. i restarted Intellij but still getting same error
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25849428
score: 0

http://stackoverflow.com/comment/40280158
comment on: http://stackoverflow.com/a/25758486
type: AnswerComment
score: 0
has text: It may be, will you find "org.springframework.web.servlet.DispatcherServlet" class in your build path?
type: Comment

http://stackoverflow.com/q/25761607
answer count: 1
has comment: http://stackoverflow.com/comment/40324755
tagged with: chromium-embedded
tagged with: chromium
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21192279
has comment: http://stackoverflow.com/comment/40324359
has answer: http://stackoverflow.com/a/25784131
tagged with: java
has body: I m new to this framework. I m facing problem in setting up development environment for CEF in eclipse. I want to embed chromium in Java application. I have searched a lot, but there is no proper tutorial or steps which shows how to do it. Can anyone please guide me through this? or at-least provide me with reliable guide, docs. on how to? I m not able to setup/build using eclipse.
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40315964
type: Question
accepted answer: http://stackoverflow.com/a/25784131
has comment: http://stackoverflow.com/comment/40324039
score: 0
has title: Setting up CEF development in Eclipse for Java?

http://stackoverflow.com/comment/40350415
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25797150
has text: Last I heard, java had neither method swizzling or category extensions. For the benefit of the uninitiated, swizzling is allows you to change the implementation of specific methods at run time, usually on system level objects. Category's allow you to extend the functionality of any class (not subclassing) by adding methods and/or properties at compile time.
type: Comment

smtp
tags question: http://stackoverflow.com/q/25719825
tags question: http://stackoverflow.com/q/25848618
tag name: smtp
type: Tag

http://stackoverflow.com/comment/40405177
comment on: http://stackoverflow.com/q/25827420
score: 0
type: Comment
type: QuestionComment
has text: I would use a clone, it seems to be the simplest way.

http://stackoverflow.com/comment/40334868
has text: See also [Making a robust, resizable Chess GUI](http://stackoverflow.com/q/21142686/418556).
comment on: http://stackoverflow.com/q/25789047
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/q/25776131
downvote count: 1
tagged with: input
answer count: 4
has answer: http://stackoverflow.com/a/25776168
upvote count: 0
has answer: http://stackoverflow.com/a/25776383
type: AnsweredQuestion
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/25776241
has title: Preventing input errors
type: Question
tagged with: try-catch
possible better answer: http://stackoverflow.com/a/25776168
has answer: http://stackoverflow.com/a/25776241
has answer: http://stackoverflow.com/a/25776360
favorite count: 0
has body: I made this java code to input a number: public static void main(String[] args) { int temp; do{ Scanner scan = new Scanner(in); out.print("enter number "); temp = scan.nextInt(); if(temp &gt;= 5 &amp;&amp; temp &lt;= 40){ int x = (temp-1)*2 +1; int y = x/2; int z = 1; for(int i=0; i&lt;temp-1; i++) { for(int j=0; j&lt;=y; j++) { out.print(" "); } for(int k = 0; k&lt;z; k++) { out.print("|"); } out.println(); y--; z+=2; } for(int c = 0; c &lt; 1 + temp/10; c++) { for (int i = 0; i &lt;= x / 2; i++) { System.out.print(" "); } System.out.println("|"); } }else{ out.print("enter a number between 5 and 40"); } }while(temp != 0); } } However, this will return an error if I enter for example a letter or an invalid character. I would like to know how to, instead of making the program crash, make it display an error message and then asking again the question until the entry is correct?
tagged with: exception

http://stackoverflow.com/comment/40233871
score: 0
type: Comment
has text: I wrote this answer. It relies partly on the *Liskov substitution principle* -- if C extends B, it must be possible to replace B instances with C instances, and C must therefore satisfy the contracts of B.
type: AnswerComment
comment on: http://stackoverflow.com/a/25733046

http://stackoverflow.com/a/25809904
has comment: http://stackoverflow.com/comment/40380382
downvote count: 0
has comment: http://stackoverflow.com/comment/85493416
has body: The interpolator really isn't doing anything for you here (it just defines a mapping between the actual time and the parameter used to compute the values of the properties that are changing). To implement a fade in/out you need to actually manipulate theopacityProperty of the imageView in the Timeline. Try something like KeyFrame keyFrame1On = new KeyFrame(Duration.seconds(0), new KeyValue(imageView.imageProperty(), image1)); KeyFrame startFadeOut = new KeyFrame(Duration.seconds(0.2), new KeyValue(imageView.opacityProperty(), 1.0)); KeyFrame endFadeOut = new KeyFrame(Duration.seconds(0.5), new KeyValue(imageView.opacityProperty(), 0.0)); KeyFrame keyFrame2On = new KeyFrame(Duration.seconds(0.5), new KeyValue(imageView.imageProperty(), image2)); KeyFrame endFadeIn = new KeyFrame(Duration.seconds(0.8), new KeyValue(imageView.opacityProperty(), 1.0)); Timeline timelineOn = new Timeline(keyFrame1On, startFadeOut, endFadeOut, keyFrame2On, endFadeIn);
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/40381006
has comment: http://stackoverflow.com/comment/85493695
has comment: http://stackoverflow.com/comment/85493631
has comment: http://stackoverflow.com/comment/85493791
upvote count: 5
answers question: http://stackoverflow.com/q/25809412
has comment: http://stackoverflow.com/comment/85493132

http://stackoverflow.com/comment/40308149
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25774173
has text: We can't reproduce this without knowing `line`. Please show a short but *complete* program demonstrating the problem - and explain what you expected to see vs what you actually saw.

http://stackoverflow.com/comment/40240919
score: 0
type: Comment
has text: I agree with the misguiding usage of "unused", which is removed now. But I still believe that more in-memory objects will keep the GC busy if the heap size is not big enough for those objects. As there is no code provided, so we cannot determine the scope/lifetime of those objects. My answer is based on few assumption but I don't think it is wrong.
comment on: http://stackoverflow.com/a/25736539
type: AnswerComment

http://stackoverflow.com/a/25858522
answers question: http://stackoverflow.com/q/25858516
has comment: http://stackoverflow.com/comment/40463698
downvote count: 0
has comment: http://stackoverflow.com/comment/40462346
has comment: http://stackoverflow.com/comment/40463507
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40467706
score: 2
has body: You have a semi colon at the end of your if statement. That semi colon ends the if statement, and the next block of code is seen as just a block and is executed no matter what. You need to remove all your semi colons at the end of your if statements: if (secthirdsq==longsq) { ... } else if (secthirdsq!=longsq) { ... Also your code looks to suffer from the inaccuracy of floating point calculations, try to compare like: if (Math.abs(secthirdsq-longsq) &lt; 0.001)) or just use whole numbers (like int). In addition, you probably just want an else instead of that else if, as you are comparing the opposite of what the preceding if is comparing.
has comment: http://stackoverflow.com/comment/40463080
has comment: http://stackoverflow.com/comment/40463183

http://stackoverflow.com/a/26035972
downvote count: 0
has comment: http://stackoverflow.com/comment/100981103
has body: Add the following archives from the Jersey-ext-directory to your classpath: hk2-api-*.jar hk2-locator-*.jar hk2-utils-*.jar javax-inject-*.jar jersey-guava-*.jar
answers question: http://stackoverflow.com/q/25740556
type: AcceptedAnswer
score: 27
accepted answer of: http://stackoverflow.com/q/25740556
has comment: http://stackoverflow.com/comment/43422731
type: Answer
upvote count: 27
has comment: http://stackoverflow.com/comment/75796360
has comment: http://stackoverflow.com/comment/100995450
has comment: http://stackoverflow.com/comment/48324534

http://stackoverflow.com/comment/80966356
comment on: http://stackoverflow.com/a/31940028
type: AnswerComment
score: 0
type: Comment
has text: @Stephan thanks i will check the link which you have sent.

http://stackoverflow.com/a/25865196
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40474341
answers question: http://stackoverflow.com/q/25864979
has comment: http://stackoverflow.com/comment/40473968
has body: Try, SharedPreferences pref = getContext().getSharedPreferences("A", Context.MODE_WORLD_WRITEABLE); Instead of using Editor edt = pref.edit(); edt.putString("A", tv.toString()); edt.commit(); use Editor edt = pref.edit(); edt.putString("A", tv.getText().toString()); edt.commit();
score: 1
accepted answer of: http://stackoverflow.com/q/25864979
has comment: http://stackoverflow.com/comment/40475582
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25841395
answer count: 2
has comment: http://stackoverflow.com/comment/40431181
downvote count: 0
has answer: http://stackoverflow.com/a/25841532
favorite count: 0
upvote count: 5
tagged with: multidimensional-array
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40431168
accepted answer: http://stackoverflow.com/a/25841601
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/17804108
has comment: http://stackoverflow.com/comment/40431149
has comment: http://stackoverflow.com/comment/40431162
type: Question
has body: I have a multidimensional array that I want to retrieve using JSON in android. I have the following JSON Structure for this : [ [ { "name": "Banking", "data": [ { "vendor_name": "SBI", "vendor_id": "1" }, { "vendor_name": "ICICI", "vendor_id": "2" }, { "vendor_name": "BOB", "vendor_id": "3" } ], "count": 4 } ] ] I want to get "name",vendor_name,vendor_id in my Strings in android. But I am not getting idea how to do this. Please let me know how to retrieve this.
score: 5
has answer: http://stackoverflow.com/a/25841601
has title: How to retrieve multidimensional array using json in android
tagged with: arrays
possible better answer: http://stackoverflow.com/a/25841532

http://stackoverflow.com/comment/40313899
score: 0
type: Comment
type: QuestionComment
has text: Did you try with `Integer` instead of `int`? I meet Jon Skeet opinion: please give us your actual code.
comment on: http://stackoverflow.com/q/25777055

http://stackoverflow.com/q/25752548
has comment: http://stackoverflow.com/comment/40268953
has comment: http://stackoverflow.com/comment/40269321
answer count: 1
has body: Here is a little code public static void isAscending(String[] array){ // TODO This function will verify the details of the column if the column contents are actually ascending for(String a: array) log(a); Arrays.sort(array); for(String ao: array) log(ao); } In the above, if I just use the first for loop, I get all the elements in the order they were passed. If I put both of them together, I get no output. (Log is a function which does the same as System.out.println) Am I making some major mistake? I cannot see the reason for the second loop to not work LOG METHOD: public static void log(String text) { System.out.println(text); } INPUT ARRAY: I am taking the array from a webpage(using Selenium). Here is the function doing that (It works perfectly and gives the output I expect it to be) : public static String[] getEmail() { WebElement table_element = driver.findElement(By.className(TABLE_RESPONSE)); List&lt;WebElement&gt; tr_collection=table_element.findElements(By.xpath("//tbody//tr[position()&gt;2]")); int i=0; String[] emails = new String[tr_collection.size()]; for(WebElement trElement : tr_collection) { WebElement email = trElement.findElement(By.className("email")); String email_id = email.getText(); emails[i] = email_id; i++; } return emails; } Here is how I call it: isAscending(getEmail());
has title: For loop is acting differently
has comment: http://stackoverflow.com/comment/40268743
has comment: http://stackoverflow.com/comment/40269064
has comment: http://stackoverflow.com/comment/40269201
has comment: http://stackoverflow.com/comment/40269105
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40269244
has comment: http://stackoverflow.com/comment/40269533
tagged with: java
has answer: http://stackoverflow.com/a/25752634
accepted answer: http://stackoverflow.com/a/25752634
has comment: http://stackoverflow.com/comment/40268780
type: Question
has comment: http://stackoverflow.com/comment/40269382
score: 0

http://stackoverflow.com/a/25758218
accepted answer of: http://stackoverflow.com/q/25758085
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25758085
has body: You iterate the wrong way, if comparing for index == 1 the loop never starts as index is declared with -1. if you would declare your index with 1, the loop would start but then run endlessly if names[1] is not equal to s, so just remove it and youre good. public int getIndex(String s){ for(int i = 0; (i &lt; names.length; i++) { if(names[i].equals(s)) { //use equalsIgnoreCase if comparing should be case insensitive return i; //found } } return -1; //not found } Another version to do your loop is (if you just want the index you can directly use indexOf() as in the last example shown): List&lt;String&gt; names2 = new ArrayList&lt;String&gt;(Arrays.asList(names)); for(String name : names2){ if(name.equals(s)) return names2.indexOf(name); } This is an enhanced for loop. You can also shortcut and directly get the index: List&lt;String&gt; names2 = new ArrayList&lt;String&gt;(Arrays.asList(names)); return names2.indexOf(s); Ideone Fiddle Be aware that you always only get the index of the first occurence. if s is more than once inside the array you must enhance it to store the indexes found and return all of them! public List&lt;Integer&gt; getIndexes(String s){ List&lt;Integer&gt; found = new ArrayList&lt;Integer&gt;(); for(int i = 0; (i &lt; names.length; i++) { if(names[i].equals(s)) { //use equalsIgnoreCase if comparing should be case insensitive found.add(i); } } return found; }
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40279301
upvote count: 2

http://stackoverflow.com/q/25756237
has answer: http://stackoverflow.com/a/25756249
type: Question
has title: How to fix "Return type must be {SomeClassName}" error?
answer count: 1
has comment: http://stackoverflow.com/comment/40276712
score: -2
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40275692
upvote count: 1
has body: I have created a new class called SomeCode. I have another class called SomeAccount. I need to create a method inside of SomeCode that returns a SomeAccount object. Here is what I have tried: public SomeCode toBarcode () { String BarCodeSource = toString(); int barCodeNumber = Integer.parseInt(BarCodeSource); return barCodeNumber; } The error I am getting is "Return type must be SomeCode", which is true, I just don't know how to fix it.
tagged with: java
downvote count: 3
tagged with: methods

http://stackoverflow.com/q/25803115
tagged with: double
has body: I am trying to format double value to one decimal point using below code but it produces two different rounding values. double d1= 4.55; double d2= 17.85; DecimalFormat oneDForm = new DecimalFormat("#.0"); System.out.println(oneDForm.format(d1)); System.out.println(oneDForm.format(d2)); Output: 4.6 17.8 (Expecting 17.9) But what i wanted roundup by counting up for even decimal 17.85 to 17.9, how to achieve this?
linked to: http://stackoverflow.com/q/960072
linked to: http://stackoverflow.com/q/10144636
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40361128
type: Question
score: 3
tagged with: format
has comment: http://stackoverflow.com/comment/40361095
tagged with: rounding
linked to: http://stackoverflow.com/q/22036885
tagged with: java
has title: How to make round up to count up the even decimal value (example., if it is 2.25 it should round up to 2.3 not 2.2)
upvote count: 3
has answer: http://stackoverflow.com/a/25803494
answer count: 2
has comment: http://stackoverflow.com/comment/40664991
has answer: http://stackoverflow.com/a/25804812
downvote count: 0
accepted answer: http://stackoverflow.com/a/25804812
favorite count: 0
possible better answer: http://stackoverflow.com/a/25803494
has comment: http://stackoverflow.com/comment/40361102
has comment: http://stackoverflow.com/comment/40362248

http://stackoverflow.com/comment/40243562
type: QuestionComment
has text: @KaviK What you're essentially trying to do is solve a differential equation, without calculus (or Laplace transformation).
comment on: http://stackoverflow.com/q/25738628
score: 0
type: Comment

http://stackoverflow.com/comment/40446101
comment on: http://stackoverflow.com/a/25808257
type: Comment
has text: I posted an example in my answer.
type: AnswerComment
score: 0

http://stackoverflow.com/a/34151205
has body: subject =StringUtils.substringBetween(subject, "[", "]")
type: Answer
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25852961

http://stackoverflow.com/a/25719621
has body: The Exception is being thrown by int a = keyboard.nextInt();, which is outside of the try catch block. Place the call to int a = keyboard.nextInt(); inside the try block. There are other problems with your code: verifyAge() returns a boolean that is never used. Your getAge() method is recursive and, assuming that the user enters a number, it will just loop - is this what you intended? UPDATE public static int getAge(){ Scanner keyboard = new Scanner(System.in); System.out.print("Please enter your age: "); int age = -1; while(!verifyAge(age)){ // will loop until there's a valid age try{ age = scanner.nextInt(); catch (InputMismatchException e){ System.out.println("You may only enter integers as an age. Try again."); } } return age; // your current code doesn't do anything with this return value } public static boolean verifyAge (int a){ // would be better named isValidAge() if (a &gt;= 0 &amp;&amp; a &lt;= 122){ System.out.println("The age you entered, " + a + ", is valid."); return true; }else{ // no need to call getAge() here System.out.println("The age must be from 0 to 122, cannot be negative, and has to be an integer."); return false; } }
type: Answer
has comment: http://stackoverflow.com/comment/40216340
has comment: http://stackoverflow.com/comment/40208121
answers question: http://stackoverflow.com/q/25719588
upvote count: 4
has comment: http://stackoverflow.com/comment/40207703
downvote count: 0
score: 4

http://stackoverflow.com/comment/40213363
comment on: http://stackoverflow.com/a/25722508
type: Comment
has text: Thank you, that worked! And @NormanMaurer RESPECT to Mr Author, waiting in suspense for the next update!
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40456785
comment on: http://stackoverflow.com/a/25855482
has text: If a thread in the pool dies, then the task which it was executing will be canceled.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40312671
has text: it seems you are smart enough I always thought we have to use try catch block for scanner too :)
type: AnswerComment
comment on: http://stackoverflow.com/a/25776383
type: Comment
score: 1

http://stackoverflow.com/q/25739105
score: 0
tagged with: playframework
answer count: 1
has title: Exception when trying to return filtered Json objects array of different classes implementing the same interface
tagged with: ebean
has body: Here is a Play Framework (2.0.4, Java) controller action that aims to return a Json array containing various instances off classes implementing the same interface. I want to limit the Json fields to 4 (siren, nic, ncc, nccenr, my objects are french institutions). I instantiate an ArrayList of Institutions that I fill with instances of different institutions filtered via EBean queries. public static Result getCollectivitesList() { List&lt;Institution&gt; collectivites = new ArrayList&lt;Institution&gt;(); collectivites.addAll(Commune.find.where().eq("departement", Departement.findByCode("44")).findList()); collectivites.addAll(EtablissementPublic.find.all()); collectivites.addAll(Departement.find.where().eq("code", 44).findList()); collectivites.addAll(Region.find.where().eq("code", 52).findList()); JsonContext jsonContext = Ebean.createJsonContext(); JsonWriteOptions options = new JsonWriteOptions(); options.setRootPathProperties("siren, nic, ncc, nccenr"); String jsonString = jsonContext.toJsonString(collectivites, true, options); return ok(Json.parse(jsonString)); } Individually, I can get only one kind of institution, but when I try to mix 2, 3 or 4 kinds, it throws an exception : java.lang.RuntimeException: There is no HTTP Context available from here. play.mvc.Http$Context.current(Http.java:27) play.mvc.Controller.session(Controller.java:49) play.mvc.Controller.session(Controller.java:63) controllers.Authentication.isAuthenticated(Authentication.java:49) views.html.main$.apply(main.template.scala:92) views.html.errors.internalServerError$.apply(internalServerError.template.scala:30) views.html.errors.internalServerError$.render(internalServerError.template.scala:53) views.html.errors.internalServerError.render(internalServerError.template.scala) Global.onError(Global.java:21) play.core.j.JavaGlobalSettingsAdapter.onError(JavaGlobalSettingsAdapter.scala:30) play.core.ActionInvoker$$anonfun$receive$1.apply(Invoker.scala:159) play.core.ActionInvoker$$anonfun$recei…
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has answer: http://stackoverflow.com/a/25740255
accepted answer: http://stackoverflow.com/a/25740255

http://stackoverflow.com/q/25735613
type: Question
accepted answer: http://stackoverflow.com/a/25735637
possible better answer: http://stackoverflow.com/a/25735629
has answer: http://stackoverflow.com/a/25735629
answer count: 2
downvote count: 0
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25735637
has title: Matcher not finding matches
tagged with: regex
type: AnsweredQuestion
has body: I'm trying to extract the numbers in the following string: 09/29/2014 I am currently using the code: Pattern p = Pattern.compile(&quot;([0-9]{2})/([0-9]{2})/([0-9]{4})&quot;); Matcher m = p.matcher(startDatepicker); String startYear = m.group(3); String startMonth = m.group(1); String startDay = m.group(2); startDatepicker contains: 09/29/2014 However, I am not receiving any matches. I also tried escaping the forward slashes with \\ but that also didn't work. Am I missing something?
tagged with: java
upvote count: 1

http://stackoverflow.com/a/25771630
downvote count: 0
has body: Michael, If it's a time-out issue, it's common practice to use guava's Listenable Future to chain your tasks together. What your web sequence will look like then is: a) Client sends file b) Server responds with 200 once file completes uploading. c) Once the server is done loading the file, chain the future to then upload to S3. Chaining listenable futures is common practice to separate functionality and ensure a time out doesn't occur by breaking up your code and essentially pipe-lining it. Please let me know if you have any questions!
answers question: http://stackoverflow.com/q/25771456
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/25843995
score: 9
upvote count: 9
has body: It might be wrong architecture. You might be running java x64 on x32 machine. As @G.S mentioned in comments the same problem was disscussed at superuser
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25841222

http://stackoverflow.com/q/25731521
favorite count: 0
tagged with: static
type: UnansweredQuestion
answer count: 0
tagged with: java
has title: Statement surrounded by static { ... statement; } why, what for?
tagged with: methods
duplicate of: http://stackoverflow.com/q/2943556
type: Question
linked to: http://stackoverflow.com/q/2943556
has comment: http://stackoverflow.com/comment/40230510
has body: For example I have following class public class AnyClassName { static { AnyMethodCall(anyParameters, ..., ...); } body of class ... } The question is what is the reason of surrounding the method: AnyMethodCall(anyParameters, ..., ...) with static { ... } ?
score: 0
linked to: http://stackoverflow.com/q/2420389
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40229678

http://stackoverflow.com/q/25823945
tagged with: linux
tagged with: processbuilder
type: Question
has comment: http://stackoverflow.com/comment/40402096
score: 0
has comment: http://stackoverflow.com/comment/40398981
tagged with: java
has title: Trying to execute MySQL server from Java application
has comment: http://stackoverflow.com/comment/40403061
tagged with: runtime
type: UnansweredQuestion
has body: I am trying to run MySQL server through Java application but I am not able to execute terminal commands through my application. Here is the code I am using. String[] commands = new String[]{"cd /usr/local/mysql/support-files/", "echo "+password+" | sudo -S ./mysql.server start"}; Process proc = new ProcessBuilder(commands).start(); BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream())); BufferedReader err = new BufferedReader(new InputStreamReader(proc.getErrorStream())); String msg = ""; while(true) { msg = br.readLine(); if(msg == null) break; System.out.println(msg); } But this code is not executing those commands.
answer count: 0
has comment: http://stackoverflow.com/comment/40398894
tagged with: terminal

http://stackoverflow.com/comment/73743529
score: 0
comment on: http://stackoverflow.com/a/39205848
type: AnswerComment
type: Comment
has text: but then ure creating a logic that will truncate numbers and at some point on the future the delivery order wont be correct, so your approach is not robust @RaphaelC

http://stackoverflow.com/q/25872377
tagged with: reflection
tagged with: java
has title: Get (access) class from its field
accepted answer: http://stackoverflow.com/a/25872618
tagged with: class
answer count: 2
has comment: http://stackoverflow.com/comment/40487200
has body: Fairly new to Java as well as SO. Here's my question: Suppose x is an instance of a Class X. And y is an attribute (field) of X. If I pass "x.y" in a function f, is there a way to access x? Example: Class Person { public Girl girl; //Girl itself is another class } public void function1(Girl g) { //body } Person p = new Person(); p.girl = new Girl(); function1(p.girl); Now, I want to access p in the function. (Something like a "previous" pointer in a linked list). Looked around and found something called Reflection. But that doesn't help, really. Thanks!
score: 0
has comment: http://stackoverflow.com/comment/40487378
tagged with: field
has comment: http://stackoverflow.com/comment/40487269
has comment: http://stackoverflow.com/comment/40487113
has comment: http://stackoverflow.com/comment/40487343
has answer: http://stackoverflow.com/a/25872618
possible better answer: http://stackoverflow.com/a/25872758
has answer: http://stackoverflow.com/a/25872758
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/25724640
answers question: http://stackoverflow.com/q/25724576
score: 0
has body: The boolean operator you are using is OR. Your condition will check whether it doesn't start with the first character, OR if it doesn't start with the second. Since you are checking for something that doesn't start with either, you must use AND. Replace your code with: if (!s.startsWith("@") &amp;&amp; !s.startsWith("-"))
type: Answer

http://stackoverflow.com/a/25765508
answers question: http://stackoverflow.com/q/25765232
has comment: http://stackoverflow.com/comment/40291676
has comment: http://stackoverflow.com/comment/40293059
type: Answer
has comment: http://stackoverflow.com/comment/40292033
upvote count: 6
score: 6
has body: Look at JLS section 15.17.3 it says: In C and C++, the remainder operator accepts only integral operands, but in the Java programming language, it also accepts floating-point operands. The remainder operation for operands that are integers after binary numeric promotion (§5.6.2) produces a result value such that (a/b)*b+(a%b) is equal to a. This identity holds even in the special case that the dividend is the negative integer of largest possible magnitude for its type and the divisor is -1 (the remainder is 0). It follows from this rule that the result of the remainder operation can be negative only if the dividend is negative, and can be positive only if the dividend is positive;
accepted answer of: http://stackoverflow.com/q/25765232
has comment: http://stackoverflow.com/comment/40292077
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25774139
downvote count: 0
answers question: http://stackoverflow.com/q/25773886
has comment: http://stackoverflow.com/comment/40382759
type: Answer
has body: Consider using a TreeMap, which is a SortedMapand thus also a Map. You can provide a Comparator to its constructor. The sorted map will use that Comparator for sorting the map keys. But importantly, for your case, it will consuder keys to be equal if the Comparator returns 0. In your case that will require a Comparator that is not consustent with equals, which could cause you problems if you are not careful. Another option is to introduce another class, which acts as an adaptor for a Mononomial and can be used as a map key having the properties you deserve.
upvote count: 3
score: 3

http://stackoverflow.com/comment/46444690
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25760725
type: AnswerComment
has text: Good algorithm, but wrong type (see Thomas disclaimer). Before doing your calculation, you should convert your LocalDateTime variables to ZonedDateTime using default time zone for example (or any time zone you need) : ZonedDateTime fromZonedDateTime = fromDateTime.atZone(ZoneId.systemDefault());

http://stackoverflow.com/comment/67965067
has text: Great trick with the Boolean statics and methods, it simplifies code so much! +1
type: AnswerComment
comment on: http://stackoverflow.com/a/25824276
type: Comment
score: 0

http://stackoverflow.com/comment/40224825
type: QuestionComment
has text: At the cost of advocating for the devil, why use NoSQL? Shouldn't you be choosing the tool for your requirement rather than choosing the tool and then wondering 'how do I use this to nail this nail?' (unless of course you are trying to learn the tech). If your data makes more sense with relations, has a fixed schema, not much volume and has no qualms with ACID constraints, why look for something else?
score: 1
comment on: http://stackoverflow.com/q/25728532
type: Comment

http://stackoverflow.com/a/25860560
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25859509
answers question: http://stackoverflow.com/q/25859509
score: 0
type: AcceptedAnswer
type: Answer
has body: Cribbing an answer from this question: You could build a wrapper using the C JVM API and then call it from Ruby using FFI, or you could use a project called Ruby Java Bridge (RJB).
upvote count: 1

http://stackoverflow.com/comment/40382413
score: 0
type: Comment
has text: For your last question - "foo", "bar", and "baz" are essentially 'standard' placeholder variables - they're random names that don't mean anything. The wiki article "foobar" has some details on the history behind it (http://en.wikipedia.org/wiki/Foobar)
comment on: http://stackoverflow.com/a/25814567
type: AnswerComment

http://stackoverflow.com/q/25781485
has comment: http://stackoverflow.com/comment/40321930
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/8667965
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25784890
has comment: http://stackoverflow.com/comment/40322356
has comment: http://stackoverflow.com/comment/40321454
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40322216
has title: How to properly map the DTOs in Hibernate so that SessionFactory initializes properly?
type: Question
has body: This might be a very basic issues but I tried many things but getting issues with all. Daddies please ignore. CASE 1: When I mention my mappings in hibernate.cfg.xml as below: <mapping class="com.tm.midservice.db.dto.User"/> <mapping class="com.tm.midservice.db.dto.Company"/> I get the following errors. INFO - org.hibernate.tool.hbm2ddl.TableMetadata - table found: demodb.company INFO - org.hibernate.tool.hbm2ddl.TableMetadata - columns: [analytics_feature_enabled, source_domain, currency, id, updated_at, source, token, name, domain, created_at, active, mid] SessionFactory initial creation error.org.hibernate.HibernateException: Wrong column type: active, expected: bit` The column I have described in my DTO is as : @Column(name = "active") private boolean active; (EDIT 1) Tried the below thing, but did not work: @Type(type="true_false") @Column(name="active", columnDefinition = "TINYINT(1) DEFAULT 0") private boolean active; gives exception as: SessionFactory initial creation error.org.hibernate.HibernateException: Wrong column type: active, expected: TINYINT(1) DEFAULT 0 (EDIT 2) Found something at: "Found: bit, expected: boolean" after Hibernate 4 upgrade @Column(name="active", columnDefinition = "BIT", length = 1) private boolean active; gives exception as: SessionFactory initial creation error.org.hibernate.HibernateException: Wrong column type: active, expected: BIT (EDIT 3) Tried something as: public class Mysql5BitBooleanDialect extends MySQL5Dialect { public Mysql5BitBooleanDialect() { super(); registerColumnType( Types.BOOLEAN, "bit" ); } } This class does get invoked, but exception does not go. CASE 2 : When I do not give the mapping in cfg file and try to run my application, the sessionFactory initializes and all but when I try to do any database operations I get error as : hibernate mapping exception unknown entity Ideally I should not be giving any mapping definitions as the DTO has got the annotations for that [@Entity & @Table (name = "User")]. How do…

http://stackoverflow.com/q/25799951
type: Question
has answer: http://stackoverflow.com/a/25803280
score: -2
has title: How to print a diamond of random numbers?
has answer: http://stackoverflow.com/a/66220443
answer count: 2
downvote count: 4
favorite count: 0
tagged with: ascii-art
upvote count: 2
type: UnansweredQuestion
has body: Can someone help me complete this numeric diamond? I have the right side of the diamond printing out, but I'm having trouble printing out the left side of it. If anybody can help I would really appreciate it. I made some changes to my code. I now need my code to print one column in the middle of the diamond instead of two. public class NumericDiamond { public static void main(String[] args) { /* 1 1 4 3 4 2 4 4 5 7 4 3 5 3 5 4 4 5 */ int noOfColumns = 1; int noOfSpaces = 3; int start = 0; for (int i = 1; i &lt;= 5; i++) { for (int j = noOfSpaces; j &gt;= 1; j--) { System.out.print(&quot; &quot;); } for (int j = 1; j &lt;= noOfColumns; j++) { System.out.print(noOfColumns); } if (i &lt; 5) { start = i; } else { start = 8 - i; } System.out.print(start + &quot; &quot;); start--; System.out.println(); if (i &lt; 3) { noOfColumns = noOfColumns + 2; noOfSpaces = noOfSpaces - 1; } else { noOfColumns = noOfColumns - 2; noOfSpaces = noOfSpaces + 1; } } } }
linked to: http://stackoverflow.com/q/25712029
tagged with: java
linked to: http://stackoverflow.com/q/33569050

http://stackoverflow.com/comment/52379127
type: AnswerComment
score: 0
type: Comment
has text: @geoand Both actually
comment on: http://stackoverflow.com/a/25765032

http://stackoverflow.com/a/57237196
has body: I think I figured out a simple solution which is when you create your PendingIntent, for the 3rd argument simply put new Intent(). So: if (pendingIntent == null) { pendingIntent = PendingIntent.getActivity(this, 0, new Intent(), 0); } And then set your NFC adapter as: adapter.enableForegroundDispatch(this, pendingIntent, null, null); Do this in all of the activities in which you don't want anything to happen in your own app when you scan an NFC tag (though it will create a sound), and you also don't want the default Android NFC reader to pop up.
score: 1
downvote count: 1
upvote count: 2
answers question: http://stackoverflow.com/q/25825188
type: Answer

http://stackoverflow.com/comment/40339674
type: Comment
score: 0
has text: @user3856587 why would you want an array of *94109400* elements? That maybe won't fit in memory.
type: AnswerComment
comment on: http://stackoverflow.com/a/25791750

http://stackoverflow.com/a/25724114
answers question: http://stackoverflow.com/q/25724057
downvote count: 0
has comment: http://stackoverflow.com/comment/40215655
has comment: http://stackoverflow.com/comment/57064257
score: 1
has comment: http://stackoverflow.com/comment/57065907
upvote count: 1
has body: The problem is that word files are not an open standard, so it's hard to open them. You will need to use a third party library to decode the document into whatever format you want to use and then use that decoded document. For example OpenOffice provides an API to do this, it does require an OpenOffice installation and a fair amount of setting up though. There is also ApachePOI and a few other similar libraries. Each one has its own strengths and weaknesses though so you'll need to evaluate them to find what you need.
type: Answer

http://stackoverflow.com/q/25835595
tagged with: recursion
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40424181
has comment: http://stackoverflow.com/comment/40421783
type: Question
has comment: http://stackoverflow.com/comment/40420025
has answer: http://stackoverflow.com/a/25835686
has comment: http://stackoverflow.com/comment/40420088
tagged with: long-integer
downvote count: 0
answer count: 1
has body: So the recursive function I'm making takes 2 variables (x and y) and calculates x to the power of y. Just like the Math.pow function. y is positive, so I don't need to worry about negative exponents. This is my code: public static int power(int x, int y) { if (y == 0) return 1; else return x * power(x, y-1); } At first it seemed like it worked fine, but then I tried to enter power(50,6). I got -1554869184. Obviously this is wrong because the correct answer can't be negative.
linked to: http://stackoverflow.com/q/15004944
tagged with: int
has title: Simple Java power recursion
accepted answer: http://stackoverflow.com/a/25835686
favorite count: 0
has comment: http://stackoverflow.com/comment/40420184
has comment: http://stackoverflow.com/comment/40420012
has comment: http://stackoverflow.com/comment/40420135
has comment: http://stackoverflow.com/comment/40420148
upvote count: 1

http://stackoverflow.com/q/25751701
upvote count: 1
type: Question
tagged with: android-layout
tagged with: eclipse
has title: The following classes could not be instantiated:com.google.android.gms.ads.AdView (Open Class, Show Error Log)
answer count: 1
downvote count: 0
score: 1
favorite count: 0
has body: I have tried my best (added google services to my app also) also. i followed google admob site 1000 times I am fed up please someone help me in completing my project. I hope here I be getting a good advice here thank you @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Look up the AdView as a resource and load a request. AdView adView = (AdView)this.findViewById(R.id.adView); AdRequest adRequest = new AdRequest.Builder().build(); adView.loadAd(adRequest); } @Override public boolean onCreateOptionsMenu(Menu menu) { //Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { //Handle action bar item clicks here. The action bar will //automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" xmlns:ads="http://schemas.android.com/apk/res-auto" android:id="@+id/LinearLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.interadd.MainActivity" > <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" ads:adSize="BANNER" ads:adUnitId="ca-app-pub-2961758853938686/9050318854"/> </LinearLayout> <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.perm…
type: UnansweredQuestion
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25752256
has comment: http://stackoverflow.com/comment/40267925
linked to: http://stackoverflow.com/q/19755932
tagged with: java

http://stackoverflow.com/comment/40305104
has text: @JimGarrison I figured out reverse with the help from Ward L but I also cant figure out how to get equals to run the way I want it to. I know its trying to compare two pairs (Not sure why the one is passed as "Object otherObject" could you explain that?) so I tried to use the .fst and .snd methods to do get their first and second values and compare them with the .equals method but when I do that I get a compiling error "cannot find symbol"...
score: 0
comment on: http://stackoverflow.com/q/25769458
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40253682
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25744446
has text: Oh, I see what you're trying to do now.

http://stackoverflow.com/q/25813357
upvote count: 2
score: 1
tagged with: maven
has comment: http://stackoverflow.com/comment/40444092
downvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40383025
has body: I'm trying to make the JavaDoc of my maven-project. So i added the plugin to my parent project and all of it sons have the same configuration by default. But unfortunately i have a big problem. When I run maven site into my project it throws this error: https://gist.github.com/rhuankarlus/8416752935567572e60f I don't use the jaxen dependency in the project so I don't understand this error. Googling it I found nothing. Here's part of error message: [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] empresa Corporativo Root ............................. FAILURE [1:43.624s] [INFO] empresa Generico ..................................... SKIPPED [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1:44.255s [INFO] Finished at: Fri Sep 12 15:17:34 BRT 2014 [INFO] Final Memory: 49M/237M [INFO] ------------------------------------------------------------------------ [WARNING] The requested profile "template-config-empresa" could not be activated because it does not exist. [ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project empresa-corporativo-root: Error during page generation: Error rendering Maven r eport: [ERROR] Exit code: 1 - Errors happened while accessing the package-list file at ../apidocs/ [ERROR] Unable to access the package-list file at D:/Desenvolvimento/Repositorios/empresa-corporativo/trunk/target/javadoc-bundle-options/ [ERROR] Errors happened while accessing the package-list file at ../apidocs/ [ERROR] Unable to access the package-list file at D:/Desenvolvimento/Repositorios/empresa-corporativo/trunk/target/javadoc-bundle-options/ [ERROR] Errors happened while accessing the package-list file at ../apidocs/ [ERROR] Unable to access the package-list file at D:/Desenvolvimento/Repositorios/empresa-corporativo/trunk/target/javadoc-bundle-options/ [ERROR] javadoc: warning - Er…
has comment: http://stackoverflow.com/comment/43555131
favorite count: 0
has comment: http://stackoverflow.com/comment/40379478
type: UnansweredQuestion
has title: Maven Site Error: class file for org.jaxen.VariableContext not found
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/103698275
answer count: 0

http://stackoverflow.com/q/25870635
has title: How to pass array of strings to a Java program?
has comment: http://stackoverflow.com/comment/40504909
has answer: http://stackoverflow.com/a/25870678
has comment: http://stackoverflow.com/comment/40483644
has answer: http://stackoverflow.com/a/25870706
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/25870850
has answer: http://stackoverflow.com/a/25870805
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25916871
downvote count: 6
has answer: http://stackoverflow.com/a/25870975
tagged with: java
has answer: http://stackoverflow.com/a/25870687
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/40483640
score: -2
tagged with: program-entry-point
has body: In: public static void main (String [ ] args) How to set the value parameter variable args of the main method as an array of String?

http://stackoverflow.com/a/32191595
answers question: http://stackoverflow.com/q/25830678
has body: My suggestion is to restard the hadoop by calling "$HADOOP_HOME/sbin/start-all.sh".
type: Answer
score: 0

http://stackoverflow.com/a/25717784
upvote count: 2
has comment: http://stackoverflow.com/comment/40205584
has comment: http://stackoverflow.com/comment/40203852
has body: Try below line of code to make excel sheet from java.In between you can insert data from database by using any api to make database call. HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = workbook.createSheet("Sample sheet"); Map&lt;String, Object[]&gt; data = new HashMap&lt;String, Object[]&gt;(); data.put("1", new Object[] {"Emp No.", "Name", "Salary"}); data.put("2", new Object[] {1d, "John", 1500000d}); data.put("3", new Object[] {2d, "Sam", 800000d}); data.put("4", new Object[] {3d, "Dean", 700000d}); Set&lt;String&gt; keyset = data.keySet(); short rownum = 0; for (String key : keyset) { HSSFRow row = sheet.createRow(rownum++); Object [] objArr = data.get(key); int cellnum = 0; for (Object obj : objArr) { HSSFCell cell = row.createCell(cellnum++); if(obj instanceof Date) cell.setCellValue((Date)obj); else if(obj instanceof Boolean) cell.setCellValue((Boolean)obj); else if(obj instanceof String) cell.setCellValue((String)obj); else if(obj instanceof Double) cell.setCellValue((Double)obj); } } try { FileOutputStream out = new FileOutputStream(new File("D:\\new.xls")); workbook.write(out); out.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25717637
has comment: http://stackoverflow.com/comment/40205716
score: 1

http://stackoverflow.com/comment/40437132
type: QuestionComment
has text: Possible duplicate of http://stackoverflow.com/questions/22659970/lob-is-closed-errorcode-4470-sqlstate-null
comment on: http://stackoverflow.com/q/25843805
score: 1
type: Comment

http://stackoverflow.com/a/25846217
type: Answer
answers question: http://stackoverflow.com/q/25845577
score: 0
has body: You could create a map from id to the object for one of the lists and then iterate through the other to create the new List using the data from the map. List&lt;MyCompositeClass&gt; combine(List&lt;MyCustomClass1&gt; myList1, List&lt;MyCustomClass2&gt; myList2) { // create map Map&lt;Long, MyCustomClass1&gt; idToObj = new HashMap&lt;&gt;(); for (MyCustomClass1 o : myList1) { idToObj.put(o.commonattrId, o); } // construct result list List&lt;MyCompositeClass&gt; result = new ArrayList&lt;&gt;(); for (MyCustomClass2 o : myList2) { MyCustomClass1 o1 = map.get(o.commonattrId); if (o1 != null) { MyCompositeClass combined = new MyCompositeClass(); combined.obj1 = o1; combined.obj2 = o; result.add(combined); } } return result; } This will only add all possible combinations of objects from both lists, if commonattrId values are pairwise distinct in each list, but since the field name has "Id" as suffix, I made an educated guess...

http://stackoverflow.com/q/25819640
answer count: 1
has title: Eclipse Files Not Found? Works with JCreator
tagged with: java
type: UnansweredQuestion
tagged with: inputstream
tagged with: eclipse
has body: Well I have these .java files in JCreator. When I compile them in JCreator, it's fine, all files and folders are read and no errors occurred. But, I need to compile them in an Eclipse project to pass it to my professor. Then the problems started. I added the .java files in a new Eclipse project and into a new package inside the src folder Then after that, I made a new Folder in the project called res and added it to the build path as a source Folder and added the files and folders in it. &gt;Use as Source Folder All sub-folders are fine same name and stuff, Refreshed the project a few times, checked the build path, but when I execute the program, It says: java.io.FileNotFoundException: sounds\bgmusic.wav (The system cannot find the path specified) from this line: InputStream test = new FileInputStream("sounds\bgmusic.wav"); Same folder name, same file, added it to the Build Path and stuff. Also, I repeat, It does not find ALL the files in the resource folder: Pictures, Sounds Fonts and other stuff. I already made some projects in Eclipse and I had successfully added pictures and sounds in them. But what's the problem with this? Thanks for the help!
type: Question
score: 0
tagged with: file
has answer: http://stackoverflow.com/a/25819692

http://stackoverflow.com/a/25730971
upvote count: 1
has comment: http://stackoverflow.com/comment/40253339
accepted answer of: http://stackoverflow.com/q/25730554
has body: As you already found out, there is no operator overloading in java you can use. From that there follows straight that altering the semantics of an expression int a = b + c; in pure java is simply not possible. Since you mention already having C++ code, depending on how its structured you might want to build a native library (DLL, SO) from it and use JNI to call the C++ code. It becomes impractical if your C++ code consists of many small functions/classes, the added clutter for native calls would outweight the utility of code reuse. Needless to say you will need a proper binary for each platfrom you want to deploy to. For a pure java implementation you will need to rewrite the logic - just as you already figured out - into explicit utility method calls doing the checks. Core java libraries (e.g. BigInteger, BigDecimal) go a tiny step farther and encapsulate their types into (usually immutable) value objects that (still) carry operations as standard method calls. That makes usage a little more compact/shorter, since the compiler will provide a little more type checking and you would not need to qualify method names with a class name BigDecimal sum = a.add(b);. Not much prettier, but its a well established idiom.
answers question: http://stackoverflow.com/q/25730554
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40232847
has comment: http://stackoverflow.com/comment/40260511
score: 1
has comment: http://stackoverflow.com/comment/40232235
has comment: http://stackoverflow.com/comment/40259764

http://stackoverflow.com/comment/40287801
comment on: http://stackoverflow.com/q/25763319
score: 2
has text: Which is the purpose of this letter? If you want an autoincrement, why you need a letter before it?
type: Comment
type: QuestionComment

binary-search
tags question: http://stackoverflow.com/q/25778502
tags question: http://stackoverflow.com/q/25828948
tag name: binary-search
type: Tag

http://stackoverflow.com/q/25782353
favorite count: 0
has comment: http://stackoverflow.com/comment/40324745
has answer: http://stackoverflow.com/a/25791899
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40323325
tagged with: c++
score: 4
has comment: http://stackoverflow.com/comment/40329573
has answer: http://stackoverflow.com/a/25820544
tagged with: java
linked to: http://stackoverflow.com/q/13263340
tagged with: android-ndk
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/40322887
has comment: http://stackoverflow.com/comment/40358739
has comment: http://stackoverflow.com/comment/40324369
has title: JNI GetMethodID cause error in native thread
tagged with: java-native-interface
has answer: http://stackoverflow.com/a/25782615
has comment: http://stackoverflow.com/comment/40336489
has comment: http://stackoverflow.com/comment/40324351
has comment: http://stackoverflow.com/comment/40324221
has comment: http://stackoverflow.com/comment/40324472
has body: In android I use pthread_create to create a native thread , then in the Callback procedure ,call FindClass to get a Java class. but it does'nt work. I get tips from android jni tips I found the solution in FindClass from any thread in Android JNI I modify it for my project like this [edit] JavaVM* gJvm = nullptr; static jobject gClassLoader; static jmethodID gFindClassMethod; JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *pjvm, void *reserved) { gJvm = pjvm; // cache the JavaVM pointer auto env = getEnv(); //replace with one of your classes in the line below auto randomClass = env-&gt;FindClass("com/example/RandomClass"); jclass classClass = env-&gt;GetObjectClass(randomClass); auto classLoaderClass = env-&gt;FindClass("java/lang/ClassLoader"); auto getClassLoaderMethod = env-&gt;GetMethodID(classClass, "getClassLoader", "()Ljava/lang/ClassLoader;"); gClassLoader = env-&gt;CallObjectMethod(randomClass, getClassLoaderMethod); gClassLoader = env-&gt;NewGlobalRef(gClassLoader); gFindClassMethod = env-&gt;GetMethodID(classLoaderClass, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;"); //check. this is ok jclass cls = env-&gt;FindClass("com/example/data/DataTest"); jmethodID methoID = env-&gt;GetMethodID(cls, "name", "()Ljava/lang/String;"); LOG_INFO("cls is %p\n", cls); return JNI_VERSION_1_6; } JNIEnv* getEnv() { JNIEnv *env; int status = gJvm-&gt;GetEnv((void**)&amp;env, JNI_VERSION_1_6); if(status &lt; 0) { status = gJvm-&gt;AttachCurrentThread(&amp;env, NULL); if(status &lt; 0) { return nullptr; } } return env; } jclass findClass(const char* name) { JNIEnv *env = getEnv(); jclass resultClass = 0; if(env) { resultClass = env-&gt;FindClass(name); //it can not found class in native thread, use loadClass method if (!resultClass) { LOG_INFO("can not find the class"); //return value is not null. return static_cast&lt;jclass&gt;(env-&gt;CallObjectMethod(gClassLoader, gFindClassMethod, env-&gt;NewStringUTF(name))); } } return resultClass; } ....... //thread callback void *pr…
has comment: http://stackoverflow.com/comment/40323417
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/40458728
type: AnswerComment
has text: Thanks! You mean super(x) in b doesn't change b.x? but I thought it was the way we use super constructor to change b's value
comment on: http://stackoverflow.com/a/25800079
type: Comment
score: 0

jms
tags question: http://stackoverflow.com/q/25847370
tags question: http://stackoverflow.com/q/25831246
tags question: http://stackoverflow.com/q/25738786
tags question: http://stackoverflow.com/q/25841975
tags question: http://stackoverflow.com/q/25789676
tag name: jms
tags question: http://stackoverflow.com/q/25717922
tags question: http://stackoverflow.com/q/25727392
tags question: http://stackoverflow.com/q/25782897
tags question: http://stackoverflow.com/q/25742914
tags question: http://stackoverflow.com/q/25832159
type: Tag
tags question: http://stackoverflow.com/q/25742781

http://stackoverflow.com/comment/40221139
comment on: http://stackoverflow.com/q/25727147
score: 0
type: Comment
type: QuestionComment
has text: Uhm, wait. Where do you actually define "POST" as the HTML request method?

http://stackoverflow.com/comment/40302469
type: Comment
comment on: http://stackoverflow.com/a/25770772
type: AnswerComment
has text: This sounds interesting and possibly a solution. I will give it a shot. Thanks.
score: 0

http://stackoverflow.com/q/25829189
has comment: http://stackoverflow.com/comment/40410515
type: AnsweredQuestion
has body: I am experiencing a famous "could only be replicated to 0 nodes, instead of 1" error in my Single-Node Hadoop installation while trying to add some file to hdfs: $ hdfs dfs -mkdir -p /grep/in $ hdfs dfs -put /hadoop_install_location/etc/hadoop/* /grep/in/ First command runs ok, second produces an exception: at org.apache.hadoop.hdfs.DFSOutputStream$DataStreamer.run(DFSOutputStream.java:525) put: File /grep/in/yarn-site.xml._COPYING_ could only be replicated to 0 nodes instead of minReplication (=1). There are 1 datanode(s) running and no node(s) are excluded in this operation. This exception can be found only in namenode's log. In datanode log there are no exceptions at the moment of running that command. Whats wrong with my setup? I was just folowwing the steps from this tutorial: http://elephantscale.com/hadoop2_handbook/Hadoop2_Single_Node.html. I have heard that I need to turn off IPv6, but I didn't this, is this important? Also, when I call stop-dfs.sh an exception is printed in datanode log: DataNode: IOException in offerService java.io.IOException: Failed on local exception: java.io.EOFException; Host Details : local host is: "debian/127.0.1.1"; destination host is: "localhost":8020; But this happens even if I do not run ny put command, this happens just everytime I shutdown the dfs. Namenode webUI says: Configured Capacity: 1.87 GB DFS Used: 28 KB Non DFS Used: 1.65 GB DFS Remaining: 230.8 MB DFS Used%: 0% DFS Remaining%: 12.04% Block Pool Used: 28 KB Block Pool Used%: 0% DataNodes usages% (Min/Median/Max/stdDev): 0.00% / 0.00% / 0.00% / 0.00% Live Nodes 1 (Decommissioned: 0) Dead Nodes 0 (Decommissioned: 0) etc/hadoop/slaves has only localhost line, /etc/hosts has 127.0.0.1 localhost and 127.0.1.1 debian lines. How can I fix it? Could you advice me what else can I check and how?
tagged with: java
accepted answer: http://stackoverflow.com/a/25836032
type: Question
tagged with: hadoop
answer count: 1
has title: "could only be replicated to 0 nodes, instead of 1" in Hadoop
has answer: http://stackoverflow.com/a/25836032
score: 0
has comment: http://stackoverflow.com/comment/40417134
has comment: http://stackoverflow.com/comment/40412787
has comment: http://stackoverflow.com/comment/40412797

http://stackoverflow.com/comment/40228631
has text: @fgysin Just a guess: The GC must know what young objects are reachable from the tenured space (see [write barrier](https://www.google.com/?gws_rd=ssl#q=gc+write+barrier)). Maybe it does the same for the survivors and then only some survivors has to be promoted and the rest gets dropped.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25725674
score: 0

http://stackoverflow.com/comment/40440315
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25846730
has text: Yeah I changed it to that Roland as its what I originally had and it still isn't working :(

http://stackoverflow.com/q/25734667
has comment: http://stackoverflow.com/comment/40236557
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25735057
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25735057
tagged with: arrays
tagged with: inheritance
has comment: http://stackoverflow.com/comment/40236653
has body: To start off, I just want to say I am a CS Major and my university has strict rules on any sort of plagiarism, so any answer that doesn't say "try this code" would be greatly appreciated :) using code to explain is fine. Anyways, my question. I just reached a point where I am really trying to understand a sharp learning curve for me. Inheritance and Polymorphism. My textbook explains it very well, and I understand the material, its just applying it to something real is what is getting to me. My assignment in a nutshell reads from a text file which contains a fantasy baseball team (players, and stats of each player) and then outputs a new text file with the team's entire stats. But my confusion is stemming from the following procedures after connecting to the file, which involve passing the scanner onto a class called BaseballTeam, which is aggregated with a superclass called Player, which then has two subclasses. Here is my driver: public static final String INPUT_FILE = "baseballTeam.txt"; public static void main(String[] args) { BaseballTeam team = new BaseballTeam(); Scanner inputStream = null; try { inputStream = new Scanner(new File(INPUT_FILE)); team.loadTeam(inputStream); } catch (FileNotFoundException e) { System.out.println("File " + INPUT_FILE + " Not Found."); System.exit(1); The BaseballTeam class is supposed to create an array of player references as an instance variable, and then the loadTeam() method creates objects for each type of player (pitcher, batter, or sub). After that, the scanner is handed of to a method called loadData() within the Player class, which is then inherited by the other two classes Batter and Pitcher with the same method name. I'm posting my other classes (unfinished/barely started) just in case the structure needs to be referenced. BaseballTeam: import java.util.Scanner; public class BaseballTeam { private static String name; private static final Player roster = new Player[]; BaseballTeam() { name = null; } public static String…
score: 0
answer count: 3
tagged with: file-io
has answer: http://stackoverflow.com/a/25735141
accepted answer: http://stackoverflow.com/a/25735141
has answer: http://stackoverflow.com/a/25737415
has title: How do I create an array of objects from a class, and then pass those to subclasses?
tagged with: polymorphism
has comment: http://stackoverflow.com/comment/40236485

sql
tags question: http://stackoverflow.com/q/25756361
tags question: http://stackoverflow.com/q/25866526
tags question: http://stackoverflow.com/q/25801401
tags question: http://stackoverflow.com/q/25865323
tags question: http://stackoverflow.com/q/25819160
tags question: http://stackoverflow.com/q/25780996
tags question: http://stackoverflow.com/q/25751434
tags question: http://stackoverflow.com/q/25860589
tags question: http://stackoverflow.com/q/25821141
tags question: http://stackoverflow.com/q/25872733
tags question: http://stackoverflow.com/q/25786815
tags question: http://stackoverflow.com/q/25728532
tags question: http://stackoverflow.com/q/25811597
tags question: http://stackoverflow.com/q/25723112
tags question: http://stackoverflow.com/q/25745445
tags question: http://stackoverflow.com/q/25811059
tags question: http://stackoverflow.com/q/25850820
tags question: http://stackoverflow.com/q/25770718
tags question: http://stackoverflow.com/q/25850540
tags question: http://stackoverflow.com/q/25854388
tags question: http://stackoverflow.com/q/25790809
tags question: http://stackoverflow.com/q/25749978
tags question: http://stackoverflow.com/q/25736036
tags question: http://stackoverflow.com/q/25745094
tags question: http://stackoverflow.com/q/25783431
tag name: sql
tags question: http://stackoverflow.com/q/25742698
tags question: http://stackoverflow.com/q/25736574
type: Tag
tags question: http://stackoverflow.com/q/25817997
tags question: http://stackoverflow.com/q/25845333
tags question: http://stackoverflow.com/q/25806313
tags question: http://stackoverflow.com/q/25774522
tags question: http://stackoverflow.com/q/25829164
tags question: http://stackoverflow.com/q/25794388
tags question: http://stackoverflow.com/q/25832218
tags question: http://stackoverflow.com/q/25869771
tags question: http://stackoverflow.com/q/25810077
tags question: http://stackoverflow.com/q/25770815
tags question: http://stackoverflow.com/q/25781140
tags question: http://stackoverflow.com/q/25779593
tags question: http://stackoverflow.com/q/25734378
tags question: http://stackoverflow.com/q/25767495
tags question: http://stackoverflow.com/q/25743950
tags question: http://stackoverflow.com/q/25771796
tags question: http://stackoverflow.com/q/25763535
tags question: http://stackoverflow.com/q/25850569
tags question: http://stackoverflow.com/q/25872510
tags question: http://stackoverflow.com/q/25798699
tags question: http://stackoverflow.com/q/25714545
tags question: http://stackoverflow.com/q/25845944
tags question: http://stackoverflow.com/q/25800160
tags question: http://stackoverflow.com/q/25796865
tags question: http://stackoverflow.com/q/25828334
tags question: http://stackoverflow.com/q/25871629
tags question: http://stackoverflow.com/q/25785687
tags question: http://stackoverflow.com/q/25834145
tags question: http://stackoverflow.com/q/25779623
tags question: http://stackoverflow.com/q/25823552
tags question: http://stackoverflow.com/q/25785956
tags question: http://stackoverflow.com/q/25742148
tags question: http://stackoverflow.com/q/25758283
tags question: http://stackoverflow.com/q/25738350

http://stackoverflow.com/a/25765814
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25765028
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40292555
has body: Your application program could periodically update a file. The watchdog could check whether that file has been updated recently; if it has not, the watchdog would conclude that the application program has exited, and restart it. The application program could do the updating in a separate daemon thread, to ensure the updates occur regardless of the application load. This can be done using standard Java and so is very portable. Another option is for the application program to find its own process ID (PID), when it starts running, and write that into a file. The watchdog program reads that file to find the PID of the application. It can then periodically examine the list of running processes to check that the application program is still among them. This is more complicated and uses some non portable code. But it can be made to integrate better with the conventional manner of starting and stopping you application program as a daemon on Unix computers, because such daemons conventionally write their PID into a file anyway. You have specified that the watchdog program must be in Java. If you run it on Unix and you are willing to write it as a shell script, it can be written very easilly, and a manner that will avoid the problems of using PID files and scanning the process list.
answers question: http://stackoverflow.com/q/25765028

http://stackoverflow.com/a/53746299
has body: If you want to override values specified in your application.properties file, you can change your active profile while you run your application and create an application properties file for the profile. So, for example, let's specify the active profile "override" and then, assuming you have created your new application properties file called "application-override.properties" under /tmp, then you can run java -jar yourApp.jar --spring.profiles.active="override" --spring.config.location="file:/tmp/,classpath:/" The values especified under spring.config.location are evaluated in reverse order. So, in my example, the classpat is evaluated first, then the file value. If the jar file and the "application-override.properties" file are in the current directory you can actually simply use java -jar yourApp.jar --spring.profiles.active="override" since Spring Boot will find the properties file for you
score: 3
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/25855795
has comment: http://stackoverflow.com/comment/96211635
downvote count: 0
has comment: http://stackoverflow.com/comment/111043887

http://stackoverflow.com/a/25811590
type: Answer
answers question: http://stackoverflow.com/q/25792526
has comment: http://stackoverflow.com/comment/40377636
score: 0
has body: Have you tried like this? Is it not executing in sequence? //This method will provide data to any test method that declares that its Data Provider //is named "test1" @DataProvider(name = "test1") public Object[][] createData1() { return new Object[][] { { "laptop", "Lg" }, { "laptop", "Samsung"}, { "laptop", "Toshiba"}, { "TV", "Lg" }, { "TV", "Samsung"}, { "TV", "Toshiba"}, }; } //This test method declares that its data should be supplied by the Data Provider //named "test1" @Test(dataProvider = "test1") public void verifyData1(String device, String brand) { System.out.println(device + " " + brand); }

http://stackoverflow.com/q/25828425
score: 1
has answer: http://stackoverflow.com/a/46827173
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/26926875
has title: Jersey REST 2.0 Asynchronous request failed in the underlying container (Tomcat 7)
type: Question
has comment: http://stackoverflow.com/comment/69510012
tagged with: tomcat
has answer: http://stackoverflow.com/a/51591175
downvote count: 0
tagged with: jersey-2.0
has answer: http://stackoverflow.com/a/26308121
favorite count: 0
has body: I'm curious if anyone has been able to resolve this issue yet? I've done some searching but it still seems like it's an outstanding issue with Jersey 2 async REST implementation. I have the following code: @Path("myresource") public class MyResource { @GET @Produces(MediaType.TEXT_PLAIN) public void asyncGet(@Suspended final AsyncResponse asyncResponse) { new Thread(new Runnable() { @Override public void run() { String result = veryExpensiveOperation(); asyncResponse.resume(result); } private String veryExpensiveOperation() { return "got it too"; } }).start(); } } I'm using Servlet 3.0 so no web.xml ... Tomcat version is 7.0.54 and I have added the following line to server.xml <Connector connectionTimeout="20000" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/> This was a Jersey Maven project so I have commented in the following jersey-container-servlet and commented out jersey-container-servlet-core I'm not sure what else I can do here, this is the stacktrace javax.servlet.ServletException: javax.ws.rs.ProcessingException: Attempt to suspend a connection of an asynchronous request failed in the underlying container. org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:391) org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:381) org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:344) org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:221) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) root cause javax.ws.rs.ProcessingException: Attempt to suspend a connection of an asynchronous request failed in the underlying container. org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:312) org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:103) org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:271) org.glassfish.jersey.internal.Errors$1.c…
tagged with: rest
type: UnansweredQuestion
tagged with: maven
answer count: 4

http://stackoverflow.com/q/25863256
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25863995
has body: In my app ,there is an one button which get input from database.When I press it more than one in a short time it crashes. How can i avoid this error with using asynctask? show.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub showinf(); } }); } private String[] columns={"name","surname"}; private void showinf(){ SQLiteDatabase db=v1.getReadableDatabase(); Cursor c=db.query("infos",columns,null,null, null,null,null); Random mn2=new Random(); int count=c.getCount(); String mn=String.valueOf(count); int i1=mn2.nextInt(count+1); c.move(i1); t1.setText(c.getString(c.getColumnIndex("name"))); t2.setText(c.getString(c.getColumnIndex("surname"))); } thanks...
has title: Android AsyncTask runs multiple times
type: Question
accepted answer: http://stackoverflow.com/a/25863293
upvote count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25863293
answer count: 3
tagged with: android
possible better answer: http://stackoverflow.com/a/25863995
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/40470533
has answer: http://stackoverflow.com/a/25863429
has comment: http://stackoverflow.com/comment/40470594
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40470620

http://stackoverflow.com/comment/40485024
comment on: http://stackoverflow.com/q/25871228
has text: What result do you expect?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40452149
comment on: http://stackoverflow.com/q/25853102
score: 0
type: Comment
has text: possible duplicate of [How to execute system commands (linux/bsd) using Java](http://stackoverflow.com/questions/792024/how-to-execute-system-commands-linux-bsd-using-java)
type: QuestionComment

http://stackoverflow.com/comment/40348117
comment on: http://stackoverflow.com/q/25796095
has text: 1) You will want to create and post a very small and in fact [minimal example program](http://stackoverflow.com/help/mcve), one we can run, test, and hopefully improve. 2) Out of curiosity, w hy are you using a Canvas, an AWT component, with a Swing GUI?
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40320859
comment on: http://stackoverflow.com/a/25781185
score: 0
type: Comment
has text: I need to have only one object and when all the data has been collected need to collect them separately. Actually I am developing an ebook reader(pagination part). The object will hold the text,images and once data is loaded for a page, they need to store, and fill the data again for empty object.
type: AnswerComment

jasper-reports
tags question: http://stackoverflow.com/q/25765263
tags question: http://stackoverflow.com/q/25853682
tags question: http://stackoverflow.com/q/25753854
tags question: http://stackoverflow.com/q/25762900
tags question: http://stackoverflow.com/q/25717189
tags question: http://stackoverflow.com/q/25718261
tag name: jasper-reports
type: Tag
tags question: http://stackoverflow.com/q/25786219
tags question: http://stackoverflow.com/q/25842748

http://stackoverflow.com/comment/40233398
comment on: http://stackoverflow.com/q/25732993
type: Comment
type: QuestionComment
has text: @Rob: That solves the runtime error. However, the value populated is still `null` and not the value in the properties file.
score: 0

http://stackoverflow.com/a/25752015
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25751909
answers question: http://stackoverflow.com/q/25751909
type: AcceptedAnswer
downvote count: 0
has body: You need to check the length of each String before trying to access its i'th character : StringBuilder sb = new StringBuilder(); int index = 0; boolean maxLengthReached = false; while (!maxLengthReached) { maxLengthReached = true; for (String str : input) { if (index &lt; str.length) { sb.append(str.charAt(index)); maxLengthReached = false; } } index++; } return sb.toString(); Just to clarify, I'm using a boolean maxLengthReached to determine when the last character of the longest String is appended to the output. If in a full iteration over all the Strings in the input array we don't find any String long enough to have charAt(index), we know we are done.
type: Answer
has comment: http://stackoverflow.com/comment/40268200
score: 5

http://stackoverflow.com/comment/40409470
score: 0
comment on: http://stackoverflow.com/q/25829683
type: Comment
type: QuestionComment
has text: Then post an example for which expression it doesn't work.

http://stackoverflow.com/q/25740103
has answer: http://stackoverflow.com/a/39101536
downvote count: 0
type: UnansweredQuestion
has title: JavaFX: what is the difference between EventHandler and EventFilter?
type: Question
has answer: http://stackoverflow.com/a/30481618
tagged with: java
has body: I've been googling for a while and I found that basicly, some web pages says there are no big differences. Except for some points: EventFilter is executed before EventHandler EventFilter is not sensible to event.Consume(); Let me see If I've understood it: Lets say I have: Button b= new Button("Test"); b.addEventHandler(.....){...}; b.addEventFilter(......){...}; Let's say they are both "linked" to an MouseEvent.MOUSE_CLICKED; then, EventFilter's code will be the first to be executed!? Let's say, now, I have: Button b= new Button("Test"); b.addEventHandler(.....); b.addEventFilter(......){ //some code event.consume(); }; // First filter b.addEventFilter(......){ //some other code event.consume(); }; // Second filter In this case, boath EventFilters will be executed but the EventHandler will not. Right? Are there any other things to know? Are there situations where I should prefere one or other? should I sometimes use them together in order to solve some problems? Thank you!
has answer: http://stackoverflow.com/a/36115161
score: 27
has answer: http://stackoverflow.com/a/45578854
has answer: http://stackoverflow.com/a/29370950
linked to: http://stackoverflow.com/q/40731195
answer count: 6
favorite count: 0
has answer: http://stackoverflow.com/a/52610158
tagged with: events
upvote count: 27

sql-server
tags question: http://stackoverflow.com/q/25821141
tags question: http://stackoverflow.com/q/25790809
type: Tag
tags question: http://stackoverflow.com/q/25841190
tags question: http://stackoverflow.com/q/25864395
tag name: sql-server
tags question: http://stackoverflow.com/q/25722611
tags question: http://stackoverflow.com/q/25815358
tags question: http://stackoverflow.com/q/25733258
tags question: http://stackoverflow.com/q/25726532
tags question: http://stackoverflow.com/q/25860589

http://stackoverflow.com/q/25749032
has body: I'm a new user of VisualVM; nice tool, but i'm currently not able to use the profile and check what variables are allocated. Here is the problem. In order to use the profile i have to make a calibration, that was not done at the first VisualVM start. First, i tried to go in Tools/Options on the main menu, then I've clicked on Manage. After this i've selected the JDK i'm currently using with my Eclipse Kepler IDE. The selected file is located in G:\JavaJdk\jdk1.7.0_67\bin\java.exe. When i click on calibrate, VisualVM stucks saying "Connecting to the target VM". Nothing happens: by clicking on Cancel in get an empty window that says "Data transfer error during instrumentation calibration", and after this another window titler "Error" with no error displayed. Launching a java process and clicking on it from the main VisualVM window I'am able to click on the Profiler Tab: clicking on the Memory button it says that a calibration must be performed, so i click the Ok button but it stucks again at the connection step. Clicking on Cancel i get the same data transfer error, and then "Profile calibration data file does not exists", the machinedata.jdk17 file cannot be found. My OS is Windows XP, and the VisualVM version is 1.3.8. I've closed sjype, antivirus, Apache, and disabled windows firewall Please tell me if you need any detail.
answer count: 2
has comment: http://stackoverflow.com/comment/40262230
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/72528984
has comment: http://stackoverflow.com/comment/40262044
has comment: http://stackoverflow.com/comment/40262333
tagged with: visualvm
has answer: http://stackoverflow.com/a/38685359
upvote count: 3
type: UnansweredQuestion
has title: VisualVM cannot perform profiling under Windows XP
has answer: http://stackoverflow.com/a/25766234
has comment: http://stackoverflow.com/comment/64745471
type: Question
score: 3
linked to: http://stackoverflow.com/q/39858872
tagged with: java

http://stackoverflow.com/a/25842503
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25842447
score: 2
downvote count: 0
has body: public class RRequestHelper { DefaultHttpClient httpClient; HttpContext localContext; private String ret; HttpResponse response = null; HttpPost httpPost = null; HttpGet httpGet = null; public RRequestHelper() { this.setDefaultOptions(); } public void setDefaultOptions() { HttpParams myParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(myParams, RGeneralSettings.getInstance().getSettingInt(RConstants.CONNECTION_TIMEOUT, false)); HttpConnectionParams.setSoTimeout(myParams, RGeneralSettings.getInstance().getSettingInt(RConstants.CONNECTION_TIMEOUT, false)); httpClient = new DefaultHttpClient(myParams); localContext = new BasicHttpContext(); } public void clearCookies() { httpClient.getCookieStore().clear(); } public void abort() { try { if (httpClient != null) { System.out.println("Abort."); httpPost.abort(); } } catch (Exception e) { System.out.println("Your App Name Here" + e); } } public String sendPost(String url, String data) { return sendPost(url, data, null); } public String sendJSONPost(String url, JSONObject data) { return sendPost(url, data.toString(), "application/json"); } public String sendPost(String url, String data, String contentType) { ret = null; httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.RFC_2109); httpPost = new HttpPost(url); response = null; StringEntity tmp = null; Log.d("Your App Name Here", "Setting httpPost headers"); httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:32.0) Gecko/20100101 Firefox/32.0"); httpPost.setHeader("Accept", "text/html,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"); if (contentType != null) { httpPost.setHeader("Content-Type", contentType); } else { httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded"); } try { tmp = new StringEntity(data,"UTF-8"); } catch (UnsupportedEncodingException e) { Log.e("Your App Name Here", "HttpUtils : UnsupportedEncodingException : "+e); } httpPos…

http://stackoverflow.com/a/25870678
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40503596
upvote count: 3
has comment: http://stackoverflow.com/comment/40517189
answers question: http://stackoverflow.com/q/25870635
has body: The args are optional command line values. java MyProgram --arg1 --arg2 could be accessed as args[0] == "--arg1" args[1] == "--arg2"
type: Answer

http://stackoverflow.com/comment/40432616
has text: Why would one import Object????
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25842228

linux
tags question: http://stackoverflow.com/q/25731356
tags question: http://stackoverflow.com/q/25829870
tags question: http://stackoverflow.com/q/25771575
tags question: http://stackoverflow.com/q/25825864
tags question: http://stackoverflow.com/q/25828259
tags question: http://stackoverflow.com/q/25815633
tags question: http://stackoverflow.com/q/25724387
tags question: http://stackoverflow.com/q/25862879
tags question: http://stackoverflow.com/q/25781750
tags question: http://stackoverflow.com/q/25732741
tags question: http://stackoverflow.com/q/25842079
tags question: http://stackoverflow.com/q/25828829
tags question: http://stackoverflow.com/q/25809069
tags question: http://stackoverflow.com/q/25765114
type: Tag
tags question: http://stackoverflow.com/q/25797802
tag name: linux
tags question: http://stackoverflow.com/q/25827652
tags question: http://stackoverflow.com/q/25825854
tags question: http://stackoverflow.com/q/25714309
tags question: http://stackoverflow.com/q/25840304
tags question: http://stackoverflow.com/q/25829130
tags question: http://stackoverflow.com/q/25717604
tags question: http://stackoverflow.com/q/25817092
tags question: http://stackoverflow.com/q/25823945
tags question: http://stackoverflow.com/q/25779952
tags question: http://stackoverflow.com/q/25818055
tags question: http://stackoverflow.com/q/25853102
tags question: http://stackoverflow.com/q/25803002
tags question: http://stackoverflow.com/q/25734656
tags question: http://stackoverflow.com/q/25729674
tags question: http://stackoverflow.com/q/25781168
tags question: http://stackoverflow.com/q/25767503
tags question: http://stackoverflow.com/q/25715067

http://stackoverflow.com/q/25847322
answer count: 1
score: 0
tagged with: polymorphism
has title: Eclipse says "selection does not contain a main type" when there's no coding errror
accepted answer: http://stackoverflow.com/a/25847578
has comment: http://stackoverflow.com/comment/40441606
has comment: http://stackoverflow.com/comment/40441788
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40925168
tagged with: java
has body: When I was done with my java coding after checking there's no errors and ran it, eclipse told me that "selection does not contain a main type". I have gone through checking public static void main(String[] args){ and it is correct. I have also searched for some similar problems others encountered, and it seems that I did not find any solutions which could fit in mine. Hope you guys can help my figure it out, will greatly appreciate if any! Here's my coding as follow: import java.util.Random; class Shape { protected Color color; protected Point point; public Shape (Color color, Point point) { this.color = color; this.point = point; } public String Type(){return " ";} } class Rectangle extends Shape{ public Rectangle(Color color, Point point){ super(color, point);} public String Type(){return "Rectangle";} } class Triangle extends Shape{ public Triangle(Color color, Point point){ super(color, point); } public String Type(){return "Triangle";} } class Eclipse extends Shape{ public Eclipse(Color color, Point point){ super(color, point);} public String Type(){return "Eclipse";} } public class ShapeTest{ public static void main(String[] args){ Color color = new Color(50, 100, 150); Point point = new Point(50,50); Shape[] theShape = { new Rectangle(color, point), new Triangle(color, point), new Eclipse(color, point) }; Shape shapechoice; Random select = new Random(); for (int i = 0; i &lt; 10; i ++) { shapechoice = theShape[select.nextInt(theShape.length)]; System.out.println("The " + (i + 1) + "type you chose is: " + shapechoice.Type());; } } }
type: Question
has answer: http://stackoverflow.com/a/25847578

http://stackoverflow.com/comment/40239653
type: Comment
has text: Possibly your are not doing it on EDT thread
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25736443

http://stackoverflow.com/comment/40366649
score: 1
type: QuestionComment
has text: If you use a `Map` and a `HashMap`, the answer is: you can't.
comment on: http://stackoverflow.com/q/25805914
type: Comment

http://stackoverflow.com/a/25855949
has body: The method arrlist.remove(idx) takes as paramenter the (interger) index of the element to be removed from the array. There's no such thing as a "key" for ArrayLists. You probably want to use java.util.Map&lt;Integer,Namer&gt;.
answers question: http://stackoverflow.com/q/25855883
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40457293

http://stackoverflow.com/q/25767825
has comment: http://stackoverflow.com/comment/88316539
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40299593
has title: Reading system time in CST time zone using Java
linked to: http://stackoverflow.com/q/2891361
linked to: http://stackoverflow.com/q/38922754
downvote count: 0
has answer: http://stackoverflow.com/a/25767985
favorite count: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/48982182
has comment: http://stackoverflow.com/comment/40296157
has answer: http://stackoverflow.com/a/48982182
has answer: http://stackoverflow.com/a/32472605
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/40300077
accepted answer: http://stackoverflow.com/a/25767985
has body: I am trying to read the system date in CST time zone using Java. I tried the below code but whenever I use formatter.parse() it is returning time in EST time zone. private Date getTodayInCST() { Calendar currentdate = Calendar.getInstance(); DateFormat formatter = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); TimeZone obj = TimeZone.getTimeZone("CST"); formatter.setTimeZone(obj); String today = formatter.format(currentdate.getTime()); try { return formatter.parse(today); } catch (ParseException e) { e.printStackTrace(); } return null; }
type: Question

http://stackoverflow.com/comment/40319637
has text: Sorry . I have never used fiddle.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25780389

clr
type: Tag
tags question: http://stackoverflow.com/q/25854603
tag name: clr

http://stackoverflow.com/a/25831722
has body: Your activity's context will remain valid until you call super.finish(). So don't call it until you're done. If you can't do that, use the application context.
score: 1
answers question: http://stackoverflow.com/q/25831683
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40468028
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25856035
has text: I'm using netty 4.0.23.Final, and there is no problem with receiving data by server but by client, using this construction above I'm not getting any response. On server I can read data, process it, and send back response, event when I try to do context.write("Test") in client I'm not getting any data.
type: AnswerComment

http://stackoverflow.com/a/25839464
has body: Have you tried this suggestion: Unable instantiate android.gms.maps.MapFragment? "Try right-clicking on your project in Eclipse, select Android Tools > Add Support Library. In my case it was a stale version taken from ActionBarSherlock."
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25839336
has comment: http://stackoverflow.com/comment/40450018
has comment: http://stackoverflow.com/comment/40427777

http://stackoverflow.com/comment/40328690
has text: Unknown host. Try http:// at the beginning...
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25785609
type: QuestionComment

http://stackoverflow.com/comment/40235210
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25733809
type: AnswerComment
has text: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient [reputation](http://stackoverflow.com/help/whats-reputation) you will be able to [comment on any post](http://stackoverflow.com/help/privileges/comment).

http://stackoverflow.com/a/25763524
type: Answer
answers question: http://stackoverflow.com/q/25763319
has comment: http://stackoverflow.com/comment/40289154
has comment: http://stackoverflow.com/comment/40291221
has body: Not sure why you need it but you can add the D AFTER you fetched the data (String id = "D" + autoIncId;). You can't insert a string or anything in an autoincrement field and I can't see anyway this can be useful (all the recorde will have a D, so no one has). If you want to declare a row default, you can add a boolean column named DEFAULT. while(rs.next()){ String id = rs.getBoolean("DEFAULT")?"D":"ND"; id+=rs.getLong(1); } EDIT As per your comment I understand that you want to select the max ID and add 1 to it. Then it's ok to use an autoincrement field in your DB and it must be a number type (INTEGER, BIGINT...). Please FORGET to add the "D" to your primary key, it will simply not going to work as you want. The autoincrement takes the last inserted ID and adds 1 to it. If your last id is "D3" adding 1 has the same meaning as adding 4 to "apple". You are using different types. There is no way for SQL or any other programming language to understand that if you add 1 to "D3" it should become "D4". What you need to do is get rid of that D (which purpose I still don't understand).
score: 0

http://stackoverflow.com/comment/40339791
comment on: http://stackoverflow.com/q/25772114
has text: Also, fileStart should be the starting rule, because it's the first one defined.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25773355
has answer: http://stackoverflow.com/a/25776472
score: 0
has title: How do I edit the property file that my osgi managed service implementation uses?
answer count: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25776472
type: AnsweredQuestion
type: Question
tagged with: osgi
has body: I am using Apache Felix as my OSGi framework implementation. I have a class that is implementing ManagedService in order to get properties from a file using the ConfigAdmin service. I am able to manually edit the properties file and receive updates in my managed service. How do I edit the properties in this file from my managed service? Editing the Dictionary that I get from the update method has no effect.
tagged with: properties
tagged with: config

servlets
tags question: http://stackoverflow.com/q/25838503
tags question: http://stackoverflow.com/q/25762093
tags question: http://stackoverflow.com/q/25862150
tags question: http://stackoverflow.com/q/25818055
tags question: http://stackoverflow.com/q/25830067
tags question: http://stackoverflow.com/q/25764529
tags question: http://stackoverflow.com/q/25719195
tags question: http://stackoverflow.com/q/25755743
tags question: http://stackoverflow.com/q/25849407
tags question: http://stackoverflow.com/q/25815294
tags question: http://stackoverflow.com/q/25797959
tags question: http://stackoverflow.com/q/25839345
tags question: http://stackoverflow.com/q/25836171
tags question: http://stackoverflow.com/q/25808785
tags question: http://stackoverflow.com/q/25753916
tags question: http://stackoverflow.com/q/25872068
tags question: http://stackoverflow.com/q/25873446
tags question: http://stackoverflow.com/q/25803384
tags question: http://stackoverflow.com/q/25818119
tags question: http://stackoverflow.com/q/25775604
tags question: http://stackoverflow.com/q/25728128
tags question: http://stackoverflow.com/q/25868944
tags question: http://stackoverflow.com/q/25852787
tags question: http://stackoverflow.com/q/25868510
tags question: http://stackoverflow.com/q/25800313
tags question: http://stackoverflow.com/q/25812885
tags question: http://stackoverflow.com/q/25830870
tags question: http://stackoverflow.com/q/25725035
tags question: http://stackoverflow.com/q/25727578
tags question: http://stackoverflow.com/q/25736801
tags question: http://stackoverflow.com/q/25784833
tags question: http://stackoverflow.com/q/25780037
tags question: http://stackoverflow.com/q/25788501
tags question: http://stackoverflow.com/q/25763711
tags question: http://stackoverflow.com/q/25792225
tags question: http://stackoverflow.com/q/25842475
tags question: http://stackoverflow.com/q/25861119
tags question: http://stackoverflow.com/q/25776968
tags question: http://stackoverflow.com/q/25852152
tags question: http://stackoverflow.com/q/25731735
tags question: http://stackoverflow.com/q/25782961
tags question: http://stackoverflow.com/q/25806157
tags question: http://stackoverflow.com/q/25852629
tags question: http://stackoverflow.com/q/25839603
tags question: http://stackoverflow.com/q/25807013
tags question: http://stackoverflow.com/q/25780733
tags question: http://stackoverflow.com/q/25869884
tags question: http://stackoverflow.com/q/25844873
tags question: http://stackoverflow.com/q/25795541
tags question: http://stackoverflow.com/q/25725675
tags question: http://stackoverflow.com/q/25790992
tags question: http://stackoverflow.com/q/25757418
tags question: http://stackoverflow.com/q/25837461
tags question: http://stackoverflow.com/q/25715864
tags question: http://stackoverflow.com/q/25767110
tags question: http://stackoverflow.com/q/25786475
tags question: http://stackoverflow.com/q/25720308
tags question: http://stackoverflow.com/q/25864194
tags question: http://stackoverflow.com/q/25786145
tags question: http://stackoverflow.com/q/25856859
tag name: servlets
tags question: http://stackoverflow.com/q/25870528
tags question: http://stackoverflow.com/q/25718053
tags question: http://stackoverflow.com/q/25794520
tags question: http://stackoverflow.com/q/25841391
tags question: http://stackoverflow.com/q/25785997
tags question: http://stackoverflow.com/q/25786909
tags question: http://stackoverflow.com/q/25758308
type: Tag
tags question: http://stackoverflow.com/q/25764351
tags question: http://stackoverflow.com/q/25747486
tags question: http://stackoverflow.com/q/25760433
tags question: http://stackoverflow.com/q/25774095
tags question: http://stackoverflow.com/q/25769531
tags question: http://stackoverflow.com/q/25733449
tags question: http://stackoverflow.com/q/25759972
tags question: http://stackoverflow.com/q/25789709
tags question: http://stackoverflow.com/q/25842424
tags question: http://stackoverflow.com/q/25854077
tags question: http://stackoverflow.com/q/25784987

http://stackoverflow.com/q/25800895
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25803828
type: Question
has title: Unable to link a column in datatables
has body: <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> Populating JSP id salary I have 2 coulmns, ID and Salary. I am linking the salary to google.com, for that I am using fnRowCallback function. But that doesn't seem to work. Where do you think I am going wrong. The jsp is shown above.
tagged with: datatables
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40357195
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40357551

http://stackoverflow.com/comment/40218963
type: Comment
has text: Put yourself in the position of the computer and work through the loop. Pay special attention to the `if (value == ...)` checks.
comment on: http://stackoverflow.com/q/25725910
score: 0
type: QuestionComment

http://stackoverflow.com/a/25766834
has comment: http://stackoverflow.com/comment/40306958
has body: If you are not using Spring or some other third party library that offers seamless integration with MongoDB you could use MongoJack as a jackson mapper. Step 1 - the maven dependency: org.mongojack mongojack 2.1.0 bundle Step 2 - the repository: oss-sonatype oss-sonatype https://oss.sonatype.org/content/repositories/snapshots/ true Step 3 - mapping POJOs: public class MyObject { private String id; @ObjectId @JsonProperty("_id") public String getId() { return id; } @ObjectId @JsonProperty("_id") public void setId(String id) { this.id = id; } } Step 4 - inserting: JacksonDBCollection<MyObject, String> coll = JacksonDBCollection.wrap(dbCollection, MyObject.class, String.class); MyObject myObject = ... WriteResult<MyObject, String> result = coll.insert(myObject); String id = result.getSavedId(); MyObject savedObject = result.getSavedObject(); Step 5 - query: MyObject foundObject = coll.findOneById(id); Other examples and detailed explanation for the above can be found on the MongoJack official website And as a side-note, if Spring is an option for you please take a look at the Spring-Data-MongoDB Project EDIT: After reading a bit i found out that the mapper you are using is in fact an older version of MongoJack. So upgrading your code to use an updated version of it would surely benefit your project.
answers question: http://stackoverflow.com/q/25746697
has comment: http://stackoverflow.com/comment/40306288
score: 0
type: Answer

http://stackoverflow.com/q/25772222
has body: Can anyone tell me where can I find the default port number for JBoss EAP 6.0.1 and how I can change it? If there is a file I can edit, I would much prefer that than change it in Eclipse or something.
has title: Change port number in JBoss EAP 6.0.1
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/25772301
downvote count: 0
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25772301
tagged with: jboss
upvote count: 3
has answer: http://stackoverflow.com/a/26361899
favorite count: 0
tagged with: port
possible better answer: http://stackoverflow.com/a/26361899

http://stackoverflow.com/q/25759723
tagged with: spring-mvc
type: Question
has comment: http://stackoverflow.com/comment/40282422
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40284926
score: 0
has comment: http://stackoverflow.com/comment/40281706
answer count: 1
has body: I am new to spring mcv and I have created a spring mvc, java and hibernate project. I used spring mvc 4 release. Now I am practising how to make one to one relationship in hibernate. There isonly one configuration xml other than mvc-dispatcher-servlet.xml and web.xml. It is hibernate.cfg.xml file. These are the two classes I have written. package lk.ddarz4u.sales.database; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToOne; @Entity public class Agency { @Id private String agencyId; private String agencyName; @OneToOne private Shipment shipment; public Shipment getShipment() { return shipment; } public void setShipment(Shipment shipment) { this.shipment = shipment; } public String getAgencyId() { return agencyId; } public void setAgencyId(String agencyId) { this.agencyId = agencyId; } public String getAgencyName() { return agencyName; } public void setAgencyName(String agencyName) { this.agencyName = agencyName; } } and this is Shipment class package lk.ddarz4u.sales.database; import javax.persistence.*; import java.util.Date; @Entity public class Shipment { @Id private String shipmentId; private int Quantity; @Temporal(TemporalType.DATE) private Date updateDate; public String getShipmentId() { return shipmentId; } public void setShipmentId(String shipmentId) { this.shipmentId = shipmentId; } public int getQuantity() { return Quantity; } public void setQuantity(int quantity) { Quantity = quantity; } public Date getUpdateDate() { return updateDate; } public void setUpdateDate(Date updateDate) { this.updateDate = updateDate; } } I have written a test class for these two. package lk.ddarz4u.sales.database; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import java.util.Date; public class Test_one_to1 { public static void main() { Date date=new Date(); Shipment shipment = new Shipment(); shipment.setQuantity(45); shipment.setShipmentId("s1"); shipment.setUpdateDate(da…
has title: Unknown entity exception
type: UnansweredQuestion
tagged with: hibernate-mapping
tagged with: spring
has answer: http://stackoverflow.com/a/39038169

http://stackoverflow.com/comment/40747325
has text: No, the openOrders call returns all orders that are active on the exchanged (i.e unfilled and partially filled). The getTransactions call returns all executed trades, and this list can be limited by number of transactions to be returned.
score: 0
comment on: http://stackoverflow.com/q/25864740
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25853580
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25853669
score: 0
has comment: http://stackoverflow.com/comment/40452871
has answer: http://stackoverflow.com/a/25853665
has comment: http://stackoverflow.com/comment/40453147
possible better answer: http://stackoverflow.com/a/25853669
tagged with: http://stackoverflow.com/tag/xml
has body: I have an XML document, that looks like this (I know, it doesn't make sense, it's just an example): <Person> Peter Sweden <Person/> It can have an infinit number of the element Param. Getting the content of Country I do String country = doc.getElementsByTagName("Country").item(0).getTextContent(); Getting the content of the first attribute name of the first Param I do String name = source.getElementsByTagName("Param").item(0).getAttributes().item(0).getNodeValue(); But how can I get all values of all the attributes of Param, without knowing how many elements of Param exist? I need something like ("pseudo code"): HashMap<String, String> hm = new HashMap<String, String>(); for(int i=0; i<=source.getElementsByTagName("Param").size(); i++){ String name = source.getElementsByTagName("Param").item(i).getAttributes().item(0).getNodeValue(); String value = source.getElementsByTagName("Param").item(i).getAttributes().item(1).getNodeValue(); hm.put(name, value); }
has title: Getting all elements
tagged with: sax
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25853665
tagged with: java

http://stackoverflow.com/a/25820929
has comment: http://stackoverflow.com/comment/40458171
downvote count: 0
has comment: http://stackoverflow.com/comment/40663914
has comment: http://stackoverflow.com/comment/40549853
type: Answer
has comment: http://stackoverflow.com/comment/40559386
has comment: http://stackoverflow.com/comment/40536588
has comment: http://stackoverflow.com/comment/40662994
has comment: http://stackoverflow.com/comment/40587936
accepted answer of: http://stackoverflow.com/q/25813974
has comment: http://stackoverflow.com/comment/40550409
answers question: http://stackoverflow.com/q/25813974
has comment: http://stackoverflow.com/comment/40454052
has comment: http://stackoverflow.com/comment/40522817
has comment: http://stackoverflow.com/comment/40421931
has comment: http://stackoverflow.com/comment/40509621
has comment: http://stackoverflow.com/comment/40592576
has comment: http://stackoverflow.com/comment/40523502
has body: You'll have to re-add all your dependencies, including appcompat. If you have all the jars, you can put them in the libs/ directory of the app when using a dependency like this in the app's build.gradle (projectdir/app/build.gradle): compile fileTree(dir: 'libs', include: ['*.jar']) The other and preferred option is to declare dependencies in Maven-coordinates, like below (excerpt from the app's build.gradle file): dependencies { compile 'com.android.support:appcompat-v7:19.1.0' compile 'com.google.android.gms:play-services:4.2.42' compile 'org.apache.commons:commons-lang3:3.2.+' }
has comment: http://stackoverflow.com/comment/40537064
has comment: http://stackoverflow.com/comment/40421623
score: 4
has comment: http://stackoverflow.com/comment/40602429
has comment: http://stackoverflow.com/comment/40640291
upvote count: 4
has comment: http://stackoverflow.com/comment/40523867
has comment: http://stackoverflow.com/comment/40550063
has comment: http://stackoverflow.com/comment/40565209
type: AcceptedAnswer

http://stackoverflow.com/q/25835983
answer count: 2
has comment: http://stackoverflow.com/comment/40421334
favorite count: 0
has comment: http://stackoverflow.com/comment/40421539
has comment: http://stackoverflow.com/comment/40420937
has answer: http://stackoverflow.com/a/25836157
has comment: http://stackoverflow.com/comment/40421597
has body: I'm stuck at this java.lang.ClassException. In general, I'm trying with a simple method maxElement() that simply returns the highest Integer, the add() method works perfectly as well as overriding toString(), this last 2 methods are inherited from ArrayLinearList&lt;T&gt;. element is an array . ArrayLinearList does work perfectly as well .This is my code: public class ArrayLinearList&lt;T&gt; implements LinearList&lt;T&gt;, Iterable&lt;T&gt;{ protected T[] element; protected int size; *constructors and methods* // default constructor makes an T[]element of length 10 } public class ArrayLinearListTaller1&lt;T extends Comparable&lt;T&gt;&gt; extends ArrayLinearList&lt;T&gt;{ public static void main(String[] args) { ArrayLinearListTaller1&lt;Integer&gt;x=new ArrayLinearListTaller1&lt;Integer&gt;(); x.add(0, new Integer(10)); x.add(1, new Integer(5)); x.add(2, new Integer(7)); System.out.println(x); System.out.println(x.maxElement()); }// end of main public T maxElement() { Arrays.sort(element,0,size); T max= element[size-1];//*error here* return max; } This is what I get: [10,5,7] Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.Comparable;
type: UnansweredQuestion
downvote count: 2
upvote count: 1
type: Question
has title: java.lang.Object; cannot be cast to [java.lang.comparable]
has answer: http://stackoverflow.com/a/25836212
has comment: http://stackoverflow.com/comment/40421560
tagged with: java
score: -1

http://stackoverflow.com/comment/40341562
comment on: http://stackoverflow.com/q/25792058
has text: @dcharms I have a 3d model which should continue to move when I touch the screen. If i keep touching the screen, it should keep moving
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40267592
type: Comment
has text: like it but it just extract 4802740
type: AnswerComment
comment on: http://stackoverflow.com/a/25751915
score: 0

http://stackoverflow.com/q/25866279
has comment: http://stackoverflow.com/comment/40475914
accepted answer: http://stackoverflow.com/a/25866414
tagged with: character-encoding
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/25866428
has body: The documentation for the PrintWriter.print(int) method says: Prints an integer. The string produced by String.valueOf(int) is translated into bytes according to the platform's default character encoding, and these bytes are written in exactly the manner of the write(int) method. Is it really true that it uses the platforms default character encoding? Is the documentation wrong? The documented behaviour makes no sense if the PrintWriter delegates to another Writer (as created by the constructor PrintWriter(Writer)). The claimed behaviour would be surprising for the case of a PrinterWriter that was constructed using a named character encoding (using the constructor PrintWriter(File, String)).
has answer: http://stackoverflow.com/a/25866428
favorite count: 0
has title: Character encoding for PrintWriter.print(int)
upvote count: 1
has answer: http://stackoverflow.com/a/25866414
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/40255063
score: 1
type: AnswerComment
has text: Then have your Activity extend Activity instead of FragmentActivity (you are still able to work with Fragments, provided that you have minSdk 11 or more, FragmentActivity is only there to give devs the ability to use Fragments with older OS versions), your Fragment should extend android.app.Fragment and you should call getFragmentManager in your Activity instead of getSupportFragmentManager.
comment on: http://stackoverflow.com/a/25744919
type: Comment

http://stackoverflow.com/q/25762437
has answer: http://stackoverflow.com/a/25762545
accepted answer: http://stackoverflow.com/a/25762545
has title: Which performs better : for each or iterator in LinkedList?
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40286301
favorite count: 0
has body: I have been checking the performance of for each vs Iterator in traversing LinkedList through a program: public class ListTraversePerformance { public static void main(String... args){ List&lt;String&gt; list = new LinkedList&lt;String&gt;(); for(int i=0;i&lt;100000;i++){ list.add("Any String" + i); } Iterator i = list.iterator(); String x; long t1 = System.currentTimeMillis(); for(String j: list){ x = j; } long t2 = System.currentTimeMillis(); while(i.hasNext()){ x= (String)i.next(); } long t3 = System.currentTimeMillis(); System.out.print((t2-t1) + " " + (t3-t2)); } } The Ouput that i get is different every time i.e. sometimes the first loop run fast and sometimes second. MY QUESTION: I think the for each loop should run slow than the second Iterator. I think in for each loop the linked list should traverse from the beginning every time making its complexity O(n^2) as compared to O(n) complexity of Iterator. Am I Correct? and if yes then why are the results not as I expect...
tagged with: foreach
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40286444
tagged with: linked-list
linked to: http://stackoverflow.com/q/25583297
has comment: http://stackoverflow.com/comment/40286501
tagged with: java
has comment: http://stackoverflow.com/comment/40286455
tagged with: collections
type: Question
tagged with: iterator

http://stackoverflow.com/a/29557651
score: 0
type: AcceptedAnswer
has body: Problem solved by adding: /rest/* to non-secured section of web-resource-collection.
type: Answer
accepted answer of: http://stackoverflow.com/q/25853651
answers question: http://stackoverflow.com/q/25853651

http://stackoverflow.com/comment/40445801
comment on: http://stackoverflow.com/a/25849537
type: AnswerComment
score: 0
type: Comment
has text: Hi Gautam,No url is not getting changed

http://stackoverflow.com/comment/40376085
type: Comment
type: QuestionComment
has text: @user2733436: Understanding the language of set theory (sets, subsets, unions, intersections etc.) is critical for thinking about algorithms like this. I suggest finding an introduction online or in a maths textbook. Luckily, there isn't much to learn :)
comment on: http://stackoverflow.com/q/25811373
score: 0

http://stackoverflow.com/comment/40534497
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25870568
score: 0
has text: If you're writing both the LabVIEW and Java software then the format is up to you. What have you tried so far and what result did you get?

http://stackoverflow.com/q/25768994
score: 0
answer count: 2
has title: In a xml file,How can I get the data in a label depending on another label in the same level of node?
has answer: http://stackoverflow.com/a/25769202
has comment: http://stackoverflow.com/comment/40298418
has body: I have a xml file like the following: test1 test1.com test2 test1.com I want to parsing the file. I could get the name using the dom4j. for(Element doc : docs ){ List<Element> strs = doc.elements(); for(Element str : strs ){ if("name".equals(str.attributeValue("name"))){ System.out.println(str.getText()); } } } How can I get the data of 'uri' after I getting the data of 'name'under the same node 'doc'? Thaks a lot!
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25769227
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
type: Question

http://stackoverflow.com/comment/40334574
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25780200
has text: Post another question, with the code and the complete stack trace of the exception.

http://stackoverflow.com/q/25869768
has comment: http://stackoverflow.com/comment/40482940
has answer: http://stackoverflow.com/a/25869850
has answer: http://stackoverflow.com/a/25869813
answer count: 4
has comment: http://stackoverflow.com/comment/40482336
has comment: http://stackoverflow.com/comment/40482553
possible better answer: http://stackoverflow.com/a/25869813
tagged with: swing
tagged with: jbutton
type: Question
tagged with: actionlistener
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25869850
has title: addActionListener not working
has comment: http://stackoverflow.com/comment/40482257
has comment: http://stackoverflow.com/comment/40483461
has body: I followed a tutorial on how to do this - Here's the code I used: package soundboard; import javax.swing.*; import java.awt.event.*; public class Soundboard { JButton Button1; public void windowCreate() { JFrame frame = new JFrame(); mainsPanel = new JPanel(); Button1 = new JButton("1"); Button1.addActionListener(this); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.add(Button1); frame.add(mainsPanel); frame.setSize(183,245); frame.setVisible(true); frame.setLocationRelativeTo(null); } public void actionPerformed(ActionEvent event){ } public static void main(String[] args){ Soundboard window = new Soundboard(); window.windowCreate(); } } The code seems to not be working. Could anyone explain why? The JPanel is used as a background. The problem is in Button1.addActionListener(this); , as it says that "this" is not convertible to ActionListener or something like so.
has answer: http://stackoverflow.com/a/25870820
has answer: http://stackoverflow.com/a/25869834
score: 0

http://stackoverflow.com/comment/40483557
has text: @MarkoTopolnik i totally agree, i'll add that into documentation, anyway in my case i think its expected... as it is intended to be used in methods where tasks can be executed concurently. And ususally .join() follows... But I understand your point, didnt know about deamon threads before...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25868660

http://stackoverflow.com/a/25781714
has comment: http://stackoverflow.com/comment/40321688
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40321705
has body: Your date is not long enough new Date(1407388499); Sat Jan 17 1970 15:56:28 GMT+0900 (Japan Standard Time) new Date(1407388499000); Thu Aug 07 2014 14:14:59 GMT+0900 (Japan Standard Time) The value should be a Long that is the number of millseconds Edit So if your received number is int dt = 1407388499: Then you need to do Date date = new Date(1000L * dt);
downvote count: 0
answers question: http://stackoverflow.com/q/25781652
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40322161
accepted answer of: http://stackoverflow.com/q/25781652

http://stackoverflow.com/comment/40267950
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25751692
score: 0
has text: I shall do that! Thank you. Why don't ya drop an official answer and I'll choose you. You have been helping me on JavaFX since the day I started several months ago, lol!

http://stackoverflow.com/comment/40359124
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25801746
has text: @gerryluci, since it's a different question, you should post it as a different question. This one will most likely be closed a a simple typographical error anyway.
score: 0

http://stackoverflow.com/q/25754454
favorite count: 0
has body: I can't make the pack() method work. I tried several things. My code looks like this at the moment: Class 1: public static void main( String[] args ) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { JavaGui mygui = new JavaGui(); // mygui.setSize(1154, 753); mygui.setVisible(true); mygui.pack(); Class 2: public class JavaGui extends javax.swing.JFrame { public JavaGui() { getContentPane().setLayout(null); .. getContentPane().add(panelLeft); ... getContentPane().add(panelRight); I tried putting the pack method in everywhere, but it's not going to work with this way of adding gui elements. Any suggestions why? I also tried adding everything to a JFrame instead of the getContentPane(), but I can't make that work either.
type: Question
linked to: http://stackoverflow.com/q/6298998
linked to: http://stackoverflow.com/q/15049058
tagged with: pack
linked to: http://stackoverflow.com/q/21208396
has answer: http://stackoverflow.com/a/25755328
answer count: 3
has answer: http://stackoverflow.com/a/25754473
upvote count: 1
tagged with: swing
linked to: http://stackoverflow.com/q/285793
tagged with: java
has comment: http://stackoverflow.com/comment/40272627
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40272571
has title: Using Java pack() method
downvote count: 0
has answer: http://stackoverflow.com/a/25754616
tagged with: layout-manager
score: 1

http://stackoverflow.com/q/25733427
has title: write FacePrinte in java
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40233944
downvote count: 2
has body: I got an assignment from my teacher and I have to complete it for tomorrow. The assignment is : write a program FacePrinter that prints a face which hopefully looks better than this one. / / / / / | o o | ( | ^ | ) | | | [ __ ] | \ _______ / I already did this one but at the end of the assignment he says : " Your program documentation should include your name, the programming assignment number and a brief description of what the program does " Now my question is what should I write for this part and how can I include my name in the program? Thank you
type: Question
has answer: http://stackoverflow.com/a/25733675
score: -2
has comment: http://stackoverflow.com/comment/40233492
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25733675
favorite count: 0

http://stackoverflow.com/q/25727516
has body: we want to copy active executions (and all related data) to different database. Is there some way that activiti API can help us? I have found API pro deleting, but not for copying. The selection key would be deployment. We have shared workflow engine for multiple applications with multiple processes. Now we want to copy data for one of those application into our test environment, so users can test new release and we can test instance migration. Since we have execution ids in business data in separate database, we need to keep them. Only way how I can imagine this is to split workflow engines and have separate database tables for each application. Then we would be able to simply copy database that is used just for the application. Split can be done quite easily, is we copy full current db and then delete deployments that are not related to current app.
type: UnansweredQuestion
tagged with: activiti
tagged with: java
type: Question
tagged with: database
has answer: http://stackoverflow.com/a/25943086
score: 0
answer count: 1
has title: Activiti : Copy active executions to different db

http://stackoverflow.com/q/25836533
type: Question
accepted answer: http://stackoverflow.com/a/25836611
tagged with: swingbuilder
score: 0
tagged with: groovy
answer count: 1
has answer: http://stackoverflow.com/a/25836611
tagged with: swing
has title: GridBagLayout keeps resizing when entering text in text field
type: AnsweredQuestion
has body: I have a problem getting a GridBagLayout in groovy with SwingBuilder to run. I guess the problem is GridBagLayout and not Groovy, so I assume this would work the same in Java. I have the following simple layout: new SwingBuilder().edt { frame(title: 'test', defaultCloseOperation: JFrame.EXIT_ON_CLOSE, pack: true, show: true) { gridBagLayout() widget(textPane(background: java.awt.Color.RED), constraints: gbc(gridx:0, gridy: 0, weightx: 0.5, weighty: 1, fill: GBC.BOTH, gridheight: GBC.REMAINDER)) widget(textPane(background: java.awt.Color.GREEN), constraints: gbc(gridx: 1, gridy: 0, weightx: 0.5, weighty: 1, fill: GBC.BOTH)) label(text: "test label", background: java.awt.Color.BLUE, opaque: true, constraints: gbc(gridx: 1, gridy: 1, weightx: 0.5, fill: GBC.BOTH)) } } I would like to have a window, with a text pane on the left side taking exactly 50% of the window. On the right side of the windows (the other 50%) another text pane and below that (but only taking minimum required size) a label. The code above works and creates the window I want, but as soon as I begin to type in the left sided text pane, the left side will start to take more space (than 50% of the window). How can I achieve, the above described layout, so the both sided will always be 50:50 no matter what text is entered into the text panes?
tagged with: java

http://stackoverflow.com/comment/40472683
score: 0
type: AnswerComment
has text: @pratim_b Searched for the best solution and casting is not really the best. His question was what will solve his type mismatch, so it is a solution. Btw, it won't work because `instanceof` operator is one word.
type: Comment
comment on: http://stackoverflow.com/a/25847904

http://stackoverflow.com/comment/40453440
score: 1
has text: Have you considered consulting the Javadoc? That is thoughtfully provided for that purpose? And do you have a cogent reason for asking questions about invalid code?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25853371

http://stackoverflow.com/comment/40463236
score: 2
has text: Rather than just giving the solution, how about explaining both the problem and the solution so the answer is useful to future visitors? e.g. `11 / 3 => 3` (why?) and `11 % 3 => 2` (again, why?)
comment on: http://stackoverflow.com/a/25858985
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25768507
has comment: http://stackoverflow.com/comment/40301769
accepted answer of: http://stackoverflow.com/q/25768461
has comment: http://stackoverflow.com/comment/40297514
answers question: http://stackoverflow.com/q/25768461
has comment: http://stackoverflow.com/comment/40299149
has comment: http://stackoverflow.com/comment/40297304
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40299820
score: 0
has body: CDI runs fine in Java EE container e.g. try a webapp, jsp/jsf page inside weblogic In Java SE, you may need to do more What is the easiest way to have CDI and JPA in Java SE? http://blog.rocketscience.io/dependency-injection-with-cdi-in-java-se/ when you do new Printer() who is responsible for injecting stuff in your object?
type: Answer
has comment: http://stackoverflow.com/comment/40298678
has comment: http://stackoverflow.com/comment/40341948

http://stackoverflow.com/q/25827606
score: -1
tagged with: http://stackoverflow.com/tag/xml
has body: i want to sort elements in xml file according to chosen algorithm type by user in java.i have merged xml file which contains 10 xml files. so it will be like first user select type of algorithm and then program sort elements as user wants.how can i do this? pls help me here is how i merged xml files import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileWriter; import java.io.IOException; import java.io.InputStreamReader; public class Merge2 { public static void main(String[] args) { String sourceFile1Path = "C:\\Users\\project\\Numbers1.xml"; String sourceFile2Path = "C:\\Users\\project\\Numbers2.xml"; String sourceFile3Path = "C:\\Users\\project\\Numbers3.xml"; String sourceFile4Path = "C:\\Users\\project\\Numbers4.xml"; String sourceFile5Path = "C:\\Users\\project\\Numbers5.xml"; String sourceFile6Path = "C:\\Users\\project\\Numbers6.xml"; String sourceFile7Path = "C:\\Users\\project\\Numbers7.xml"; String sourceFile8Path = "C:\\Users\\project\\Numbers8.xml"; String sourceFile9Path = "C:\\Users\\project\\Numbers9.xml"; String sourceFile10Path = "C:\\Users\\project\\Numbers10.xml"; String mergedFilePath = "C:\\Users\\project\\mergedXML.xml"; File[] files = new File[10]; files[0] = new File(sourceFile1Path); files[1] = new File(sourceFile2Path); files[2] = new File(sourceFile3Path); files[3] = new File(sourceFile4Path); files[4] = new File(sourceFile5Path); files[5] = new File(sourceFile6Path); files[6] = new File(sourceFile7Path); files[7] = new File(sourceFile8Path); files[8] = new File(sourceFile9Path); files[9] = new File(sourceFile10Path); File mergedFile = new File(mergedFilePath); mergeFiles(files, mergedFile); } public static void mergeFiles(File[] files, File mergedFile) { FileWriter fstream = null; BufferedWriter out = null; try { fstream = new FileWriter(mergedFile, true); out = new BufferedWriter(fstream); } catch (IOException e1) { e1.printStackTrace(); } for (File f : files…
answer count: 1
tagged with: indexing
tagged with: java
has comment: http://stackoverflow.com/comment/40412396
has answer: http://stackoverflow.com/a/25833187
downvote count: 1
upvote count: 0
has comment: http://stackoverflow.com/comment/40405589
tagged with: bubble-sort
tagged with: sorting
type: UnansweredQuestion
has title: sorting elements from xml file in java
type: Question
favorite count: 0

http://stackoverflow.com/q/25851514
score: 0
answer count: 1
has body: I am using AppCompat.Light theme for my application and activities and on Android 4.0+ devices my dialogs are white with black text. There is an issue, however, with Android 2.3.3-4.0 devices which are using the same theme but the dialogs are black and the text is also black making it unreadable. How can I make it so that the dialogs on 2.3.3+ devices are always using a white background?
has comment: http://stackoverflow.com/comment/40596228
tagged with: android
tagged with: android-appcompat
type: UnansweredQuestion
tagged with: java
has title: AppCompat dialog theme
tagged with: android-theme
type: Question
has answer: http://stackoverflow.com/a/30337470

http://stackoverflow.com/a/25744453
type: Answer
downvote count: 1
upvote count: 0
score: -1
has body: As far as my understanding is concerned, usually when we transfer objects, it is the attribute values inside the Student object is what we are require. The Student class should be present on the other side.
answers question: http://stackoverflow.com/q/25744224

http://stackoverflow.com/comment/40211853
type: QuestionComment
comment on: http://stackoverflow.com/q/25722136
has text: instanceof is a sign of bad design. This is what polymorphism is supposed to handle. If you think your code requires it, I would recommend redesigning until it doesn't.
score: 0
type: Comment

http://stackoverflow.com/q/25806492
has body: I just realized when I used the normal (default) theme in android programming, the bottom menu shows good (text + icon). But then,... when I use this code below: The icon dissapeared, and now the bottom menu only showing text, in vertical order. Which part of the Sherlock style theme that i can make the menu appeared as first time I mentioned (icon + text)?
type: UnansweredQuestion
tagged with: android
tagged with: styles
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40366956
type: Question
has title: which Theme that makes the Menu android with / without icon?
tagged with: actionbarsherlock
tagged with: themes
score: 0
has comment: http://stackoverflow.com/comment/40431826
has comment: http://stackoverflow.com/comment/40429508

http://stackoverflow.com/a/26013083
downvote count: 0
answers question: http://stackoverflow.com/q/25751716
type: Answer
upvote count: 1
score: 1
has body: The simplest way to resolve the issue was to upgrade the apache commons httpclient to version 4+. For me, version 4.3.5 worked. Here is the maven entry: org.apache.httpcomponents httpclient 4.3.5 There are also some changes required while fetching the data. The other way, a more complex one, seeks to override the Socket Connection Factory used within the client. I did not try this way, but hope this link helps: https://www.openshift.com/forums/openshift/commons-httpclient-permission-denied
accepted answer of: http://stackoverflow.com/q/25751716
type: AcceptedAnswer

http://stackoverflow.com/comment/40405284
has text: @MadProgrammer yes, it does.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25827289

http://stackoverflow.com/comment/40322778
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25766638
type: Comment
has text: I need for example to be able to add new JDBC drivers and be able to load the driver class from my EAR. Adding new modules seem to require a JBoss restart.I just need to know if it is possible without a restart.

http://stackoverflow.com/comment/40348141
has text: It's giving you a 404 - so the POST is not working. You need to fix that first.
comment on: http://stackoverflow.com/q/25795369
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25787197
favorite count: 0
has answer: http://stackoverflow.com/a/29442864
has comment: http://stackoverflow.com/comment/40331073
answer count: 4
upvote count: 12
downvote count: 0
has comment: http://stackoverflow.com/comment/40331475
has comment: http://stackoverflow.com/comment/88827021
has answer: http://stackoverflow.com/a/34158764
tagged with: maven
tagged with: spring
has answer: http://stackoverflow.com/a/39502221
possible better answer: http://stackoverflow.com/a/25787490
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
has body: When I am trying to create new project on Maven in eclipse IDE ,It shows the following errors: "Could not get the value for parameter encoding for plugin execution default-resources Plugin org.apache.maven.plugins:maven-resources-plugin:2.5 or one of its dependencies could not be resolved: Failed to collect dependencies for org.apache.maven.plugins:maven-resources-plugin:jar:2.5 ()" Anyone please tell what I have to do? can anyone tell me the steps to create Spring project with Maven enabled? POM.xml: 4.0.0 com.spring SpringMaven 0.0.1-SNAPSHOT war SpringMaven
accepted answer: http://stackoverflow.com/a/29442864
score: 12
has title: Error shown when creating new Maven project in Eclipse
has answer: http://stackoverflow.com/a/25787490

http://stackoverflow.com/comment/42388323
type: QuestionComment
comment on: http://stackoverflow.com/q/25796777
has text: This looks a lot better @Gagravarr thanks so much! I'm going to write an answer to help better format the code.
score: 0
type: Comment

http://stackoverflow.com/q/25847779
has comment: http://stackoverflow.com/comment/40442256
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40442177
tagged with: java
accepted answer: http://stackoverflow.com/a/25848240
has title: Java SQLite database, insert entry giving nullPointerException
tagged with: methods
tagged with: eclipse
has answer: http://stackoverflow.com/a/25848240
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/40442472
has comment: http://stackoverflow.com/comment/40442170
tagged with: sqlite
tagged with: jdbc
has body: I am trying to create a generic method that can add an entry into a SQLite database, using Eclipse and Java. When the table name is hardcoded it works fine, but when I try to pass in the table name as a string it is giving me a nullPointerException. below is the method that creates that table: public static void Table() { Connection c = null; Statement stmt = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:test.db"); System.out.println("Opened database successfully"); stmt = c.createStatement(); String sql = "CREATE TABLE IF NOT EXISTS COMPANY " + "(ID INT PRIMARY KEY NOT NULL," + " NAME TEXT NOT NULL, " + " AGE INT NOT NULL, " + " ADDRESS TEXT, " + " SALARY REAL)"; stmt.executeUpdate(sql); stmt.close(); c.close(); } catch ( Exception e ) { System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.exit(0); } System.out.println("Table created successfully"); } and here is the method that inserts an entry into the created table. I want to pass in the table name through the method rather than hard coding it: public static void Insert(String table, int id, String name, int age, String address, String salary) { Connection c = null; PreparedStatement pstmt = null; try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:test.db"); c.setAutoCommit(false); System.out.println("Opened database successfully"); String query="INSERT INTO "+table+" (ID,NAME,AGE,ADDRESS,SALARY) VALUES (?,?,?,?,?)"; PreparedStatement stmt = c.prepareStatement(query); pstmt.setInt(1,id); pstmt.setString(2,name); pstmt.setInt(3, age); pstmt.setString(4, address); pstmt.setString(5, salary); pstmt.executeUpdate(); pstmt.close(); c.commit(); c.close(); } catch ( Exception e ) { System.err.println( e.getClass().getName() + ": " + e.getMessage() ); System.exit(0); } System.out.println("Records created successfully"); }

http://stackoverflow.com/q/25728488
type: UnansweredQuestion
tagged with: spring
tagged with: java
has comment: http://stackoverflow.com/comment/40225382
has comment: http://stackoverflow.com/comment/40224191
type: Question
has title: Spring property placeholder not working inside an import directive
score: 0
has comment: http://stackoverflow.com/comment/40225988
answer count: 0
has body: I have a spring configuration with a property placeholder directive attribute that is not being recognised. I have verified that the actual property can be resolved by creating a simple class that outputs the property: &lt;bean id="propTest" class="com.johnsands.unite.PropertyLogger"&gt; &lt;constructor-arg value="security.configuration"/&gt; &lt;constructor-arg value="${security.configuration}"/&gt; &lt;/bean&gt; This simple bean outputs the given parameters, which it does just fine. But when I try to use that same property in an import, as in the following: &lt;import resource="${security.configuration}"/&gt; I get the following error. org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource [/WEB-INF/spring/root-context.xml]; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'security.configuration' in string value "${security.configuration}" This does not make sense as I have verified the property can be resolved. It also appears that the directive should be supported as spring is trying to resolve the placeholder but is not able to.

http://stackoverflow.com/q/25807900
score: 0
has answer: http://stackoverflow.com/a/25808179
has answer: http://stackoverflow.com/a/25808056
tagged with: input
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/40369530
type: UnansweredQuestion
tagged with: multithreading
type: Question
has body: I'm trying to implement asynchronous input reading from console in Java. Basically, I want to do this: Spawn a thread T which reads on standard input with a readLine() on a BufferedReader Continue with the program After 10 seconds, stop T The problem is the readLine() call in T, which I haven't been able to block. Since interrupting the thread does not work, I figured I would try and send data to standard input from code, to unblock the readLine(). So I tried the following: after 10 seconds, do FileOutputStream os = new FileOutputStream(FileDescriptor.in); os.write("Unblocking line\n"); I thought it would work like this: I'm writing to the standard input as in a pipe, so the code in T should read "Unblocking line\n" and go to the next instruction. Too bad, this doesn't work: "Unblocking line" is immediately shown on screen as if it was written to standard output, and it doesn't seem to affect the readLine(). So my questions are: Why is my reasoning wrong? Is there a simple, clean method to achieve what I want to do? Please note that I'm aware of this solution. Also, please do not suggest using System.setIn: it doesn't work. Finally, I should clarify what I mean by simple and clean: using only threads, and avoiding busy waiting. Thanks in advance. EDIT: I don't want to close the standard input, as I want to read again after step #3.
tagged with: java
has title: Asynchronous read from standard input
answer count: 2
has comment: http://stackoverflow.com/comment/40369080
tagged with: java-io

http://stackoverflow.com/a/76858125
downvote count: 0
type: Answer
upvote count: 3
has body: I see it's too late, however I only see generic answers. Use @Transactional and which one to use it depends to your usage or Framework. if using JPA jakarta.transaction.Transactional or javax.transaction.Transactional We have updated the package structure, so please take care of it. Also, if using spring then use. org.springframework.transaction.annotation.Transactional
score: 3
answers question: http://stackoverflow.com/q/25821579

http://stackoverflow.com/comment/40394271
type: QuestionComment
has text: Please edit your question to include a [complete example](http://stackoverflow.com/help/mcve) that shows your current approach.
comment on: http://stackoverflow.com/q/25751516
score: 0
type: Comment

http://stackoverflow.com/comment/40210127
comment on: http://stackoverflow.com/a/25720916
has text: the solution is may, simple but i dont know how i can, prepare the string of user.dir so that i do get: c:/..../..../
type: AnswerComment
score: 0
type: Comment

smartystreets
tags question: http://stackoverflow.com/q/25772373
tag name: smartystreets
type: Tag

http://stackoverflow.com/q/25821771
type: Question
has answer: http://stackoverflow.com/a/25821787
has comment: http://stackoverflow.com/comment/40395228
tagged with: http://stackoverflow.com/tag/xml
linked to: http://stackoverflow.com/q/14555402
answer count: 3
downvote count: 3
has answer: http://stackoverflow.com/a/25821789
duplicate of: http://stackoverflow.com/q/14555402
has answer: http://stackoverflow.com/a/25821795
tagged with: java
score: -3
upvote count: 0
has title: System.err vs System.out
type: UnansweredQuestion
favorite count: 0
has body: What is difference between System.out.println("Programming"); and System.err.println("Programming"); when both err and out are the object of Printstream class?

http://stackoverflow.com/comment/58278601
type: QuestionComment
comment on: http://stackoverflow.com/q/25797650
has text: Go through this link. Hope you will clarify your problem. http://www.mkyong.com/webservices/jax-rs/file-upload-example-in-jersey/
score: 0
type: Comment

http://stackoverflow.com/a/25816425
type: Answer
answers question: http://stackoverflow.com/q/25816379
has comment: http://stackoverflow.com/comment/40385755
has body: If you are simply trying to make one attribute depend on another, you can use the android:dependency attribute. Will that do what you want? E.g., &lt;CheckBoxPreference android:key="pushCheckBox" android:title="@string/pushnachr_headline" android:summary="@string/pushnachr_explain" android:defaultValue="true"&gt; &lt;!-- This setting will be disabled if pref_one is not checked --&gt; &lt;CheckBoxPreference android:defaultValue="false" android:key="preference_two" android:dependency="pushCheckBox" android:title="Pref Two" /&gt; But, if you really just want to get the click event to do something else, put something like this in the onResume method. Preference pushCheckBox = findPreference("pushCheckBox"); pushCheckBox.setOnPreferenceClickListener(new OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { // do something here return false; } });
score: 0

http://stackoverflow.com/q/25810444
downvote count: 0
has comment: http://stackoverflow.com/comment/40373630
score: 1
favorite count: 0
has title: Design of SwingWorker process
has answer: http://stackoverflow.com/a/25810546
accepted answer: http://stackoverflow.com/a/25810530
possible better answer: http://stackoverflow.com/a/25810546
type: AnsweredQuestion
upvote count: 1
tagged with: swing
type: Question
tagged with: swingworker
tagged with: java
has answer: http://stackoverflow.com/a/25810530
answer count: 2
has body: currently i have an implementation of a SwingWorker process something like this. Note these are not actual code. Just skeletons. private void jButtonSomeButton ( .... ) { ..... for( File file: files){ worker( args1, args2 ); } } private void worker( args1, args2 ){ mytask = new SwingWorker&lt;Object, Object&gt;(){ public Object doInBackground(){ while( !isCancelled() ){ individualtask( args1, args2 ); } } ..... } } private void individualtask(args1, args2){ ... table.addRow( somevector ); //add some data to row ... } While I had the above going, I find that sometimes the row data goes awry. Some characters may be missing etc. Sometimes they are alright. I believe I need some synchronizing mechanism however i do not have experience in this. Can you help suggest improvement to the code above? thanks

http://stackoverflow.com/q/25769094
has comment: http://stackoverflow.com/comment/87212564
type: Question
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/64591648
has answer: http://stackoverflow.com/a/55554081
has title: How do I rebuild/make .iml files in maven multi-module project in Intellij 13.1.4
has comment: http://stackoverflow.com/comment/93102792
has body: I'm working in a multi-module maven project in Intellij. There was a snapshot update in another module which required an update in a few POMs. Normally I will click the "Re-import all maven projects" from the maven plugins tool then do a full build. However, this time the .iml files associated with the changed POMs weren't being updated. It wasn't until I did "Build->Rebuild Project" that the .iml files were updated. Does anyone know how to update .iml files as part of a build configuration? Note: Before rebuilding the project, I know mvn at least picked up on the change because my local .m2 repo had the latest snapshot. EDIT #1: So, this is also true if I add a maven runtime dependency in a module. It won't pick up the change unless I do rebuild project.
answer count: 2
has comment: http://stackoverflow.com/comment/40374319
has comment: http://stackoverflow.com/comment/40340819
downvote count: 0
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/40376486
favorite count: 0
has comment: http://stackoverflow.com/comment/84485641
has comment: http://stackoverflow.com/comment/40376429
has comment: http://stackoverflow.com/comment/41201662
type: UnansweredQuestion
tagged with: maven
score: 13
has comment: http://stackoverflow.com/comment/40369306
upvote count: 13
tagged with: java

http://stackoverflow.com/q/25818028
has answer: http://stackoverflow.com/a/25818163
answer count: 5
has comment: http://stackoverflow.com/comment/40388579
possible better answer: http://stackoverflow.com/a/25818120
accepted answer: http://stackoverflow.com/a/25818232
has answer: http://stackoverflow.com/a/25818160
has answer: http://stackoverflow.com/a/25818120
linked to: http://stackoverflow.com/q/11871520
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40389781
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40390024
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40388861
has answer: http://stackoverflow.com/a/75716110
has answer: http://stackoverflow.com/a/25818232
tagged with: for-loop
linked to: http://stackoverflow.com/q/5585779
upvote count: 0
has body: First time poster here. I'm aware of the negative stigma carried with asking for help on homework assignments, however I believe this would be an exception as this is an intro course and the professor stated specifically to use Google to find examples of for loops in Java (of which we have yet to even cover in class). I have absolutely no Java experience and would really appreciate any feedback: Program asks user how many grades there are. Program asks user for each grade (for loop needed and should sum grades within loop). Take sum of all grades, compute average and store in a float variable grade. Print grade value to console and append a number to a string such as "Grade Average is: " + grade Example should read as: Enter number of grades: 2 Enter grade: 90 Enter grade: 81 Grade Average is: 85.5 My code so far (not much here): // This program computes the letter grades for number of grades given by user import java.util.*; public class GradeAverage { public static void main(String[] args) { int count; float sum = 0; float grade; Scanner scan = new Scanner(System.in); } } Edit: // This program computes the letter grades for number of grades given by user import java.util.*; public class GradeAverage { public static void main(String[] args) { int count; float sum = 0; float grade; Scanner scan = new Scanner(System.in); System.out.print("Enter number of grades: "); count = scan.nextInt(); for (int i = 0; i &lt; count; ++i) System.out.print("Enter grade " + (i + 1) + ": "); grade = scan.nextFloat(); sum += grade; System.out.println("The average of the grades is: " + sum/count); } } This is what I have now, however a test displays incorrect results (example): Enter number of grades: 2 Enter grade 1: Enter grade 2: 50 50 The average of the grades is: 25.0 Each grade needs to be entered on separate lines so the averaging is skewed as a result.
favorite count: 0
has title: Java - Using for loop to average set of grades read in from keyboard

http://stackoverflow.com/comment/40486941
type: QuestionComment
has text: So, when accessing [http://localhost:8080/test-results-upload-1.0/testGET](http://localhost:8080/test-results-upload-1.0/testGET) I'm getting the response which is mapped to **/error**
score: 0
comment on: http://stackoverflow.com/q/25870764
type: Comment

http://stackoverflow.com/q/25856785
accepted answer: http://stackoverflow.com/a/25873880
tagged with: spring
type: Question
has body: Does JPA with Spring-Data have a problem with attributes with underscores "_" in their names? This is my interface that extends JpaRepository: public interface I_My_Class extends JpaRepository&lt;MyClass, Long&gt; { public MyClass findByA_my_table_id (Long headerId); } This line: findByA_my_table_id (Long headerId); gives this error: Invalid derived query! No property "a" found for type MyClass ! If I name the method public MyClass findBya_my_table_id (Long headerId); it gives me the same error. If I name the attribute amytableid without the underscores I don't get the error but if I do that it's not easy to read later on. This is the class where I have the table attribute: @Entity @Table(name="MyTable") public class MyClass implements Serializable { private static final long serialVersionUID = 1L; @Id @Column (name="MY_TABLE_ID", nullable=false) private Long a_my_table_id; // &lt;-- this is the attribute that I try to put in the named query }
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25873880
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40459406
answer count: 1
tagged with: jpa
favorite count: 0
tagged with: spring-data-jpa
downvote count: 1
upvote count: 4
has title: How to map class attributes with underscores "_" in their names in Spring-data JPA

http://stackoverflow.com/comment/40460611
type: AnswerComment
type: Comment
has text: Thank you! I understand now! I do have one issue, the org.hamcrest.Matchers.*; doesn't seem to exist, where could I find this jar or it's mvn coordinates, .Matchers doesn't seem to exist anymore?
comment on: http://stackoverflow.com/a/25857611
score: 0

http://stackoverflow.com/q/25805859
answer count: 1
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: java
has body: How to parse the following xml using DOM parser - the name node is repeating up to n level <Columns> . . . <Columns> <Columns> . . . <Columns> I used the following code to get the values: public static void xmlEditor() throws SAXException, IOException { try { File xmlFile = new File("config/ServiceConfig.xml"); DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = null; documentBuilder = documentFactory.newDocumentBuilder(); org.w3c.dom.Document doc = documentBuilder.parse(xmlFile); doc.getDocumentElement().normalize(); NodeList nodeList0 = doc.getElementsByTagName("Service"); NodeList nodeList1 = doc.getElementsByTagName("File"); NodeList nodeList2 = doc.getElementsByTagName("name"); System.out.println("Root element :" + doc.getDocumentElement().getNodeName()); for (int temp0 = 0; temp0 < nodeList0.getLength(); temp0++) { Node node0 = nodeList0.item(temp0); System.out.println("\nElement type :" + node0.getNodeName()); Element Service = (Element) node0; if (node0.getNodeType() == Node.ELEMENT_NODE) { System.out.println("-----------------" + temp0 + "----------------------------------"); System.out.println("name : " + Service.getAttribute("name")); System.out.println("id : " + Service.getAttribute("id")); for (int temp = 0; temp < nodeList1.getLength(); temp++) { Node node1 = nodeList1.item(temp); System.out.println("\nElement type :" + node1.getNodeName()); Element File = (Element) node1; if (node1.getNodeType() == Node.ELEMENT_NODE) { System.out.println("rootProfile:" + File.getAttribute("rootProfile")); System.out.println("extension : " + File.getAttribute("extension")); for (int temp1 = 0; temp1 < nodeList2.getLength(); temp1++) { Node node2 = nodeList2.item(temp1); System.out.println("\nElement type :" + node2.getNodeName()); Element name = (Element) node2; if (node2.getNodeType() == Node.ELEMENT_NODE) { System.out.println("id:" + name.getAttribute("id")); System.out.println("profileName : " + name.getAt…
tagged with: dom
type: Question
has answer: http://stackoverflow.com/a/25806913
has title: How to parse the following xml using DOM parser?
score: 0

http://stackoverflow.com/q/25825496
downvote count: 1
type: Question
tagged with: date
has answer: http://stackoverflow.com/a/25825557
answer count: 2
has title: How to extract time from unix timestamp in java?
has comment: http://stackoverflow.com/comment/40427495
has body: I am new to java and i am making a weather app. I am getting data from openweathermap server in JSON format. Below is the format "sys":{ "type":1, "id":7758, "message":0.2194, "country":"India", "sunrise":1410569741, "sunset":1410614119 }, I want to extract sunrise and sunset from it but what i want is only time and not date. Below is my code DateFormat df = DateFormat.getDateTimeInstance(); String sunrise= df.format(new Date(json.getJSONObject("sys").getLong("sunrise")*1000).getTime()); String sunset = df.format(new Date(json.getJSONObject("sys").getLong("sunset")*1000).getTime()); Problem with my code is that it is giving me both time and date and output is " Sep 13, 2014 6:25:41 AM" for sunrise. Similar is for sunset. ? How shall i extract "6:25:41 AM" it? I only want time and not year/month/day
favorite count: 0
tagged with: unix-timestamp
linked to: http://stackoverflow.com/q/3371326
duplicate of: http://stackoverflow.com/q/3371326
accepted answer: http://stackoverflow.com/a/25825557
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25825525
upvote count: 2
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25825525

http://stackoverflow.com/comment/40270173
type: AnswerComment
comment on: http://stackoverflow.com/a/25751112
type: Comment
has text: @Andreas Well... Too bad? I do.
score: 0

http://stackoverflow.com/a/25861532
accepted answer of: http://stackoverflow.com/q/25861400
score: 0
answers question: http://stackoverflow.com/q/25861400
type: Answer
has body: The JsonGenerator is a tool for writing the pieces of a JSON value. It will write whatever you tell it to write in the appropriate context. jGenerator.writeStartObject(); // { jGenerator.writeObjectFieldStart("head"); // {"head": { jGenerator.writeStringField("label", "head"); // {"head": {"label":"head" jGenerator.writeObjectFieldStart("data"); // {"head": {"label":"head", "data": { // you're in the context of an object, so a name is expected, it will be empty when written jGenerator.writeStartArray(); // {"head": {"label":"head", "data": {:[ jGenerator.writeStartObject(); // {"head": {"label":"head", "data": {:[{ // again, you're in the context of an object, so a name is expected jGenerator.writeNumber(2001); // {"head": {"label":"head", "data": {:[{:2001 Given your expected results, this jGenerator.writeObjectFieldStart("data"); // {"head": {"label":"head", "data": { should actually be an array field start jGenerator.writeArrayFieldStart("data"); // {"head": {"label":"head", "data": [ And you then shouldn't be writing start of objects, just arrays.
type: AcceptedAnswer

http://stackoverflow.com/comment/40483577
type: QuestionComment
comment on: http://stackoverflow.com/q/25870528
has text: Please post the code you are having trouble with
score: 0
type: Comment

http://stackoverflow.com/q/25856995
has title: How to get the index of a JMenuItem in the JMenu?
type: Question
possible better answer: http://stackoverflow.com/a/29643093
has comment: http://stackoverflow.com/comment/40460552
has answer: http://stackoverflow.com/a/29643093
has comment: http://stackoverflow.com/comment/40538018
upvote count: 3
tagged with: java
answer count: 3
tagged with: swing
tagged with: jmenu
has answer: http://stackoverflow.com/a/25900281
has answer: http://stackoverflow.com/a/25857092
has body: I need to find the index of a specific JMenuItem in a JMenu so I can programatically insert() a new JMenuItem right before it. How can I go about doing that?
has comment: http://stackoverflow.com/comment/40459951
has comment: http://stackoverflow.com/comment/40459473
tagged with: jmenuitem
has comment: http://stackoverflow.com/comment/40520253
type: AnsweredQuestion
score: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/25900281
favorite count: 0

http://stackoverflow.com/comment/40331288
has text: You must give setInput all the rows not just one row.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25785550
type: Comment

http://stackoverflow.com/comment/40254681
comment on: http://stackoverflow.com/q/25744088
type: Comment
type: QuestionComment
score: 0
has text: Could you please tell something more about the way you execute this redirect? CORS is connected with AJAX. Simple redirect should work just fine with an ordinary http call.

http://stackoverflow.com/a/25854716
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25821794
has body: The wildfly:start goal will not block and it has a shutdown hook to destroy the process once maven exits. It may be worth adding a configuration property to not register the shutdown hook and leave the process running.. ..but I'm getting off topic. Since maven runs goals based on a lifecycle phase you could invoke the start and deploy goal in a phase that runs before the package phase. The run goal requires the package phase so anything before that should work.
has comment: http://stackoverflow.com/comment/40549570
upvote count: 2

http://stackoverflow.com/q/25729872
has comment: http://stackoverflow.com/comment/40226677
answer count: 1
tagged with: string
type: UnansweredQuestion
has body: So here I have a string from 3200 characters I have to find the pair with most space between them I already have the code to find the pair, but then I have to remove the first char of the pair and move the second at the end of the string and do this things till it's not possible to so. Here is what I've done so far import java.util.HashMap; import java.util.Map; import java.util.Scanner; public class StringPairs { public static void main(String[] args) { String inputString = readInputString(); printIdenticalSymbols(inputString); } private static String readInputString() { Scanner in = new Scanner(System.in); String inputString = in.nextLine(); in.close(); return inputString; } private static void printIdenticalSymbols(String inputString) { Map&lt;Character, Integer&gt; symbolsMap = new HashMap&lt;Character, Integer&gt;(); char longestChar = ' '; int longestDiff = -1; int firstIndex = -1; int lastIndex = -1; int firstOccurenceOfLastIdentical = -1; for (int i = 0; i &lt; inputString.length(); i++) { char currentCharacter = inputString.charAt(i); if (!symbolsMap.containsKey(currentCharacter)) { symbolsMap.put(currentCharacter, i); continue; } int firstOccurenceIndex = symbolsMap.get(currentCharacter); if (firstOccurenceIndex &lt; firstOccurenceOfLastIdentical) { symbolsMap.put(currentCharacter, i); continue; } int currentIdenticalLength = i - firstOccurenceIndex; if (currentIdenticalLength &gt; longestDiff) { longestChar = currentCharacter; longestDiff = currentIdenticalLength; firstIndex = firstOccurenceIndex; lastIndex = i; } firstOccurenceOfLastIdentical = firstOccurenceIndex; symbolsMap.put(currentCharacter, i); } System.out.println(longestChar + " - " + firstIndex + ":" + lastIndex); } } example input: brtba output: b:space between them(it already does this) and rtab if the string is bigger do this thing till it's not possible to do so.
has comment: http://stackoverflow.com/comment/40226348
tagged with: java
type: Question
has title: Java cutting string pairs
tagged with: hashmap
tagged with: algorithm
has answer: http://stackoverflow.com/a/25731763
score: 0

http://stackoverflow.com/q/25765792
upvote count: 3
has comment: http://stackoverflow.com/comment/60620763
tagged with: java
possible better answer: http://stackoverflow.com/a/39938094
type: Question
has answer: http://stackoverflow.com/a/39938094
tagged with: lombok
score: 3
tagged with: jackson
has answer: http://stackoverflow.com/a/36529070
downvote count: 0
tagged with: javabeans
favorite count: 0
has answer: http://stackoverflow.com/a/25766186
has body: My domain Objects are enhanced using lombok, which generates the java.beans @ConstructorProperties annotation for the constructors of immutable objects. Now in my frontend artifact, I'd like to serialize these objects to JSON using Jackson 2. For Jackson 1, this could be done using Jackson Extensions. Is there such a solution for Jackson 2 as well or do I have to write it myself? My main problem is that I want to keep my domain Objects frontend agnostic, so I wouldn't like to pollute them with Jackson annotations. And no: Java 8 parameter names is not an option, as I am stuck with Java 7 for the time being.
accepted answer: http://stackoverflow.com/a/25766186
has comment: http://stackoverflow.com/comment/60635548
has answer: http://stackoverflow.com/a/26476333
has title: java.beans.ConstructorProperties in Jackson 2
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/q/25800304
has comment: http://stackoverflow.com/comment/40356159
has title: Java - HashSet contains() method is not working?
has comment: http://stackoverflow.com/comment/40356391
has comment: http://stackoverflow.com/comment/40356289
has body: I am having trouble with HashSets. My program performs a Breadth First Search and I made a hashset to keep track of visited states. States are represented by int[] array. However, HashSet's contains method does not seem to be working as expected. Basically, it is not filtering out int[] arrays that should already have been added. Here are the relevant parts of my code: private boolean notVisitedAndNotNull(PuzzleState nextPS) { if (nextPS != null &amp;&amp; !this.visited.contains(nextPS.getStateArray)) return true; return false; } private void addToQueue(PuzzleState nextPS) { if (notVisitedAndNotNull(nextPS)) queue.add(nextPS); } private boolean solveByBFS() { queue.clear(); queue.add(this.initialState); long startTime = System.currentTimeMillis(); while(!queue.isEmpty()) { if (queue.size() &gt; maxQueueSize) maxQueueSize = queue.size(); this.currentState = queue.poll(); if (this.currentState.equals(finalState)) { System.out.println("Successful! Ending Time: " + startTime); return true; } visited.add(this.currentState.getStateArray()); //this adds int[] array this.addToQueue(this.currentState.moveUp()); this.addToQueue(this.currentState.moveDown()); this.addToQueue(this.currentState.moveRight()); this.addToQueue(this.currentState.moveLeft()); } return false; } I apologize for posting so much code. I searched a bit and it seems that in order for HashSet to work correctly, I would have to implement hashCode and equals of HashSet. I'm not sure if this is possible for an int[] array. Is it better to just use a HashMap then and use toString method on int[] array to serve as a key? Ok, I got this working now. Here is the code I added if anyone is interested: @Override public boolean equals(Object o) { if (o instanceof PuzzleState) { return (Arrays.equals(((PuzzleState) o).getStateArray(), this.getStateArray())); } return false; } @Override public int hashCode() { return Arrays.hashCode(this.getStateArray()); }
linked to: http://stackoverflow.com/q/8051084
score: 0
has answer: http://stackoverflow.com/a/25800350
has comment: http://stackoverflow.com/comment/40356366
type: Question
type: AnsweredQuestion
tagged with: hashmap
accepted answer: http://stackoverflow.com/a/25800350
linked to: http://stackoverflow.com/q/8777257
tagged with: java
answer count: 1
tagged with: hashset

http://stackoverflow.com/comment/78668817
type: Comment
comment on: http://stackoverflow.com/a/42849578
type: AnswerComment
has text: You can even refine the access using @JsonProperty(access = Access.WRITE_ONLY) or @JsonProperty(access = Access.READ_ONLY)
score: 1

http://stackoverflow.com/comment/40381567
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25810599
type: AnswerComment
has text: That explains the rounding issues you had. Since we just want to display an integer, it's the simplest tool for the job.

http://stackoverflow.com/comment/40203140
comment on: http://stackoverflow.com/q/25717421
has text: looks like mydeck.deal() would be causing NPE. how are you passing deck to initHand?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25870289
has comment: http://stackoverflow.com/comment/40484548
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25871493
tagged with: annotations
downvote count: 0
has comment: http://stackoverflow.com/comment/40483886
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40484703
type: Question
has body: My question is as follows; please assist. I have an annotation applicable to methods only that i want to be processed at runtime, say @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface MyAnno { String name();} And here is my processor: public class MyAnnoProcessor(Class cls){ Method[] m = cls.getClass().getMethods(); ...// read the value passed to name and create an instance of an object depending on the value of 'name' Yes. MyAnnoProcessor code is as follows: public class MyAnnoProcessor(Class cls){ Method[] methods = cls.getMethods(); for(Method m: methods){ MyAnno an = (MyAnno) m.getAnnotation(MyAnno.class); if(an!=null) sysout(an.name()); ....//call another method to create a class based on the value passed to 'name' Now, i have a class where i want to write many methods annotated with @MyAnno but each method passes a different value to "name". Am just unable to figure out a way to handle the annotation processing in an ideal way? How should 'MyAnnoProcessor' know what (object) needs to be returned to which method? Say, i do this in a method A: @MyAnno(name="testA") public void A(){ MyAnnoProcessor(this); ...} And again i do this in method B: @MyAnno(name="testB") public void B(){ MyAnnoProcessor(this); ...} The 'MyAnnoProcessor' seems to read the value of 'name' as "testA" and not "testB" in the subsequent call to it from method B. Where am i mistaken? Please advise.
has title: Runtime Annotation Processing
upvote count: 1

http://stackoverflow.com/a/25767736
answers question: http://stackoverflow.com/q/25764823
has body: You have to persist object B first or add the cascade attribute to the relationship annotation, e.g. @OneToMany(cascade = CascadeType.ALL, mappedBy = "field") This would cascade all operations through the relationship.
has comment: http://stackoverflow.com/comment/40298293
score: 0
type: Answer

http://stackoverflow.com/a/25747070
upvote count: 2
has body: Unfortunately, no: you cannot add a method to an interface without having to recompile all implementations of the interface. You can add a method to the abstract class, and change all references to the interface with references to your abstract class. That, however, defeats the purpose of having the interface in the first place. Finally, in Java 8 you can address this problem by providing a default implementation of a method in an interface. If Java 8 is an option, I would definitely recommend this route. If you would like to avoid problems like this in the future, you could follow the interface + adapter pattern that Java designers have been following in the AWT framewrok (among other places). They would provide a pair of an interface and its default, do-nothing implementation. Everyone would be encouraged to program to the interface, and base their implementations of the interface on its default implementation counterpart (the adapter). This way Swing designers were free to add more methods to their interface without breaking existing implementations. For reference, see MouseListener interface and MouseAdapter class.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25746974

http://stackoverflow.com/a/25792998
downvote count: 0
has comment: http://stackoverflow.com/comment/40342150
has body: The left side should be a JPanel that uses a GridLayout(0, 1) that then holds the 4 JLabels. The whole thing can be placed into a GridBagLayout-using JPanel or perhaps a BoxLayout. I am not a really manually coding for each component because mostly I just drag and drop in NetBeans. and don't do this. If you want this functionality, read up on and use the layout managers rather than blindly dragging and dropping. You know that you can also create JPanels with NetBeans code generation tools and tell the JPanels what specific layouts to use.
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/40342147
has comment: http://stackoverflow.com/comment/40342378
has comment: http://stackoverflow.com/comment/40342076
has comment: http://stackoverflow.com/comment/40342560
accepted answer of: http://stackoverflow.com/q/25792962
score: 4
answers question: http://stackoverflow.com/q/25792962
has comment: http://stackoverflow.com/comment/40345940
type: AcceptedAnswer

http://stackoverflow.com/a/25738632
downvote count: 0
has comment: http://stackoverflow.com/comment/40246756
has body: First of all see Object#clone() signature protected Object clone() throws CloneNotSupportedException You want to override this method. In your example now you have two methods: protected Object clone() throws CloneNotSupportedException public JustSomeAPISpecificType clone() See: JustSomeAPISpecificType.java public enum JustSomeAPISpecificType{ INSTANCE } Factory.java public class Factory { public static class JavaApiImpl implements JavaAPI{ public JustSomeAPISpecificType clone(){ return JustSomeAPISpecificType.INSTANCE; } } public static JavaAPI getAPI(){ return new JavaApiImpl(); } } Now add your files to src/main/java and run sbt console from root: scala&gt; val api = Factory.getAPI api: JavaAPI = Factory$JavaApiImpl@4243eb68 scala&gt; api.getClass.getMethods.filter(m =&gt; m.getName.startsWith("clone")).mkString("\n") res0: String = public JustSomeAPISpecificType Factory$JavaApiImpl.clone() public java.lang.Object Factory$JavaApiImpl.clone() throws java.lang.CloneNotSupportedException Update If you cast - you will see the method clone (if the factory is public). scala&gt; api.asInstanceOf[Factory.JavaApiImpl].clone res4: JustSomeAPISpecificType = INSTANCE
has comment: http://stackoverflow.com/comment/40248306
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25729827
has comment: http://stackoverflow.com/comment/40245153
accepted answer of: http://stackoverflow.com/q/25729827
has comment: http://stackoverflow.com/comment/40243324
type: Answer
has comment: http://stackoverflow.com/comment/40243506
score: 2
has comment: http://stackoverflow.com/comment/40247756
has comment: http://stackoverflow.com/comment/40248464

http://stackoverflow.com/q/25784983
type: Question
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/25791074
has body: I have a route defined as follows: . . I want to access the above route from my Java Program to be able to stop it on a given event. How will I be able to access this route?
favorite count: 0
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40327940
tagged with: spring
has answer: http://stackoverflow.com/a/25791074
type: AnsweredQuestion
has title: How to access route defined in spring config file in a Java program
tagged with: java
tagged with: apache-camel
tagged with: routes

http://stackoverflow.com/comment/40474565
has text: Concerning the "UPDATE POST", which is based on Dhruti's wrong proposal to call *String result = p.execute();*, please refer to the answered follow-up question here: http://stackoverflow.com/questions/25758236/android-asynctask-dont-return-correct-result/25865438
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25718315

http://stackoverflow.com/comment/40267284
type: QuestionComment
comment on: http://stackoverflow.com/q/25751749
score: 0
type: Comment
has text: all your input has same pattern? so (* 25 Los Angles in 2013 *) 4802743 is right?

jpanel
tags question: http://stackoverflow.com/q/25719983
tags question: http://stackoverflow.com/q/25862081
tags question: http://stackoverflow.com/q/25823511
tags question: http://stackoverflow.com/q/25775510
type: Tag
tags question: http://stackoverflow.com/q/25872055
tags question: http://stackoverflow.com/q/25751022
tags question: http://stackoverflow.com/q/25845915
tag name: jpanel
tags question: http://stackoverflow.com/q/25728549
tags question: http://stackoverflow.com/q/25869620
tags question: http://stackoverflow.com/q/25728363

http://stackoverflow.com/comment/40354957
score: 2
comment on: http://stackoverflow.com/q/25799619
has text: (But your computations are wrong anyway. Better to compute integer seconds and compute fractions separately.)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25747607
has comment: http://stackoverflow.com/comment/40260182
has comment: http://stackoverflow.com/comment/40260118
accepted answer of: http://stackoverflow.com/q/25747500
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40260785
has comment: http://stackoverflow.com/comment/40260752
has comment: http://stackoverflow.com/comment/40260663
has body: //Please note - you will need to import java.util.Random; String[] randomMessages = new String[]{ "Message 1 (Change this)", "Message 2", "LOL", "fdasfsd" }; Random randomGenerator = new Random(); int i = randomGenerator.nextInt(randomMessages.length); String s = randomMessages[i]; int oldi = i; Random randomGenerator2 = new Random(); i = randomGenerator2.nextInt(randomMessages.length); //Loop until we have a different index. while (i = oldi) { i = randomGenerator2.nextInt(randomMessages.length); } s = s + randomMessages[i]; System.out.println(s); //Alternative suggestion from Richard Le Mesurier - using Collections.shuffle List list = Arrays.asList(randomMessages); Collections.shuffle(list); String s2 = list.get(0).toString() + list.get(1).toString(); System.out.println(s2);
upvote count: 1
has comment: http://stackoverflow.com/comment/40259367
answers question: http://stackoverflow.com/q/25747500
downvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/q/25808624
type: AnsweredQuestion
has body: I am working on finding errors and predicting their possible causes by going through log files. In order to apply a classifier on it I need the text to be a numeral. I can identify keywords by NER and need it to be used as a training set. Can anyone suggest me some ways to do that ?
tagged with: classification
tagged with: java
tagged with: machine-learning
type: Question
has answer: http://stackoverflow.com/a/25809834
has title: How should I use machine learning classifiers on a a training set that contains text?
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25809834
tagged with: nlp

http://stackoverflow.com/comment/40408271
comment on: http://stackoverflow.com/a/25829108
score: 2
has text: it is useful if you have small number of elements but complex comparison cost
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25855820
answer count: 1
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/25878352
has title: Get Property Value Intersection of two objects in an ontology using OWL API
tagged with: ontology
tagged with: owl
type: AnsweredQuestion
tagged with: owl-api
has comment: http://stackoverflow.com/comment/40473936
has comment: http://stackoverflow.com/comment/40490773
has body: I am new to OWL API and trying to experiment with it. I have created a simple ontology in protege and reciprocal application in eclipse using OWL API. Ontology structure is as follows:- ---------------------------------------------------------------------------------------- Class Object (Data Property)StringValue ObjectProperty relatedTo ---------------------------------------------------------------------------------------- WordString WS1 "One" DS1 WS2 "Two" DS2 WS3 "Three" DS3 DigiString DS1 "1" DS2 "2" DS3 "3" ---------------------------------------------------------------------------- Complete ontology is as follows:- <rdf:RDF xmlns="http://localhost:3030/DigiWord.owl#" xml:base="http://localhost:3030/DigiWord.owl" xmlns:DigiWord="http://localhost:3030/DigiWord.owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <owl:Ontology rdf:about="http://localhost:3030/DigiWord.owl"/> <owl:ObjectProperty rdf:about="&DigiWord;relatedTo"> <rdfs:domain rdf:resource="&DigiWord;DigiString"/> <rdfs:range rdf:resource="&DigiWord;WordString"/> </owl:ObjectProperty> <owl:DatatypeProperty rdf:about="&DigiWord;stringValue"> <rdfs:domain rdf:resource="&DigiWord;DigiString"/> <rdfs:domain rdf:resource="&DigiWord;WordString"/> <rdfs:range rdf:resource="&xsd;string"/> </owl:DatatypeProperty> <owl:Class rdf:about="&DigiWord;DigiString"/> <owl:Class rdf:about="&DigiWord;WordString"/> <owl:NamedIndividual rdf:about="&DigiWord;DS1"> <rdf:type rdf:resource="&DigiWord;DigiString"/> 1 <relatedTo rdf:resource="&DigiWord;WS1"/> </owl:NamedIndividual> <owl:NamedIndividual rdf:about="&DigiWord;DS2"> <rdf:type rdf:resource="&DigiWord;DigiString"/> 2 <relatedTo rdf:resource="&DigiWord;WS2"/> </owl:NamedIndividual> <owl:NamedIndividual rdf:about="&DigiWord;DS3"> <rdf:type rdf:resource="&DigiWord;DigiString"/> <relatedTo rdf:resource="&DigiWord;WS3"/> </…
has answer: http://stackoverflow.com/a/25878352
type: Question

http://stackoverflow.com/comment/40252849
type: QuestionComment
comment on: http://stackoverflow.com/q/25743267
type: Comment
score: 0
has text: {? = call dhapic.get_instruments_list(?, ?, ?)} this is what i got from callString. is this what u asked?

http://stackoverflow.com/comment/40415033
type: QuestionComment
comment on: http://stackoverflow.com/q/25832838
score: 0
type: Comment
has text: Please see my edit, does that make it clear?

http://stackoverflow.com/a/25735740
has comment: http://stackoverflow.com/comment/40237864
downvote count: 0
type: Answer
upvote count: 1
has body: Based on what you've posted, you appear to be confused about actual parameters and formal parameters and the syntax thereof - // vicCheck (char[][]matrix2); vicCheck (matrix2); // &lt;-- actual parameters and // public static void vicCheck(){ public static void vicCheck(char[][]matrix2){ // &lt;-- formal parameters
score: 1
answers question: http://stackoverflow.com/q/25735685

http://stackoverflow.com/comment/40445563
has text: What do you see for echo $JAVA_HOME; which java; echo $PATH ? Also can you clarify why have you added cordova and intellij tags?
comment on: http://stackoverflow.com/q/25849428
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/25793238
has answer: http://stackoverflow.com/a/25793440
has comment: http://stackoverflow.com/comment/40342776
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25793277
upvote count: 1
has body: I am trying to do a while loop for the health of an enemy so that it keeps asking what spell to use until the enemy's health is less than or equal to zero, but the else statement doesn't seem to be working... while(monster_base_health&gt;0) { System.out.println("Would you like to use 1. Fire Blast, 2. Ice Blast, 3. Void Ray? (Just type 1, 2, or 3)"); int attack; attack = input.nextInt(); if(attack==1) { monster_base_health = monster_base_health - mage_fire; System.out.println("You used Fire Blast. The Monster now has " + monster_base_health + " health!"); } if(attack==2) { monster_base_health = monster_base_health - mage_iceblast; System.out.println("You used Ice Blast. The monster has " + monster_base_health + " health!"); } if(attack==3) { monster_base_health = monster_base_health - mage_voidray; System.out.println("You used Void Ray. The monster has " + monster_base_health + " health!"); } } else { System.out.println("You have defeated the monster!!!"); }
has answer: http://stackoverflow.com/a/25793333
score: 1
tagged with: java
has title: Are else statements not compatible with while loops?
type: Question
has comment: http://stackoverflow.com/comment/40342562
downvote count: 0
has comment: http://stackoverflow.com/comment/40342835
answer count: 6
has answer: http://stackoverflow.com/a/25793347
favorite count: 0
has comment: http://stackoverflow.com/comment/40343096
has answer: http://stackoverflow.com/a/25793466
has comment: http://stackoverflow.com/comment/40343159
has answer: http://stackoverflow.com/a/25793391

http://stackoverflow.com/comment/40479110
has text: they *should* have line-breaks, otherwise you end up with buffering the whole response body in memory. That's why line-by-line reading makes sense for human-readable files: they usually DO have line-breaks
comment on: http://stackoverflow.com/a/25868003
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40329099
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25784470
has text: It was useful . "${chapters.name}" How to get this value within JSP tags?
score: 0

http://stackoverflow.com/comment/40343493
type: AnswerComment
type: Comment
score: 0
has text: PS: is it neccessary to do all that object serialization stuff on your own? if you're not doing some fundamental research, then try to find some persistence-library for your language, which stores whole objects for you. So you would just store a user object, and wouldn't bother about how it is stored or loaded.
comment on: http://stackoverflow.com/a/25793006

http://stackoverflow.com/q/25853804
has answer: http://stackoverflow.com/a/41822748
answer count: 5
has answer: http://stackoverflow.com/a/25862662
tagged with: web-inf
upvote count: 11
has comment: http://stackoverflow.com/comment/133933515
has answer: http://stackoverflow.com/a/36630228
type: UnansweredQuestion
has body: Error Stack trace: SEVERE: StandardWrapper.Throwable org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/dispatcher-servlet.xml] dispatcher-servlet.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:p="http://www.springframework.org/schema/p" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:beans="http://springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/task/spring-task.xsd"> <mvc:annotation-driven/> <context:component-scan base-package="com.exam.www" /> applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> web.xml dispatcher org.springframework.web.servlet.DispatcherServlet contextConfigLocation WEB-INF/dispatcher-servlet.xml 1 dispatcher / contextConfigLocation WEB-INF/dispatcher-servlet.xml /search.jsp I tried several solutions given online like 1) Giving read, write permissions to all files - Doesn't work 2) Adding init-param - doesn't work 3) Explicitly giving path of dispatcherservlet as /WebContent/WEB-INF/dispatcher-servlet.xml - doesn't work. I get this error when I run the project on Apache tomcat server v7.0 I am struck with this problem for past 4 days. Please help me. Following is the solution that worked. Your war doesn't have the dispatcher-servlet.xml. 1) The project doesn't have webapp folder. When you create a project using maven be mindful. You can follow the steps mentioned here http://blog.manishchhabra.com/2013/04/spring-data-mong…
score: 11
tagged with: spring
type: Question
tagged with: spring-mvc
tagged with: java
has title: How to resolve BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/dispatcher-servlet.xml]?
has comment: http://stackoverflow.com/comment/40453430
has answer: http://stackoverflow.com/a/66468183
downvote count: 0
has answer: http://stackoverflow.com/a/25854317
favorite count: 0

http://stackoverflow.com/comment/40347964
type: Comment
has text: Polymorphism can often replace a switch statement too.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25790719

http://stackoverflow.com/a/25728661
has body: The page you are looking for in the GWT documentation is http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsCompatibility.html There's a (generated) list of emulated Java Runtime classes and methods at http://www.gwtproject.org/doc/latest/RefJreEmulation.html (not always up-to-date, but it's a start)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25728158

http://stackoverflow.com/q/25867612
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 0
has answer: http://stackoverflow.com/a/25867847
tagged with: java
has comment: http://stackoverflow.com/comment/40478624
has comment: http://stackoverflow.com/comment/40478174
has comment: http://stackoverflow.com/comment/40478230
type: Question
has comment: http://stackoverflow.com/comment/40479054
score: -1
has body: Hi I want to fetch whole ie the small part of xml as it is <com.shared.to.wireline.Billing> 17957 PZA OPWQ 6184 1 ILEPOR ACSQQWE UVERSE_STANDALONE </com.shared.to.wireline.Billing> in this particular format only .I dont want to use File Reader and fetch its contents as a String.Can i do it in java using any of the XML parsers? XML FILE <?xml version="1.0" encoding="UTF-8"?> Billing getBilling <com.shared.to.wireline.Billing> 17957 PZA OPWQ 6184 1 ILEPOR ACSQQWE UVERSE_STANDALONE </com.shared.to.wireline.Billing>
accepted answer: http://stackoverflow.com/a/25868045
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/25867980
favorite count: 0
has answer: http://stackoverflow.com/a/25868045
has title: How to fetch xml element inside a xml
possible better answer: http://stackoverflow.com/a/25867980
has comment: http://stackoverflow.com/comment/40478219

http://stackoverflow.com/q/25855873
has answer: http://stackoverflow.com/a/38295293
score: 16
favorite count: 0
type: Question
has title: Java, gulp and maven folder structure
has answer: http://stackoverflow.com/a/34957251
has answer: http://stackoverflow.com/a/29108231
has answer: http://stackoverflow.com/a/25856510
has comment: http://stackoverflow.com/comment/48889212
tagged with: maven
tagged with: gradle
possible better answer: http://stackoverflow.com/a/29108231
upvote count: 16
tagged with: project
tagged with: java
has body: I have a Java web project that uses Maven standard directory layout: java files gets into java (actually: /src/main/java), resources into resources, web content into webapp. Then we wanted to improve our web layer, by adding bower, sass, gulp etc. Our gulp build compiles scss, minimize javascripts, optimize images etc, everything what you would expect. But this introduced 1) another build tool, gulp and 2) generated files by gulp. Question is how to organize such project? One way could be: (A) gulp builds into webapp folder In this solution, all javascript,images,scss files are stored in /src/main/assets and gets build into the /src/main/webapp. Both sources and gulp-generated files gets committed to the git. The gradle build is independent from gulp, and it is ok for the users that does not have gulp installed - like those who needs to work only on backend. Also, CI servers does not depend on gulp stuff. (B) use gulp from gradle during build In this solution, gulp is called from gradle. Gradle therefore builds everything. And you must use gradle every time when you want to try something. Also, every developer needs to have gulp installed, what may be a problem for developers using windows (as i've been told). Also CI server should know how to run gulp. My team is torn between these two options. Does anyone have any working experience with either of these solutions?
accepted answer: http://stackoverflow.com/a/25856510
answer count: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/25865251
downvote count: 0
tagged with: gulp

http://stackoverflow.com/a/25834001
score: 0
answers question: http://stackoverflow.com/q/25825611
type: Answer
has body: JGit has a dependency on JSch and JavaEWAH and apparently JSch is not on your runtime classpath. You will have to either manually add the required libraries to the classpath or have the classpath managed by e.g. Maven or OSGi (Tools).

http://stackoverflow.com/q/25781969
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40323170
type: Question
has answer: http://stackoverflow.com/a/25783312
has body: I know how to add and set a target platform in eclipse. But I'm trying to do the same thing via command line, i.e specifying the target platform via command line options. I tried setting "base location" property while launching eclipse, &gt; eclipse.exe -vmargs -DbaseLocation="path to the plugins root folder" as suggested in here. I looked at the baseLocation property details here. But this is not working. Please let me know the right way of setting target platform through command line.
score: 0
answer count: 1
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/40322214
has title: Setting Eclipse target platform using command line
type: UnansweredQuestion
tagged with: target-platform

http://stackoverflow.com/q/25859684
has answer: http://stackoverflow.com/a/25859715
upvote count: 0
type: UnansweredQuestion
has title: Exception in thread "main" java.util.NoSuchElementException? Java Package program can't compile
has answer: http://stackoverflow.com/a/25859816
has body: I'm getting an error when compiling my java code. The error is: Enter the length in centimeters: Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:907) at java.util.Scanner.next(Scanner.java:1530) at java.util.Scanner.nextDouble(Scanner.java:2456) at Package.main(Package.java:11) Code from http://jsfiddle.net/tzxzawxp/; import java.util.Scanner; public class Package { public static void main(String[] args) { Scanner reader = new Scanner(System.in); double length; double width; double height; System.out.print("Enter the length in centimeters: "); length = reader.nextDouble(); System.out.print("Enter the width in centimeters: "); width = reader.nextDouble(); System.out.print("Enter the height in centimeters: "); height = reader.nextDouble(); if (length &lt;=0 | width &lt;=0 | height &lt;=0) System.out.println("Invalid"); else { if (length &lt; 10 &amp;&amp; width &lt; 10 &amp;&amp; height &lt; 10) { System.out.println ("Accept"); System.out.println("Volume is " + (length * width * height) + "cm"); System.out.println("Length is " + length); System.out.println("Width is " + width); System.out.println("Height is " + height); if (length &gt; 10 | width &gt; 10 | height &gt; 10) System.out.println ("Reject"); } } } } Anyone know how to fix this error?
type: Question
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40464405
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/25862204
favorite count: 0

http://stackoverflow.com/q/25857164
has body: I have this test in my project which is using Wiremock and it's working correctly in Jenkins (during build time, the test is executing and passing) but it's failing in my local machine with the following error (Eclipse console): 14:06:17,692 INFO [org.mortbay.log] - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog 14:06:17,751 INFO [org.mortbay.log] - jetty-6.1.26 14:06:17,767 WARN [org.mortbay.log] - failed DelayableSocketConnector@0.0.0.0:62344: java.net.BindException: Address already in use: JVM_Bind 14:06:17,767 WARN [org.mortbay.log] - failed Server@549b6220: java.net.BindException: Address already in use: JVM_Bind 14:06:17,775 INFO [org.mortbay.log] - jetty-6.1.26 14:06:17,776 WARN [org.mortbay.log] - failed DelayableSocketConnector@0.0.0.0:62344: java.net.BindException: Address already in use: JVM_Bind 14:06:17,776 WARN [org.mortbay.log] - failed Server@1c1474ea: java.net.BindException: Address already in use: JVM_Bind 14:06:17,777 INFO [org.mortbay.log] - jetty-6.1.26 14:06:17,778 WARN [org.mortbay.log] - failed DelayableSocketConnector@0.0.0.0:62344: java.net.BindException: Address already in use: JVM_Bind 14:06:17,778 WARN [org.mortbay.log] - failed Server@34c7e8a7: java.net.BindException: Address already in use: JVM_Bind (Maven) Tests run: 3, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 0.408 sec &lt;&lt;&lt; FAILURE! Time elapsed: 0.377 sec &lt;&lt;&lt; ERROR! java.lang.RuntimeException: java.net.BindException: Address already in use: JVM_Bind at com.github.tomakehurst.wiremock.WireMockServer.start(WireMockServer.java:188) at com.github.tomakehurst.wiremock.junit.WireMockClassRule$1.evaluate(WireMockClassRule.java:75) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java…
answer count: 1
tagged with: junit
favorite count: 0
upvote count: 3
has title: Wiremock unit test failing locally - java.net.BindException: Address already in use: JVM_Bind
has answer: http://stackoverflow.com/a/25876308
accepted answer: http://stackoverflow.com/a/25876308
downvote count: 0
tagged with: jenkins
tagged with: java
tagged with: wiremock
type: Question
type: AnsweredQuestion
score: 3
tagged with: eclipse

http://stackoverflow.com/comment/40271721
type: Comment
type: QuestionComment
has text: Are `+inf` and `-inf` available in Java? It seems like it could loop infinitely for at least one of those if `x` is a `double` type...
score: 1
comment on: http://stackoverflow.com/q/25753914

http://stackoverflow.com/q/25773721
tagged with: floating-point
type: Question
has answer: http://stackoverflow.com/a/25777516
downvote count: 4
has comment: http://stackoverflow.com/comment/40307320
answer count: 7
has comment: http://stackoverflow.com/comment/40307304
favorite count: 0
has comment: http://stackoverflow.com/comment/40314913
has title: How to get the number of decimal digits from a double in Java? (Ex: 2.34 => 2 , 2.340 => 2 , 0.921 => 3)
has comment: http://stackoverflow.com/comment/40307225
has answer: http://stackoverflow.com/a/25773845
has comment: http://stackoverflow.com/comment/40307707
possible better answer: http://stackoverflow.com/a/25774353
has comment: http://stackoverflow.com/comment/40307665
has answer: http://stackoverflow.com/a/25774353
has answer: http://stackoverflow.com/a/25773852
has comment: http://stackoverflow.com/comment/40314669
has answer: http://stackoverflow.com/a/25797180
upvote count: 11
tagged with: integer
has body: Title is self-explanatory. What is a good way, with just math preferably, to get the number of digits from a Java double? 123 =&gt; 0 1.12 =&gt; 2 1.0001 =&gt; 4 2.340000 =&gt; 2 0.10 =&gt; 1 I have a double d = 0.320 for example. As far as I know, for the compiler / jvm / computer: System.out.println(0.0100000 == 0.01); // prints true...
has comment: http://stackoverflow.com/comment/40307265
has comment: http://stackoverflow.com/comment/40307696
tagged with: double
has comment: http://stackoverflow.com/comment/40307703
has answer: http://stackoverflow.com/a/76837646
has answer: http://stackoverflow.com/a/25773760
linked to: http://stackoverflow.com/q/23608687
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40307695
has comment: http://stackoverflow.com/comment/40307594
has comment: http://stackoverflow.com/comment/40307515
score: 7
accepted answer: http://stackoverflow.com/a/25773760
tagged with: java
has comment: http://stackoverflow.com/comment/40307279

http://stackoverflow.com/comment/40439387
comment on: http://stackoverflow.com/q/25846110
has text: Post you application Manifest.xml file , May be problem happen here..
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/40240199
has text: No, I'm building project in Eclips
comment on: http://stackoverflow.com/q/25736878
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25841222
has comment: http://stackoverflow.com/comment/40430824
has comment: http://stackoverflow.com/comment/40430862
tagged with: ambari
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40430934
has comment: http://stackoverflow.com/comment/40431222
has comment: http://stackoverflow.com/comment/40431415
downvote count: 1
type: Question
has title: /bin/sh: /usr/jdk64/jdk1.7.0_45/bin/java: cannot execute binary file
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/40430888
answer count: 1
has body: I installed Ambari server successfully, But when I try to start that server it says, /bin/sh: /usr/jdk64/jdk1.7.0_45/bin/java: cannot execute binary file So could you please help me to resolve this. Thank You.
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/25843995
has comment: http://stackoverflow.com/comment/40431177

permissions
tag name: permissions
tags question: http://stackoverflow.com/q/25777158
type: Tag
tags question: http://stackoverflow.com/q/25868217
tags question: http://stackoverflow.com/q/25856425

http://stackoverflow.com/comment/40319660
has text: possible duplicate of [Eclipse warning: XXXXXXXXXXX.jar will not be exported or published. Runtime ClassNotFoundExceptions may result](http://stackoverflow.com/questions/8884818/eclipse-warning-xxxxxxxxxxx-jar-will-not-be-exported-or-published-runtime-clas)
comment on: http://stackoverflow.com/q/25780378
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40223478
comment on: http://stackoverflow.com/q/25728280
score: 0
type: QuestionComment
has text: Yes that's my point...Can U suggest me another way.
type: Comment

http://stackoverflow.com/q/25871816
tagged with: java
type: Question
has title: WS: what to return when saving?
has answer: http://stackoverflow.com/a/25871896
score: 0
has body: I am creating a simple WS CRUD using Apache CXF. This is what I have so far: @Service("userService") public class UserService implements IUserService { @Autowired private IUserDAO userDAO; @Override @Transactional(readOnly=true) public List&lt;User&gt; getUsers() { return userDAO.findAll(); } @Override @Transactional(readOnly=true) public User getUser(Long id) { return userDAO.findById(id); } @Override @Transactional public String saveUser(User u) { userDAO.persist(u); return "ok"; } @Override @Transactional public String updateUser(User u) { userDAO.merge(u); return "ok"; } @Override public String deleteUser(Long id) { userDAO.remove(id); return "ok"; } } I based this example on a tutorial I found over the net, but I was wondering whether it's good practice to return simple "ok" strings after modification methods. What would be the best solution here?
answer count: 1
type: UnansweredQuestion
tagged with: web-services
tagged with: cxf

http://stackoverflow.com/comment/40330092
has text: This is about his equals method: he has determined that the objects are of the same class, and now wants to check if their fst and snd are equal. To do this however, he forgot to cast the otherObject to a Pair. By forgetting this, he did not have access to the fst- and snd-attribute.
comment on: http://stackoverflow.com/a/25769747
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25852675
accepted answer of: http://stackoverflow.com/q/25852359
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25852359
has body: You need to cascade the attribute (cascade="true"). Attributes defined into a definition can be cascaded to be available to all nested definitions and templates. For example the sample definition detailed above can be rewritten this way: Reading more about (cascaded) attributes here.
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/25728876
type: Question
has answer: http://stackoverflow.com/a/25729129
tagged with: video-capture
has body: I have a USB device that provides a video stream to the computer. Normally I just use a program to display this information in a window. I'd like to have my Java program take this image data directly into my code. How is this possible? I already have drivers and everything set up. I just need to let my program access the data stream coming in through USB. I imagine this might be similar to using a USB webcam?
has comment: http://stackoverflow.com/comment/40224803
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25729129
has comment: http://stackoverflow.com/comment/40226336
has title: Java: How do I take input from a USB video capture device?
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40252278
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25743808
has text: why are you expecting it should print debug 3? your gestureListener is attached to anything

http://stackoverflow.com/q/25840803
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25875967
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/40431924
accepted answer: http://stackoverflow.com/a/25843219
possible better answer: http://stackoverflow.com/a/25875967
tagged with: birt
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
has body: I am displaying a table in an HTML page. I want to display those data in a word file and I want to download it from the webpage. How do I generate a Doc file with tables? What are the options available to me? BIRT or any other simple options?
tagged with: doc
tagged with: html-table
has answer: http://stackoverflow.com/a/25843219
answer count: 2
has title: Rendering a table in a word file (doc file)
downvote count: 0

http://stackoverflow.com/a/25719631
has comment: http://stackoverflow.com/comment/40207517
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25719588
has body: Look at the line of code which actually throws the Exception. If it is not in the try/catch block, it will not be caught. Try this instead: try { int a = keyboard.nextInt(); verifyAge(a); } catch (InputMismatchException e) { System.out.println("You may only enter integers as an age. Try again."); getAge(); }
has comment: http://stackoverflow.com/comment/40207483
accepted answer of: http://stackoverflow.com/q/25719588
upvote count: 1
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/25817092
linked to: http://stackoverflow.com/q/2144165
type: UnansweredQuestion
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/25817136
tagged with: executable
tagged with: java
tagged with: eclipse
has body: I am trying to run a linux based executable called src2srcml in my JFrame GUI that takes a source file (C, C++, Java) and converts it to an XML file to be used later. My GUI successfully uses the JFileChooser to locate and select the source file. I'm currently trying to use the Runtime.getRuntime().exec() function to run the executable but so far nothing is happening. I can run it from the command line using the commands "bash-4.1$ ./src2srcml --position sum_avg.c -o hooray.c.xml", which takes the source file sum_avg.c, converts it to XML in a new file hooray.c.xml but when I try the exact same commands in Runtime.getRuntime().exec() nothing happens. I'm not particularly familiar with the Runtime.getRuntime().exec() or ProcessBuilder classes. Do I need to navigate to where the executable is first? I also tried including the path in the first parameter, the call to the executable its self but that didn't work either. //--- 'Run Source Code' Button---// JButton btnRunSourceCode = new JButton("Run Source Code"); btnRunSourceCode.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if(filePath == null){ textArea.setText("Please Load a source file (C, C++, Java)"); } try{ textArea.setText("Converting Source Code to XML"); String[] commands = {"./src2srcml", "--position ", selectedFile.getName(), " -o targetFile.xml"}; Process src2XML = Runtime.getRuntime().exec(commands); src2XML.waitFor(); } catch(Exception exc){/*src2srcml Fail*/} } }); btnRunSourceCode.setBounds(612, 39, 156, 25); contentPane.add(btnRunSourceCode); Currently the executable is in the workspace of my project (Eclipse). when I get everything working I would like to compile the whole program into a single executable so that the src2srcml is embedded into my executable and isn't required separately. Is this possible? Thanks in advance for any ideas!
score: 0
has title: Run executable from JFrame (linux) (eclipse)
answer count: 1
tagged with: linux

http://stackoverflow.com/a/25821838
score: 18
has comment: http://stackoverflow.com/comment/92740927
type: Answer
has comment: http://stackoverflow.com/comment/98901721
has comment: http://stackoverflow.com/comment/94685113
accepted answer of: http://stackoverflow.com/q/25821741
upvote count: 19
answers question: http://stackoverflow.com/q/25821741
downvote count: 1
has body: From documentation, it is pretty clear: public abstract FragmentTransaction addToBackStack (String name) Add this transaction to the back stack. This means that the transaction will be remembered after it is committed, and will reverse its operation when later popped off the stack. Parameters name // An optional name for this back stack state, or null. So your parameter is optional and represents the name of the fragment. If you just want to add this transaction to the back stack and don't need to access it later then you can put null as the name. In this context, null in plain English means "I don't need a name for this fragment". That is why it says the name is optional. If you do put a name you can use that name later. If you put a null that just means "add this fragment to the back stack and I don't need it anymore". The use of the name is to identify that specific fragment. This can be useful for example if you want to obtain that fragment from the FragmentManager: addToBackStack (FRAGMENT_NAME); getFragmentMangager().findFragmentByTag(FRAGMENT_NAME);
type: AcceptedAnswer

http://stackoverflow.com/q/25810777
has comment: http://stackoverflow.com/comment/40374137
answer count: 1
tagged with: git
has title: new to git - how to change directory in git gui
tagged with: java
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40374169
has answer: http://stackoverflow.com/a/61779259
score: 1
has body: when i launch my git gui, if i look at the top left hand corner, it points to c: i am trying to change this but it does not work so here is what i tried: I tried to look through this documentation, and it states that when I right click in my folder i want to be a repository on my pc, Iwill find a option called "git init here", no such option exists... how can i make this folder of mine recognized by the git gui ?
favorite count: 0
type: Question
upvote count: 1

http://stackoverflow.com/q/25761824
has answer: http://stackoverflow.com/a/25783067
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has body: My project has several modules, each having its own build script with a target called "unit-tests"(which runs the unit tests). I created an Ant script that calls the "unit-tests" targets in the modules, runs all the tests and after that generates a junitreport from the output of the executed tests(which is saved in xml files). So far so good, but what I want now is to fail the build if at least one test has failed. My script now looks something like this, and I need some method of finding out if a the unit tests failed.(I know about the failureproperty in the junit task but I don't know how I could pass that to the calling script) .... <ant antfile="${module1}/build.xml" inheritAll="false" target="${junit-target}" /> <ant antfile="${module2}/build.xml" inheritAll="false" target="${junit-target}" /> .... <include name="**/TEST-*.xml" /> //---->fail the build if at least one unit tests has failed Any ideas are greatly appreciated. Thanks :)
accepted answer: http://stackoverflow.com/a/25783067
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/40285728
tagged with: continuous-integration
tagged with: ant
downvote count: 0
answer count: 1
tagged with: junit
has title: Ant script to run unit tests from multiple modules and fail the build if a test fails
linked to: http://stackoverflow.com/q/14835000
favorite count: 0

http://stackoverflow.com/a/25756949
has comment: http://stackoverflow.com/comment/40277032
answers question: http://stackoverflow.com/q/25756900
score: 0
has comment: http://stackoverflow.com/comment/40276978
has body: You can typecast your char as an int. So: int asciiVal = (int) yourChar; Sample code: char yourChar = 'a'; int asciiVal = (int) yourChar; System.out.println("ASCII for " + yourChar + " is " + asciiVal);
type: Answer

http://stackoverflow.com/comment/40488935
type: QuestionComment
score: 0
has text: You can't just put the labels and panels in arrays with corresponding indexes?
comment on: http://stackoverflow.com/q/25872055
type: Comment

http://stackoverflow.com/q/25793827
tagged with: filter
has body: I have an application mostly display table data from database. but those tables need to be applied pagination, sorting, filter. for sorting and filter, they needs to be applied on the whole list, not only 1st. page. I have 3 ideas in my head: retrieve the whole list from backend, and then apply pagination, sorting, filter on frontend using javascript. (this way is very easy and I found a lot libs can do it). do sorting, pagination, filter on hibernate level.(ie. create dynamic SQL to get result and then using AJAX call render to frontend.) do sorting, pagination, filter on java level. (ie. get the whole list from database and then using Spring PagedListHolder do pagination and sorting, maybe other framework for filter. and then again using AJAX call render to frontend.) which way is best to achieve this amount those three? or there is other better way that I didn't think. Thanks for any help or tip.
has title: filter pagination sorting at frontend or backend
accepted answer: http://stackoverflow.com/a/25794077
type: Question
type: AnsweredQuestion
upvote count: 9
tagged with: java
tagged with: pagination
possible better answer: http://stackoverflow.com/a/69326956
score: 9
has answer: http://stackoverflow.com/a/69326956
answer count: 2
has answer: http://stackoverflow.com/a/25794077
downvote count: 0
tagged with: sorting
favorite count: 0

http://stackoverflow.com/q/25796736
score: 0
tagged with: java
has title: datagrid with checked checkboxes
type: Question
tagged with: javascript
answer count: 1
has answer: http://stackoverflow.com/a/25810729
has body: I have the following datagrid with a checkbox: <asp:DataGrid id="dgExpenditures" runat="server" Width="676px" PageSize="15" <asp:TemplateColumn HeaderText="Mark To Edit"> <asp:CheckBox ID="Checkbox1" Runat="server" CssClass="Chkbx" /> </asp:TemplateColumn> <asp:BoundColumn HeaderText="RecordID" DataField="Record ID" SortExpression="Record ID" <asp:BoundColumn HeaderText="PSN" DataField="PSN" SortExpression="PSN" /> <asp:BoundColumn HeaderText="Dist#" DataField="Dist" SortExpression="Dist" /> <asp:BoundColumn HeaderText="Line#" DataField="Line" SortExpression="LineNum" /> <asp:BoundColumn HeaderText="Gross Amt" DataField="GrossAmt" SortExpression="GrossAmt" /> <asp:BoundColumn HeaderText="Rate(%)" DataField="Rate" SortExpression="Rate" /> <asp:BoundColumn HeaderText="Net Amt" DataField="NetAmt" SortExpression="NetAmt" /> </asp:DataGrid> I also have a delete button on the page that when selected will delete the records that are checked by looping through the grid and deleting those that are checked. This loop is in the button.click event. I have added a script function to the .aspx page that pops a confirm dialog, but it will appear if no items are selected. I only want it to appear if 1 or more checkboxes have been selected in the data grid: So my problem is how do I write a java function to loop through the datagrid to see if there are checkboxs checked?
type: UnansweredQuestion

http://stackoverflow.com/q/25825117
has answer: http://stackoverflow.com/a/27120376
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/37450511
answer count: 2
has comment: http://stackoverflow.com/comment/42879767
has title: Show a System Tray notification or Desktop notification from the web application
score: 0
tagged with: notifications
has comment: http://stackoverflow.com/comment/43413432
has comment: http://stackoverflow.com/comment/40421086
has body: I have created a web application in Java using J2EE 6.0 that has login functionality. As the user logs in into the application, a timer start at 59:59 (minutes:seconds) and keeps on decreasing until it comes to 3:00. When 3 minutes are left, it displays a popup to the user asking to logout or extend their time/session again back to 59:59. My question is if user is doing some other work say on outlook or surfing some other thing over the internet in a new window/browser(Firefox,etc.). How can I notify the user that his session/time is going to expire. This application is intended to run only on Microsoft Windows Internet Explorer. I found these links for displaying desktop notifications but unfortunately my application is specific to run on Internet Explorer only What ways are out there to display a desktop notification from a web app? How do Stack Overflow desktop notifications work? So I cannot use Desktop notifications. I thought I would create a swing application to display the notification popup in the Windows System Tray saying 'Your session is going to expire'. But I am stucked how will it run on the client machine. I have heard of something called Java Web Start, AjaxSwing, etc. With Java Web Start software, users can launch a Java application by clicking a link in a web page. It requires JRE in the client system. Java Web Start will ask the user to download the Java plugin which will download a JRE(if not found in the client's system) which is annoying. AjaxSwing will convert the Swing app to HTML, Javascript and CSS so I am not sure how it will come out of a browser to show up a popup in System Tray. I think that will remain stick to the browser. I searched for blinking the tab option but it is not blinking the tab in the taskbar of the windows. I read somewhere Growl for Windows but I am not sure whether it will be helpful for me or not. Please tell that also. Please suggest me how can I notify the user that his session is going to expire. I already know I…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/42691991
tagged with: swing

http://stackoverflow.com/a/25801711
upvote count: 1
answers question: http://stackoverflow.com/q/25800270
has body: Asserts are mainly used to check preconditions. Its like if given preconditions are not mate throw AssertionError. Checking preconditions this way is actually good practice in testing environments. Where we can make sure all preconditions are mate and satisfied. In production environment if debug mode is not yet activated then it will surely will not harm. this statement will work as if it is commented. In your case if you merely want to check which value is accepted at controller level use if's. but If you want to check that as precondition and then you want throw error if these preconditions are not met and ideally in debug mode. (AssertionError.) then you can use asserts.
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/40431395
has text: @Chaitanya I am afraid this is a Java question, and I know very little about that. AFAIK, Xalan is the default XSLT processor in Java, but the latest version is not always included. If it works for you, then I don't think you need to worry.
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25841247

http://stackoverflow.com/comment/90444341
type: Comment
has text: Heroku doesnt supports it, your data will get lost everytime dynos get restarted
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/44335464

http://stackoverflow.com/q/25718315
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/25758236
has comment: http://stackoverflow.com/comment/40205062
has answer: http://stackoverflow.com/a/25718517
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/40206924
tagged with: android
has body: I want to use AsyncTask for Ksoap as an Thread.because my app don't work in Android 3 or above and that not any problem in Android 2. I want to develop this below code to send parameters to AsyncTask class and get values from that. public class ReceivedSMS extends ListFragment implements AbsListView.OnScrollListener { public List&lt;ReceiveFields&gt; rows; private int prevVisibleItem; private TSMS tsms; private String username; private String password; public Long getLastID; private boolean isFirstTime; private Context context; private DatabaseHandler db; private SQLiteDatabase dbHelper; private ViewReceivedSMSDetailes receiveListView; public ReceivedSMS(Context context, String username, String password) { this.username = username; this.password = password; this.context = context; } public ReceivedSMS(String username, String password, long start, long count, Context context) { this.username = username; this.password = password; this.context = context; tsms = new TSMS(context, new User(this.username, this.password)); try { getReceivedSMS(start, count); } catch (Exception e1) { e1.printStackTrace(); Log.e("Error in getReceivedSMS(start, count); ", ""); } } public List&lt;ReceiveFields&gt; getReceivedSMS(long start, long count) throws UnsupportedEncodingException { tsms = new TSMS(context, new User(this.username, this.password)); try { rows = tsms.getReceivedSMS(start, count); saveRowsintoDatabase( rows ); } catch (TException e) { e.printStackTrace(); Log.e(getClass().toString(), "ERROR IN Fetch SMS From WebService List&lt;ReceiveFields&gt; getReceivedSMS(long start, long count) "+ String.valueOf(e)); } return rows; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); db = new DatabaseHandler(context); dbHelper = db.getWritableDatabase(); setReceivedSMSToListView(); } } private class AsyncCallWS extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected Void doInBackground(Void... params) { } @Override protected void on…
has comment: http://stackoverflow.com/comment/40474565
type: AnsweredQuestion
has title: Android use Ksoap as an AsyncTask with parse variables and get returned values
accepted answer: http://stackoverflow.com/a/25718517
score: 1

http://stackoverflow.com/q/25743102
has body: I am using JCombobox with Nimbus LaF in my application. I have override the Backgroundpainter of Combobox and Foregroundpainter of ArrowButton for different states. The painters are working fine. but when I increase the size of the font, the arrowbutton of Combobox is stretching and it is not looking good. How to make it unstretchable? I have used the painters from Nimbus LaF itself there i have to provide my own paintContext. Here is the code that shows the problem. public class ComboTest { public ComboTest(){ String labels[] = { "A", "B", "C", "D" }; JFrame frame = new JFrame("ComboBox Demo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComboBox comboBox = new JComboBox(labels); frame.add(comboBox, BorderLayout.NORTH); frame.setSize(300, 100); frame.setVisible(true); } public static void main(String[] args) { try { UIManager.setLookAndFeel(NimbusLookAndFeel.class.getName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { } UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Segoe UI", Font.PLAIN,16)); // if i put the different font size than it is strecthing, with the size 12 it looks good. //UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("SegoeUI",Font.PLAIN,12)); UIManager.getLookAndFeelDefaults().put("ComboBox:\"ComboBox.arrowButton"[Pressed].foregroundPainter", new ComboArrowPainter(1)); javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { new ComboTest(); } }); } } Here is the class for ArrowPainter, which i took from Nimbus public class ComboArrowPainter extends AbstractRegionPainter { static final int FOREGROUND_PRESSED = 1; private int state; //refers to one of the static final ints above private PaintContext ctx; //the following 4 variables are reused during the painting code of the layers private Path2D path = new Path2D.Float(); private Color color31 = decodeColor("textForeground", 0.0f, -0.6357143f, 0.45098037f, 0); p…
tagged with: nimbus
type: Question
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25809449
has comment: http://stackoverflow.com/comment/40281748
upvote count: 1
answer count: 1
favorite count: 0
tagged with: jcombobox
has comment: http://stackoverflow.com/comment/40258769
downvote count: 0
has title: Combobox ArrowButton is strecthing respective to the font size in nimbus LaF
type: UnansweredQuestion
tagged with: look-and-feel
tagged with: swing

http://stackoverflow.com/comment/40240222
type: QuestionComment
comment on: http://stackoverflow.com/q/25736878
has text: after you built ,arent you deploying in tomcat?If you are not deploying then why you said this line *m trying deploy a web app to tomcat*
score: 0
type: Comment

http://stackoverflow.com/a/25764460
score: 0
has body: Of course, there are various ways, but a simple way is to implement a method getTextField() in your Frame class (I would not call it Frame and if the Frames have the same functionality, you do not need Frame1 etc., but you just say Frame f3 = new Frame()), or alternatively a getPanel().getTextField(). This method returns the JTextField, and you can manipulate it, as you like.
type: Answer
answers question: http://stackoverflow.com/q/25763985

resourcebundle
tags question: http://stackoverflow.com/q/25734882
tag name: resourcebundle
type: Tag

http://stackoverflow.com/a/25769526
answers question: http://stackoverflow.com/q/25768397
downvote count: 0
score: 3
upvote count: 3
has body: Your decompiler is indeed simplifying the code. Consider this source file: public class foo { public void a(String[] args) { String b = (new StringBuilder()).append("x").append(args[0]).toString(); } public void b(String[] args) { String b = "x" + args[0]; } } javap output: public class foo { public foo(); Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."&lt;init&gt;":()V 4: return public void a(java.lang.String[]); Code: 0: new #2 // class java/lang/StringBuilder 3: dup 4: invokespecial #3 // Method java/lang/StringBuilder."&lt;init&gt;":()V 7: ldc #4 // String x 9: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 12: aload_1 13: iconst_0 14: aaload 15: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 18: invokevirtual #6 // Method java/lang/StringBuilder.toString:()Ljava/lang/String; 21: astore_2 22: return public void b(java.lang.String[]); Code: 0: new #2 // class java/lang/StringBuilder 3: dup 4: invokespecial #3 // Method java/lang/StringBuilder."&lt;init&gt;":()V 7: ldc #4 // String x 9: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 12: aload_1 13: iconst_0 14: aaload 15: invokevirtual #5 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 18: invokevirtual #6 // Method java/lang/StringBuilder.toString:()Ljava/lang/String; 21: astore_2 22: return } See that the bytecodes are essentially identical: the compiler has transformed method b into method a using the StringBuilder.append optimization. Now let's see what JD says: public class foo { public void a(String[] paramArrayOfString) { String str = "x" + paramArrayOfString[0]; } public void b(String[] paramArrayOfString) { String str = "x" + paramArrayOfString[0]; } } That's right: JD actually takes the function a and interprets it as being a string addition, even though the original source code w…
type: Answer

http://stackoverflow.com/a/69541803
has body: You can try using this: import java.awt.Color; renderer.setBaseItemLabelPaint(Color.WHITE);
type: Answer
downvote count: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25762900
score: 0

http://stackoverflow.com/comment/40313648
comment on: http://stackoverflow.com/q/25776787
type: QuestionComment
type: Comment
score: 1
has text: Try using Calendar#getTime, which returns a Date object, try comparing the milliseconds from the returned Date and the Calendar#getTimeMillis method

http://stackoverflow.com/comment/40292103
score: 1
comment on: http://stackoverflow.com/q/25765732
has text: If you used `Base64.encode` the result will be Base64 encoded.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25739336
has comment: http://stackoverflow.com/comment/40274891
accepted answer of: http://stackoverflow.com/q/25738061
type: Answer
answers question: http://stackoverflow.com/q/25738061
score: 2
upvote count: 2
type: AcceptedAnswer
downvote count: 0
has body: Your issue is in the bugtracker of Jenkins : https://issues.jenkins-ci.org/browse/JENKINS-21330

http://stackoverflow.com/comment/40466998
comment on: http://stackoverflow.com/q/25861119
type: Comment
score: 1
has text: So please explain what is not working. What error message do you get? What happens? Otherwise this is not an answerable question.
type: QuestionComment

http://stackoverflow.com/comment/40435724
has text: hey Jeeva did you solve your question?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25842201
type: Comment

http://stackoverflow.com/q/25785873
has title: instanceof operator - why there is Illegal compile time error
has answer: http://stackoverflow.com/a/25785961
tagged with: inheritance
score: 4
has comment: http://stackoverflow.com/comment/40328893
upvote count: 4
has answer: http://stackoverflow.com/a/25786013
answer count: 3
tagged with: operator-keyword
has body: Considering the following code, I don't understand why "System.out.println( c2 instanceof D);" will result an "illegal compile time error" but not return "false"? Many thanks for your help! interface I { } class A { int x = 1;} class B extends A implements I { int y = 2;} class C extends B { } class D extends B{ } class E implements I { } C c2 = new C();`
downvote count: 0
favorite count: 0
tagged with: instanceof
tagged with: interface
accepted answer: http://stackoverflow.com/a/25785945
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25785961
has answer: http://stackoverflow.com/a/25785945
type: Question
has comment: http://stackoverflow.com/comment/40328922
has comment: http://stackoverflow.com/comment/40328855

http://stackoverflow.com/q/25716174
has body: I created a JAVA code, and I don't have any errors, but when I run the code, the output does this: Enter a word: Thank you for entering a word! And it does not let me enter anything, when I intend for the code to let me enter a word, then it checks if it is a word, and gives the answer if it is a word, or none if it isn't. (It is my first time asking on this site) Here's the code: package files; import java.util.Scanner; public class Testprinter { static boolean myBoolean = false; static Scanner userInput = new Scanner(System.in); public static void main(String[] args){ String usersInput; while(myBoolean != true) { System.out.print("Enter a word: "); usersInput = userInput.toString(); myBoolean = checkInput(usersInput); } checkifComplete(); } public static boolean checkInput(String usersInput){ if(usersInput == (String)usersInput) { return true; } else { return false; } } public static void checkifComplete(){ if(myBoolean = true){ System.out.print("Thank you for entering a word!"); } } }
answer count: 3
type: AnsweredQuestion
has title: How to fix a word requesting program?
linked to: http://stackoverflow.com/q/11871520
type: Question
possible better answer: http://stackoverflow.com/a/25716184
has answer: http://stackoverflow.com/a/25716229
has answer: http://stackoverflow.com/a/25716184
has answer: http://stackoverflow.com/a/25716195
accepted answer: http://stackoverflow.com/a/25716229
score: 0
tagged with: java

http://stackoverflow.com/comment/40453108
has text: One thing to keep in mind is that annotations were added to the language some years after the standard library was originally designed. If annotations had been in the language from the start, it is doubtful that Serializable would have been an interface, it probably would have been an annotation.
type: AnswerComment
type: Comment
score: 16
comment on: http://stackoverflow.com/a/25850576

http://stackoverflow.com/comment/40299373
type: Comment
type: QuestionComment
score: 2
has text: You can do `Math.ceil(x * 100) / 100.0` and this will turn 1.33333 into 1.34
comment on: http://stackoverflow.com/q/25769176

shader
tags question: http://stackoverflow.com/q/25745049
type: Tag
tag name: shader
tags question: http://stackoverflow.com/q/25789196

http://stackoverflow.com/comment/40296392
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25754558
type: AnswerComment
has text: You contradict yourself. PKCS#11 allows to use a private key that is on-card (usable but not accessible) but in your first sentence you say that this is impossible because you don't have access to the private key.

http://stackoverflow.com/comment/40340648
comment on: http://stackoverflow.com/q/25792225
score: 1
has text: @SotiriosDelimanolis make it an answer - it is just as simple as that.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25808273
upvote count: 0
answers question: http://stackoverflow.com/q/25808094
has comment: http://stackoverflow.com/comment/40370196
type: Answer
has body: public novel(String title, String writer) { super("novel"); this.title = title; this.writer = writer; } The super("novel"); calls the literature class's contructor with one parameter. The this.writer = "Unknow"; sets the novel object's writer attribute to "Unknow", because this constructor don't get the writer parameter, only the title. Maybe you can write this, instead of the code above: public novel(String title) { this(title, "Unknow"); // calls the constructor with two parameters } Edit: Thanks for the help, i just copy-pasted it, and i forget to delete the super() call.
downvote count: 1
has comment: http://stackoverflow.com/comment/40437057
has comment: http://stackoverflow.com/comment/40440237
score: -1

http://stackoverflow.com/comment/40284683
type: QuestionComment
has text: import javax.swing.JTable; public class JTableTest { public static void main(String args[]) { JTable obj1 = new JTable(); } }
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25761231

http://stackoverflow.com/a/25735940
has body: catch has to be present in a try block almost all the time except when you use finally. You need to use throw when you want to propagate the error to the caller. If you do not want to propagate the error you can catch it and not throw it back.
has comment: http://stackoverflow.com/comment/40238276
answers question: http://stackoverflow.com/q/25735922
downvote count: 3
score: -3
type: Answer
upvote count: 0

http://stackoverflow.com/a/58880832
answers question: http://stackoverflow.com/q/25847449
has body: Your remove part is working fine. When you are printing use for(String x : list) System.out.println(x); Also, include what output or error you are getting. This will help to understand your problem better. Just noticed the question is 5 years old, I think i didn't saw the date earlier properly. Hopefully someone else will find it useful.
type: Answer
score: 0

http://stackoverflow.com/comment/40428921
has text: I tried this and it does not go to the second partner, its just stops at one partner.
type: AnswerComment
comment on: http://stackoverflow.com/a/25738513
score: 0
type: Comment

http://stackoverflow.com/a/25826007
type: Answer
score: 3
downvote count: 1
answers question: http://stackoverflow.com/q/25825952
upvote count: 4
has body: You should not create such a specific function that takes strings, it's normally better to have a range function that takes ints and convert the strings using Integer.parseInt as you already said in the question. Then you can define your own function: public static List&lt;Integer&gt; range(int from, int to) { List&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(); for (int i = from; i &lt;= to; ++i) list.add(i); return list; } Otherwise if you are using Java 8 take a look at IntStream.rangeClosed. You could also use Guava's Range, they are nice because using iterators, they don't have to physically instantiate the list.
has comment: http://stackoverflow.com/comment/40402738

jpa
tags question: http://stackoverflow.com/q/25804840
tags question: http://stackoverflow.com/q/25760361
tags question: http://stackoverflow.com/q/25804365
tags question: http://stackoverflow.com/q/25786422
tags question: http://stackoverflow.com/q/25871026
tags question: http://stackoverflow.com/q/25772275
tags question: http://stackoverflow.com/q/25718191
tags question: http://stackoverflow.com/q/25865323
tags question: http://stackoverflow.com/q/25816245
tags question: http://stackoverflow.com/q/25774309
tags question: http://stackoverflow.com/q/25789580
tags question: http://stackoverflow.com/q/25846796
tags question: http://stackoverflow.com/q/25782236
tags question: http://stackoverflow.com/q/25862444
tags question: http://stackoverflow.com/q/25786815
tags question: http://stackoverflow.com/q/25728532
tags question: http://stackoverflow.com/q/25860571
tags question: http://stackoverflow.com/q/25766765
tags question: http://stackoverflow.com/q/25812061
tags question: http://stackoverflow.com/q/25749372
tags question: http://stackoverflow.com/q/25840940
tags question: http://stackoverflow.com/q/25752309
tags question: http://stackoverflow.com/q/25850540
tags question: http://stackoverflow.com/q/25862871
tags question: http://stackoverflow.com/q/25854916
tags question: http://stackoverflow.com/q/25737913
tags question: http://stackoverflow.com/q/25726505
tags question: http://stackoverflow.com/q/25771796
type: Tag
tags question: http://stackoverflow.com/q/25779961
tags question: http://stackoverflow.com/q/25766021
tags question: http://stackoverflow.com/q/25831000
tags question: http://stackoverflow.com/q/25714201
tags question: http://stackoverflow.com/q/25845204
tags question: http://stackoverflow.com/q/25772702
tags question: http://stackoverflow.com/q/25871130
tags question: http://stackoverflow.com/q/25788721
tags question: http://stackoverflow.com/q/25718229
tags question: http://stackoverflow.com/q/25718775
tags question: http://stackoverflow.com/q/25808167
tags question: http://stackoverflow.com/q/25845318
tags question: http://stackoverflow.com/q/25855678
tags question: http://stackoverflow.com/q/25760844
tags question: http://stackoverflow.com/q/25714545
tags question: http://stackoverflow.com/q/25789176
tags question: http://stackoverflow.com/q/25716485
tags question: http://stackoverflow.com/q/25770815
tags question: http://stackoverflow.com/q/25856764
tags question: http://stackoverflow.com/q/25851029
tags question: http://stackoverflow.com/q/25821579
tags question: http://stackoverflow.com/q/25863678
tags question: http://stackoverflow.com/q/25795290
tags question: http://stackoverflow.com/q/25761154
tags question: http://stackoverflow.com/q/25763570
tags question: http://stackoverflow.com/q/25863795
tags question: http://stackoverflow.com/q/25768530
tags question: http://stackoverflow.com/q/25754522
tags question: http://stackoverflow.com/q/25720691
tags question: http://stackoverflow.com/q/25718582
tags question: http://stackoverflow.com/q/25816897
tags question: http://stackoverflow.com/q/25836688
tags question: http://stackoverflow.com/q/25849456
tags question: http://stackoverflow.com/q/25821677
tags question: http://stackoverflow.com/q/25855563
tags question: http://stackoverflow.com/q/25843650
tags question: http://stackoverflow.com/q/25843528
tags question: http://stackoverflow.com/q/25721400
tags question: http://stackoverflow.com/q/25757713
tags question: http://stackoverflow.com/q/25757512
tag name: jpa
tags question: http://stackoverflow.com/q/25864840
tags question: http://stackoverflow.com/q/25724953
tags question: http://stackoverflow.com/q/25769520
tags question: http://stackoverflow.com/q/25756955
tags question: http://stackoverflow.com/q/25831546
tags question: http://stackoverflow.com/q/25802873
tags question: http://stackoverflow.com/q/25740161
tags question: http://stackoverflow.com/q/25763257
tags question: http://stackoverflow.com/q/25723343
tags question: http://stackoverflow.com/q/25856785

http://stackoverflow.com/a/25848428
accepted answer of: http://stackoverflow.com/q/25848144
answers question: http://stackoverflow.com/q/25848144
type: Answer
downvote count: 0
score: 1
has body: Your dependency is not in the Maven Central Repository. Find out the repository used by the authors to publish their artifacts and add this repository to your POM or to your settings.xml.
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25811717
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40377044
has comment: http://stackoverflow.com/comment/40376151
type: Answer
has comment: http://stackoverflow.com/comment/40377157
has body: In side the onRecieve() method use context.startActivity(yourintent); Here context is passed as an argument in onRecieve() method. You have to create yourintent as usual But you may have to set a flag to intent as follow: yourintent.setFlag(Intent.FLAG_ACTIVITY_NEW_TASK)
has comment: http://stackoverflow.com/comment/40397707
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25811700
accepted answer of: http://stackoverflow.com/q/25811700
has comment: http://stackoverflow.com/comment/40376734
has comment: http://stackoverflow.com/comment/40376375
has comment: http://stackoverflow.com/comment/40376307
upvote count: 1

http://stackoverflow.com/a/25833241
answers question: http://stackoverflow.com/q/25833233
score: 4
upvote count: 4
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40415658
has body: Try : static &lt;T extends Something&gt; void stuff(Thing thing, Iterable&lt;T&gt; stuff){ //... }

http://stackoverflow.com/comment/40420778
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25824348
has text: In this code sample you've got above, you could even access the _private_ members of the RecreationalVehicle _field_, because you're in the RV class, and private modifier allows access within the class. The Seat class is outside of this scope - RV cannot change or modify the Seat class. It's a bit of a subtle difference :/
type: AnswerComment

http://stackoverflow.com/q/25850862
downvote count: 0
has body: I made a drawer navigation based on a tutorial on the internet and I followed everything but when I open my app everything is working correctly except my onclick event. I'm pretty new to android (2 weeks) and tried to figure it out by myself but it didn't work out. I tries onclicklistener but that one didn't give any possitive feedback for me. How do I make a click event that will take me to another activity? my code: public class LayoutOneActivity extends ActionBarActivity { String[] menu; DrawerLayout dLayout; ListView dList; ArrayAdapter<String> adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_one); Resources res = getResources(); String [] menu_items = res.getStringArray(R.array.menu_items); // String array where the menu items will be stored menu = menu_items; // Variable for the menu items dLayout = (DrawerLayout) findViewById(R.id.drawer_layout); // Looking for the id "drawer_layout" and apply as layout dList = (ListView) findViewById(R.id.left_drawer); // Looking for the listview where the items will be stored adapter = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,menu);// Making a new adapter dList.setAdapter(adapter);// Give the list-layout the variable "adapter" which is an adapter (obviously) dList.setSelector(R.drawable.back);// Sets the colour of the list-layout dList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long id) { dLayout.closeDrawers();// The layout will be clossed when clicked outside the layout Bundle args = new Bundle();// New bundle which will parse the data between various activities args.putString("Menu", menu[position]); Fragment detail = new DetailFragment(); detail.setArguments(args); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, detail).commit(); } }); } layout_one <andr…
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40448968
has answer: http://stackoverflow.com/a/36676373
tagged with: onclicklistener
tagged with: onclick
has comment: http://stackoverflow.com/comment/40470422
type: UnansweredQuestion
upvote count: 1
tagged with: navigation-drawer
type: Question
score: 1
tagged with: java
has title: Android drawer navigation click events
answer count: 1

http://stackoverflow.com/comment/40312615
comment on: http://stackoverflow.com/a/25776383
score: 0
type: Comment
type: AnswerComment
has text: @KickButtowski apparently I'm not. I tried this out without running into an issue.

http://stackoverflow.com/q/25749512
tagged with: jvisualvm
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40263668
has comment: http://stackoverflow.com/comment/40263570
answer count: 1
has body: Watching in the Sampler Tab / CPU, under the CPU Samples sub-tab, i see that the most consuming method is java.lang.Thread.sleepnative. I have about 30 Threads with relative sleep() calls. But what's the meaning of this? My average reported CPU consumption is 7%, is the Thread.sleep() really using the 70% of this time? How is it possible, is it a "real" consumption?
type: UnansweredQuestion
tagged with: multithreading
has title: CPU consumption of Thread.sleep()
has answer: http://stackoverflow.com/a/25749568
has comment: http://stackoverflow.com/comment/40262862

http://stackoverflow.com/comment/40211740
type: QuestionComment
has text: can i get possible solution please..
score: 0
comment on: http://stackoverflow.com/q/25721510
type: Comment

http://stackoverflow.com/a/25749006
downvote count: 0
score: 1
has body: They mean the same thing: &lt;balance&gt;&lt;/balance&gt; is identical to &lt;balance/&gt; You can get what you want by configuring JDOM: Empty elements are by default printed as &lt;empty/&gt;, but this can be configured with Format.setExpandEmptyElements(boolean) to cause them to be expanded to &lt;empty&gt;&lt;/empty&gt;. http://www.jdom.org/docs/apidocs/org/jdom2/output/XMLOutputter.html
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25748936
answers question: http://stackoverflow.com/q/25748936
type: AcceptedAnswer

http://stackoverflow.com/comment/51354421
type: Comment
has text: @user2900150 I'm sorry, the comment was supposed to be deleted :-)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25725171

http://stackoverflow.com/q/25761916
possible better answer: http://stackoverflow.com/a/25762060
answer count: 2
has answer: http://stackoverflow.com/a/25762060
has answer: http://stackoverflow.com/a/25765064
score: 0
tagged with: rest
tagged with: sockets
has title: GET xml from URL
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/25765064
type: AnsweredQuestion
has body: I'm trying to download a XML document from a server: http://api.yr.no/weatherapi/locationforecast/1.9/?lat=60.10;lon=9.58;msl=70 Im using java to do this and using sockets is required aswell. import java.net.*; import java.io.*; public class main { /** * @param args */ public static void main(String[] args) { try { byte[] data = new byte[100000]; Socket clientSocket = new Socket(); InetSocketAddress ip = new InetSocketAddress("api.yr.no", 80); clientSocket.connect(ip); DataInputStream inData = new DataInputStream(clientSocket.getInputStream()); OutputStream outData = clientSocket.getOutputStream(); PrintWriter pw = new PrintWriter(outData, false); pw.print("GET " + "/weatherapi/locationforecast/1.9/?lat=60.10;lon=9.58;msl=70" + " HTTP/1.0\r\n"); pw.print("\r\n"); pw.flush(); int bytesread = inData.read(data); String translateddata = new String(data); System.out.print(translateddata); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { } } However after running this i dont get the xml at the URL i get: HTTP/1.1 404 Unkown host Server: Varnish Content-Type: text/html; charset=utf-8 Content-Length: 395 Accept-Ranges: bytes Date: Wed, 10 Sep 2014 09:16:22 GMT X-Varnish: 1432508106 Age: 0 Via: 1.1 varnish Connection: close <?xml version="1.0" encoding="utf-8"?> 404 Unkown host Error 404 Unkown host Unkown host Guru Meditation: XID: 1432508106 Varnish cache server So I'm guessing my GET request is wrong somehow, but I'm having trouble locating the problem. Any clues on how to build a request for this XML document?
tagged with: java
type: Question

arrays
tags question: http://stackoverflow.com/q/25845929
tags question: http://stackoverflow.com/q/25831366
tags question: http://stackoverflow.com/q/25826423
tags question: http://stackoverflow.com/q/25787831
tags question: http://stackoverflow.com/q/25859985
tags question: http://stackoverflow.com/q/25735407
tags question: http://stackoverflow.com/q/25806187
tags question: http://stackoverflow.com/q/25829683
tags question: http://stackoverflow.com/q/25759473
tags question: http://stackoverflow.com/q/25717179
tags question: http://stackoverflow.com/q/25838820
tags question: http://stackoverflow.com/q/25832432
tags question: http://stackoverflow.com/q/25814448
tags question: http://stackoverflow.com/q/25832838
type: Tag
tags question: http://stackoverflow.com/q/25752955
tags question: http://stackoverflow.com/q/25734200
tags question: http://stackoverflow.com/q/25716196
tags question: http://stackoverflow.com/q/25731589
tags question: http://stackoverflow.com/q/25791726
tags question: http://stackoverflow.com/q/25789930
tags question: http://stackoverflow.com/q/25720546
tags question: http://stackoverflow.com/q/25800815
tags question: http://stackoverflow.com/q/25715807
tags question: http://stackoverflow.com/q/25734667
tags question: http://stackoverflow.com/q/25791465
tags question: http://stackoverflow.com/q/25804499
tags question: http://stackoverflow.com/q/25839527
tags question: http://stackoverflow.com/q/25829774
tags question: http://stackoverflow.com/q/25734828
tags question: http://stackoverflow.com/q/25752062
tags question: http://stackoverflow.com/q/25798958
tags question: http://stackoverflow.com/q/25818128
tags question: http://stackoverflow.com/q/25758085
tags question: http://stackoverflow.com/q/25747583
tags question: http://stackoverflow.com/q/25757448
tags question: http://stackoverflow.com/q/25825289
tags question: http://stackoverflow.com/q/25714931
tags question: http://stackoverflow.com/q/25834008
tags question: http://stackoverflow.com/q/25713609
tags question: http://stackoverflow.com/q/25777722
tags question: http://stackoverflow.com/q/25841793
tags question: http://stackoverflow.com/q/25830463
tags question: http://stackoverflow.com/q/25828948
tags question: http://stackoverflow.com/q/25842156
tags question: http://stackoverflow.com/q/25751106
tags question: http://stackoverflow.com/q/25829552
tags question: http://stackoverflow.com/q/25719410
tags question: http://stackoverflow.com/q/25798003
tags question: http://stackoverflow.com/q/25798880
tags question: http://stackoverflow.com/q/25871228
tags question: http://stackoverflow.com/q/25735217
tags question: http://stackoverflow.com/q/25754101
tags question: http://stackoverflow.com/q/25865119
tags question: http://stackoverflow.com/q/25754328
tags question: http://stackoverflow.com/q/25813164
tags question: http://stackoverflow.com/q/25794035
tags question: http://stackoverflow.com/q/25730226
tags question: http://stackoverflow.com/q/25828903
tags question: http://stackoverflow.com/q/25714060
tags question: http://stackoverflow.com/q/25847309
tags question: http://stackoverflow.com/q/25833876
tags question: http://stackoverflow.com/q/25835325
tags question: http://stackoverflow.com/q/25714981
tags question: http://stackoverflow.com/q/25848655
tags question: http://stackoverflow.com/q/25863552
tags question: http://stackoverflow.com/q/25803521
tags question: http://stackoverflow.com/q/25751376
tags question: http://stackoverflow.com/q/25765532
tags question: http://stackoverflow.com/q/25733806
tags question: http://stackoverflow.com/q/25834996
tags question: http://stackoverflow.com/q/25820291
tags question: http://stackoverflow.com/q/25810671
tags question: http://stackoverflow.com/q/25768435
tags question: http://stackoverflow.com/q/25837814
tags question: http://stackoverflow.com/q/25834882
tags question: http://stackoverflow.com/q/25838776
tags question: http://stackoverflow.com/q/25872875
tags question: http://stackoverflow.com/q/25749881
tags question: http://stackoverflow.com/q/25742741

http://stackoverflow.com/a/25736594
type: Answer
has comment: http://stackoverflow.com/comment/40239724
has comment: http://stackoverflow.com/comment/40239688
has body: rs = sD.getSummonID(txtSummonID.getText()); if(condition to check that your id is null) { //display pop up JOptionPane.showMessageDialog(frame, "Id does not exists"); }else { // proceed further Summon s = null; try { while(rs.next()) {s = new Summon(rs.getInt("id"), rs.getString("plateNum"), rs.getDouble("amount"), rs.getString("recDate"), rs.getString("location"), rs.getString("officer")); } txtcarLicenceNo.setText(s.getCarLicenceNo()); txtAmount.setText(Double.toString(s.getAmount())); txtLocation.setText(s.getLocation()); txtOfficer.setText(s.getOfficerInCharge()); } catch (SQLException ex) { System.err.println("SQL Exception: " + ex); } }
has comment: http://stackoverflow.com/comment/40239573
accepted answer of: http://stackoverflow.com/q/25736574
score: 0
answers question: http://stackoverflow.com/q/25736574
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40239594

http://stackoverflow.com/q/25840173
has answer: http://stackoverflow.com/a/25840191
tagged with: buffer
has comment: http://stackoverflow.com/comment/40429029
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40446862
tagged with: java
has comment: http://stackoverflow.com/comment/40494170
tagged with: mmap
type: Question
tagged with: ios
has title: java.nio.MappedByteBuffer virtual/physical address
tagged with: nio
accepted answer: http://stackoverflow.com/a/25840191
score: 0
has comment: http://stackoverflow.com/comment/40493297
answer count: 1
has body: My knowledge of direct mapped buffer in practice is direct buffers always live outside of the garbage-collected heap. So I guess it is meaningful and possible to figure some interesting information out at runtime. Specifically, How could I get the starting virtual address of buffer, starting physical address of buffer, and buffer size? I'm using ubuntu, and is also very curious with the virtual -> physical translation part. Is there any tool to achieve this?

http://stackoverflow.com/comment/40346896
type: Comment
score: 0
has text: Well... as far as I know, there is no such thing OOB and it sounds too situational for a generic solution. You can, of course, make your own wrapper around the TransactionService that does whatever, but then you'd effectively be implementing one of the patterns from my original response. Heck, you could even make it somewhat generic, to e.g. find beans with Qualifiers with type names.
type: AnswerComment
comment on: http://stackoverflow.com/a/25795222

http://stackoverflow.com/comment/40445524
comment on: http://stackoverflow.com/q/25848231
type: Comment
has text: @AndersR.Bystrup No I hadn't. I suppose a solution would be to write a small app that runs the command line tools as to not have to use the complex GUI of this program as the source files dont appear to be available (they say they are but not when I visit SourceForge)... But, it defeats the object of my project - I want to learn something and achieve something fun and practical in the process, this may be a solution but a bit like putting a Prada watch in a casio box/wrapping their brilliant work in my rubbish interface.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40359964
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25801369
type: AnswerComment
has text: Thank you ! This works. And also thank you for the detail description. Just one question, if the spaces are option how to mark that I mean the spaces in between can be 0 - N. How can I mark that in the regex.

http://stackoverflow.com/q/25813025
tagged with: java
has answer: http://stackoverflow.com/a/25816310
score: 0
has answer: http://stackoverflow.com/a/25815452
answer count: 3
tagged with: android
tagged with: listener
has answer: http://stackoverflow.com/a/25813651
type: UnansweredQuestion
has title: can't attach an OnPreferenceChangeListener to my preferences
has body: First of all - I have tried almoust EVERY post I could find here on stackoverflow, but none solved it for me. I am using a begginners guide to create a simple app - hence all of the comments. my problem is that whenever I try attaching a preference to "this" the listener (i have implemented my class as a listener: settings activity implements Preference.OnPreferenceChangeListener) my app will crash! I'm trying to make the key of each preference it's summary. Please help me - I've tried every relavent result and did not help. thanks alot! This is my Settings Activity class public class SettingsActivity extends PreferenceActivity implements Preference.OnPreferenceChangeListener { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Add 'general' preferences, defined in the XML file FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); Fragment1 fragment1 = new Fragment1(); ft.replace(android.R.id.content, fragment1); ft.commit(); // For all preferences, attach an OnPreferenceChangeListener so the UI summary can be // updated when the preference changes. **Here I need to somehow attach the preferences to the listener - but I can't seem to do it without the app crashing** } /** * Attaches a listener so the summary is always updated with the preference value. * Also fires the listener once, to initialize the summary (so it shows up before the value * is changed.) */ private void bindPreferenceSummaryToValue(Preference preference) { // Set the listener to watch for value changes. //preference.setOnPreferenceChangeListener(this); // Trigger the listener immediately with the preference's // current value. onPreferenceChange(preference, PreferenceManager .getDefaultSharedPreferences(preference.getContext()) .getString(preference.getKey(), "")); } @Override public boolean onPreferenceChange(Preference preference, Object value) { String stringValue = value.toString(); if (preference instanceof L…
tagged with: preferenceactivity
type: Question

http://stackoverflow.com/q/25773118
answer count: 2
has comment: http://stackoverflow.com/comment/40306314
downvote count: 0
favorite count: 0
tagged with: abstract
has title: Abstract Data Types, sorting objects by specific variable in a list
tagged with: generics
has answer: http://stackoverflow.com/a/25773219
has body: Alright here we go. I made an ADT in form of a sortedArrayList, which has an add method looking like this: public boolean addToArray(T i) { int insertPlace = 0; for(int j=0;j&lt;size;j++) { if(i.compareTo(sortedArray[j])&lt;0) { insertPlace =j; j = size; } } if(size&gt;0) { for(int w=size-1; w&gt;=insertPlace;w--) { sortedArray[size]=sortedArray[w]; } sortedArray[insertPlace]=i; } else { sortedArray[0]=i; } size++; return true; } Now, this works wonders for my sorted ADT when the input is Strings. However, instead of strings, I want to add objects to the list in shape of Persons, an object containing 4 variables(String Country, String name, int age, int CPR). I want the Person objects to be sorted in the list by age. Here is the Person class with the compareTo method for sorting. public class Person implements Comparable&lt;Person&gt; { int cpr=200193; int age=21; String name="John Doe"; String Country="Uzbekistan"; public Person() { this.cpr=cpr; this.age=age; } public Person(String name, String Country,int cpr,int age) { this.cpr=cpr; this.age=age; this.name=name; this.Country=Country; } @Override public String toString() { return "Person [Country= " + Country + ", Name:" + name + ", Cpr: "+cpr+ ", age: "+age+"]"; } public int compareTo(Person p) { int before=-1; int after=1; int middle=0; if(this.age!=p.age) { if(this.age&gt;p.age) { return before; } if(this.age&lt;p.age) { return after; } } return middle; } Now, the problem is that the objects get sorted, since do not appear in the same order I call them to the list. I just can't figure out how they are sorted and how to make the objects sorted by age in the list. EDIT p1.addToArray(new Person()); p1.addToArray(new Person("Pete","Germany",111111,86)); p1.addToArray(new Person("John","Denmark",123456,75)); p1.addToArray(new Person("Michael Jackson", "America",112345,49)); Output: Item: Person [Country= America, Name:Michael Jackson, Cpr: 112345, age: 49] Item: Person [Country= Uzbekistan, Name:John Doe, Cpr: 2001…
has answer: http://stackoverflow.com/a/25773232
upvote count: 1
type: AnsweredQuestion
tagged with: list
possible better answer: http://stackoverflow.com/a/25773232
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40306294
has comment: http://stackoverflow.com/comment/40306411
tagged with: comparable
accepted answer: http://stackoverflow.com/a/25773219
has comment: http://stackoverflow.com/comment/40306401
type: Question

http://stackoverflow.com/q/25828722
downvote count: 2
has comment: http://stackoverflow.com/comment/40407537
tagged with: bukkit
accepted answer: http://stackoverflow.com/a/25828733
type: Question
score: -2
tagged with: minecraft
has body: So i am trying to make a plugin for the Bukkit API for Minecraft and i am having this problem with Strings were i can not remove a certain part of the String, If you could help it would be much appreciated. So the problem is occurs when i use the line of code: iter.next().toString(); That line of code prints out the input of: "ItemStack{DIAMOND_SWORD x 1}" How would i remove the " x 1" part of the String and keep the rest after that if there is something? Here is a list of things that i have tried: SubString Replace Split
has answer: http://stackoverflow.com/a/25828805
answer count: 3
has comment: http://stackoverflow.com/comment/40407536
tagged with: api
upvote count: 0
has title: How to remove certain characters from Strings in Java
tagged with: string
has answer: http://stackoverflow.com/a/25828733
favorite count: 0
possible better answer: http://stackoverflow.com/a/25828805
has answer: http://stackoverflow.com/a/25828871
has comment: http://stackoverflow.com/comment/40407901
type: AnsweredQuestion
tagged with: java

jsp
tags question: http://stackoverflow.com/q/25818119
tags question: http://stackoverflow.com/q/25775604
tags question: http://stackoverflow.com/q/25782045
tags question: http://stackoverflow.com/q/25755743
tags question: http://stackoverflow.com/q/25864956
tags question: http://stackoverflow.com/q/25762022
tags question: http://stackoverflow.com/q/25812885
tags question: http://stackoverflow.com/q/25830870
tags question: http://stackoverflow.com/q/25725035
tags question: http://stackoverflow.com/q/25863602
tags question: http://stackoverflow.com/q/25784833
tags question: http://stackoverflow.com/q/25740258
tags question: http://stackoverflow.com/q/25808796
tags question: http://stackoverflow.com/q/25792225
tags question: http://stackoverflow.com/q/25861119
tags question: http://stackoverflow.com/q/25849543
tags question: http://stackoverflow.com/q/25740476
tags question: http://stackoverflow.com/q/25727766
tags question: http://stackoverflow.com/q/25728730
tags question: http://stackoverflow.com/q/25731735
tags question: http://stackoverflow.com/q/25852629
tags question: http://stackoverflow.com/q/25850820
tags question: http://stackoverflow.com/q/25807013
tags question: http://stackoverflow.com/q/25780733
tags question: http://stackoverflow.com/q/25770974
tags question: http://stackoverflow.com/q/25725675
tags question: http://stackoverflow.com/q/25757418
tags question: http://stackoverflow.com/q/25747791
tags question: http://stackoverflow.com/q/25715864
tags question: http://stackoverflow.com/q/25829989
type: Tag
tags question: http://stackoverflow.com/q/25849716
tags question: http://stackoverflow.com/q/25864530
tags question: http://stackoverflow.com/q/25786475
tags question: http://stackoverflow.com/q/25842475
tags question: http://stackoverflow.com/q/25870162
tags question: http://stackoverflow.com/q/25851126
tags question: http://stackoverflow.com/q/25755953
tags question: http://stackoverflow.com/q/25786145
tags question: http://stackoverflow.com/q/25848242
tags question: http://stackoverflow.com/q/25856859
tags question: http://stackoverflow.com/q/25870528
tags question: http://stackoverflow.com/q/25718053
tags question: http://stackoverflow.com/q/25863000
tags question: http://stackoverflow.com/q/25802691
tags question: http://stackoverflow.com/q/25841391
tags question: http://stackoverflow.com/q/25744147
tags question: http://stackoverflow.com/q/25796449
tags question: http://stackoverflow.com/q/25758308
tags question: http://stackoverflow.com/q/25872369
tag name: jsp
tags question: http://stackoverflow.com/q/25863627
tags question: http://stackoverflow.com/q/25766671
tags question: http://stackoverflow.com/q/25795510
tags question: http://stackoverflow.com/q/25763882
tags question: http://stackoverflow.com/q/25870038
tags question: http://stackoverflow.com/q/25735396
tags question: http://stackoverflow.com/q/25747486
tags question: http://stackoverflow.com/q/25774095
tags question: http://stackoverflow.com/q/25871878
tags question: http://stackoverflow.com/q/25863309
tags question: http://stackoverflow.com/q/25776363
tags question: http://stackoverflow.com/q/25854077
tags question: http://stackoverflow.com/q/25784283
tags question: http://stackoverflow.com/q/25840092
tags question: http://stackoverflow.com/q/25762093
tags question: http://stackoverflow.com/q/25818055
tags question: http://stackoverflow.com/q/25714827
tags question: http://stackoverflow.com/q/25806467
tags question: http://stackoverflow.com/q/25796090
tags question: http://stackoverflow.com/q/25830067
tags question: http://stackoverflow.com/q/25812027
tags question: http://stackoverflow.com/q/25713607
tags question: http://stackoverflow.com/q/25797018
tags question: http://stackoverflow.com/q/25808548
tags question: http://stackoverflow.com/q/25738594
tags question: http://stackoverflow.com/q/25822298
tags question: http://stackoverflow.com/q/25820395
tags question: http://stackoverflow.com/q/25849407
tags question: http://stackoverflow.com/q/25852359

http://stackoverflow.com/q/25713640
has answer: http://stackoverflow.com/a/25734885
upvote count: 1
type: Question
tagged with: heroku
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25734885
has answer: http://stackoverflow.com/a/25734085
score: 1
has title: Foreman cannot find $JAVA_OPTS
tagged with: java
linked to: http://stackoverflow.com/q/2011311
accepted answer: http://stackoverflow.com/a/25734085
linked to: http://stackoverflow.com/q/24177496
downvote count: 0
linked to: http://stackoverflow.com/q/15390632
tagged with: windows-7-x64
favorite count: 0
answer count: 3
has body: I have an error following the next tutorial from Heroku specifically on this part [https://devcenter.heroku.com/articles/getting-started-with-java#run-the-app-locally][1] If I execute that instruction foreman throws the following error: Error: cannot find java class $JAVA_OPTS I have already declared a env variable like this: Name variable : JAVA_OPTS Variable value: -Xms256m -Xmx512m The Proc file that foreman is trying to execute has the following: web: java $JAVA_OPTS -cp target/classes:target/dependency/* Main Im clueless about what is happening. Note: I already checked some other questions Running java with JAVA_OPTS env variable Foreman terminates immediately foreman can&#39;t find java Hope someone knwos what is happening. EDIT : I answered my own question below
tagged with: foreman
has answer: http://stackoverflow.com/a/25713744

http://stackoverflow.com/a/25808426
downvote count: 0
type: Answer
upvote count: 7
accepted answer of: http://stackoverflow.com/q/25808165
answers question: http://stackoverflow.com/q/25808165
score: 7
has body: However, I have some problem with persistency. When I stop server, wait some time and start it again, messages which have to move to WorkQueue just disappear. What I do wrong? Or it's by design? You should use MessageProperties for making your messages persistence. channel.basicPublish("", "task_queue", MessageProperties.PERSISTENT_TEXT_PLAIN, message.getBytes()); Your current code `channel.queueDeclare("RetryQueue", true, false, false, args); will make the queue persistence but not the message. More here RabbitMQ Doc
type: AcceptedAnswer

http://stackoverflow.com/comment/70053885
comment on: http://stackoverflow.com/a/38476765
type: Comment
score: 1
type: AnswerComment
has text: no good solution because I have to "guess" the exception...ok, if you know your code, you probably know what exception it is, but that's not always the case.

http://stackoverflow.com/q/25844646
tagged with: unit-testing
has title: Mock or build a Jersey InboundJaxrsResponse
type: Question
tagged with: jersey
has answer: http://stackoverflow.com/a/34407924
has body: I'm fairly new developing jersey client, and has run into some problems with some testing. First off all I maybe should mention that my application is all client side, no server side stuff at all. My problem is that I would like to create a Response object of instance InboundJaxrsResponse, so far I've tried to achieve this by mocking a Response using Mockito and ResponseBuilder.build() Using Mockito: Response response = mock(Response.class); when(response.readEntity(InputStream.class)) .thenReturn(ClassLoader.getSystemResourceAsStream("example_response.xml"); this works fine, when I read out the entity of the response with response.readEntity(InputStream.class) I get the entity as expected. However I need to read the entity from the response several times. in order to achieve this I use response.bufferEntity() before I read out the entity. The first time I read the entity all works fine, but the second time I get an exception I/O stream closed... Well I figured out mocking the method bufferEntity as well like following: Response response = mock(Response.class); when(response.bufferEntity()).thenCallRealMethod(); when(response.readEntity(InputStream.class)) .thenReturn(ClassLoader.getSystemResourceAsStream("example_response.xml"); But this only results in a Error being thrown upon calling bufferEntity(), this is because bufferEntity() of Response is abstract. My other attempt is by using ResponseBuilder.build() like following: ResponseBuilder responseBuilder = Response.accepted(ClassLoader.getSystemResourceAsStream("example_response.xml")); Response response = responseBuilder.build(); This declaration is fine and by debugging my response I can see that it got correct entity and so on. But this time when I call response.bufferEntity() I get an exception thrown saying that the operation is illegal for an OutboundJaxrsResponse so by building a response in this way resulting in wrong instance of Response.class: So this ends up in three questions. Is this the way at all t…
score: 10
has comment: http://stackoverflow.com/comment/56544227
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: java-ee-7
tagged with: jersey-client
linked to: http://stackoverflow.com/q/19557672
tagged with: java
upvote count: 10

http://stackoverflow.com/comment/40473481
type: Comment
comment on: http://stackoverflow.com/a/25864887
type: AnswerComment
score: 0
has text: Thanks a lot Tom. That indeed was the issue.

http://stackoverflow.com/q/25853071
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/30743485
answer count: 5
has answer: http://stackoverflow.com/a/25853121
upvote count: 4
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/34277025
type: Question
tagged with: retrofit
tagged with: android
accepted answer: http://stackoverflow.com/a/25853121
has body: I'm using Retrofit and I want to get access to the JSON response that is returned from the server. Could someone please advise me. Thanks
has answer: http://stackoverflow.com/a/25853568
linked to: http://stackoverflow.com/q/25817604
score: 4
has answer: http://stackoverflow.com/a/25853196
tagged with: gson
has title: Retrofit How To Print Out Response JSON
possible better answer: http://stackoverflow.com/a/25853196

http://stackoverflow.com/a/25873025
answers question: http://stackoverflow.com/q/25872973
has body: No. For example, a strategy pattern may permit the strategy to be swappable at run time, and the strategy is composed within another (context) class. Immutability is a good pattern to follow, but some scenarios permit and/or require you to change composition. For example, how would you swap out the engine in your car when it blows up (above?)
upvote count: 2
score: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40405344
has text: It's called a "modal" window. It's set as a flag on the Shell.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25827511

garbage-collection
tags question: http://stackoverflow.com/q/25826704
tags question: http://stackoverflow.com/q/25844095
tags question: http://stackoverflow.com/q/25868660
tags question: http://stackoverflow.com/q/25724175
tags question: http://stackoverflow.com/q/25788014
tag name: garbage-collection
tags question: http://stackoverflow.com/q/25854603
tags question: http://stackoverflow.com/q/25845280
tags question: http://stackoverflow.com/q/25736467
type: Tag
tags question: http://stackoverflow.com/q/25715018
tags question: http://stackoverflow.com/q/25870733
tags question: http://stackoverflow.com/q/25853964
tags question: http://stackoverflow.com/q/25818068
tags question: http://stackoverflow.com/q/25832564
tags question: http://stackoverflow.com/q/25793688

http://stackoverflow.com/q/25790662
type: Question
has comment: http://stackoverflow.com/comment/40337614
has comment: http://stackoverflow.com/comment/40337929
has comment: http://stackoverflow.com/comment/40338147
tagged with: constructor
has title: If @before executes after constructor, how do you initialize the class?
score: 0
tagged with: oracle-adf
answer count: 2
has answer: http://stackoverflow.com/a/25791023
tagged with: junit4
has comment: http://stackoverflow.com/comment/40338061
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25802905
has body: I am preparing some JUnit tests in Oracle ADF and I am getting surprised because I am seeing that constructor of the tested class is executed before the @before setup() method... The issue is the constructor needs initialized variables that I was setting to constructor from the setup method... And logically I always get a beautiful NullPointerException... The only solution I can see is initialize variables directly from the constructor, but I see that very ugly Any idea? Thanks in advance guys
has comment: http://stackoverflow.com/comment/40338101
has comment: http://stackoverflow.com/comment/40338031
has comment: http://stackoverflow.com/comment/40337445

openshift
tags question: http://stackoverflow.com/q/25751716
tag name: openshift
tags question: http://stackoverflow.com/q/25844868
type: Tag

http://stackoverflow.com/q/25819160
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
has title: HSQLDB - Get last inserted or updated value
has comment: http://stackoverflow.com/comment/40393470
has comment: http://stackoverflow.com/comment/40393484
tagged with: sql
tagged with: hsqldb
has body: I need to get the last inserted data in HSQLDB. I think CALL IDENTITY() is supposed to do that, but I always get 0 with it. No idea what's wrong. Any suggestion?
answer count: 0

http://stackoverflow.com/a/25747549
has comment: http://stackoverflow.com/comment/40259711
answers question: http://stackoverflow.com/q/25747361
downvote count: 0
has comment: http://stackoverflow.com/comment/40279603
has comment: http://stackoverflow.com/comment/40259916
has comment: http://stackoverflow.com/comment/40259372
has comment: http://stackoverflow.com/comment/40260144
score: 5
has body: You need to edit your pom.xml to set the version of the compiler plugin to be used. As described on the plugin's homepage, you configure the maven-compiler-plugin in the build-section of your project's pom.xml like so: ... org.apache.maven.plugins maven-compiler-plugin 3.1 ... If you want to use the local repository of your Maven installation (instead of Eclipse's embedded version), go to Preferences -> Maven -> Installations and add your Maven installation there.
has comment: http://stackoverflow.com/comment/40259493
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40259209
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25747361

http://stackoverflow.com/a/25792010
has body: That is quite easy. There were two problems: I missed property in eclipse.ini (-Dorg.eclipse.swt.browser.DefaultType=mozilla) I used incorrect xulrunner version (need to use 24.0, downloaded from http://wiki.mozilla-x86-64.com/images/Xulrunner-24.0.en-US.win64-x86_64.zip) These steps are described in the faq: http://www.eclipse.org/swt/faq.php#howusemozilla
answers question: http://stackoverflow.com/q/25791331
type: Answer
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/25791331
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40459473
type: QuestionComment
comment on: http://stackoverflow.com/q/25856995
has text: Have you tried Container#getComponentZOrder(Component)?
score: 0
type: Comment

http://stackoverflow.com/comment/40452090
has text: @TedHopp: It's there http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#reverseOrder%28%29
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25852710

http://stackoverflow.com/q/25854718
has answer: http://stackoverflow.com/a/47688757
has answer: http://stackoverflow.com/a/41521220
tagged with: android
answer count: 4
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/25854890
accepted answer: http://stackoverflow.com/a/25854890
tagged with: java
has answer: http://stackoverflow.com/a/71094013
has body: I am playing with the DrawerListener , and unfortunately the official documentation is not quite detailed, not to say there aren't any examples given. All I want to test is showing a Toast message when the Drawer closes, but its just not happening, its not being called at all, any ideas ? Below the code public class MainActivity extends ActionBarActivity implements DrawerLayout.DrawerListener { DrawerLayout.DrawerListener mele; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final DrawerLayout olia=(DrawerLayout)findViewById(R.id.container); ListView meka=(ListView)findViewById(R.id.left_drawer); String [] karo={"meka","deka","beka"}; ArrayAdapter&lt;String&gt; mera=new ArrayAdapter&lt;String&gt; ( this,android.R.layout.simple_list_item_1,karo); meka.setAdapter(mera); olia.setDrawerListener(mele); meka.setOnItemClickListener(new OnItemClickListener () { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub olia.closeDrawers(); } }); } @Override public void onDrawerClosed(View arg0) { // TODO Auto-generated method stub Toast.makeText(MainActivity.this, "OK Opened", Toast.LENGTH_LONG).show(); Log.d("meke", "CLOSED DRAWER" ); }
tagged with: navigation-drawer
type: Question
possible better answer: http://stackoverflow.com/a/41521220
upvote count: 2
has title: onDrawerClosed and onDrawerOpened not being called
downvote count: 0
favorite count: 0

types
tags question: http://stackoverflow.com/q/25781705
type: Tag
tag name: types
tags question: http://stackoverflow.com/q/25728419
tags question: http://stackoverflow.com/q/25769458
tags question: http://stackoverflow.com/q/25831721
tags question: http://stackoverflow.com/q/25757043
tags question: http://stackoverflow.com/q/25862727
tags question: http://stackoverflow.com/q/25840826

http://stackoverflow.com/a/25811943
type: Answer
has body: Well, I found out that the jar files were not getting linked simply by specifying their root directory in the CLASSPATH. I had to explicitly add the path of all the jar files in $HADOOP_HOME/share/hadoop/common/lib and the others present in the hdfs folder, to the CLASSPATH env variable. Wrote a simple python script to do that and everything works. Here's how the script looks !/usr/bin/python import os PATH = 'path/to/your/jar/files/dir/' os.environ['CLASSPATH'] = 'temp_path' listFiles = [] list_file = '' for root, dirs, file_name in os.walk(PATH): for name in file_name: if ".jar" in name: path = os.path.join(root, name) list_file += ':' + path print list_file os.environ['CLASSPATH'] = os.environ['CLASSPATH'] + list_file print os.environ['CLASSPATH']
accepted answer of: http://stackoverflow.com/q/25808725
answers question: http://stackoverflow.com/q/25808725
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40486746
type: Comment
has text: No, It will just be more generic. If you put it in the page then it applies only to the particular webpage.
comment on: http://stackoverflow.com/a/25872186
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40467397
score: 0
type: QuestionComment
type: Comment
has text: @HotLicks I'm not saying it's always bad, what I am saying that most of the time it is. Especially when dealing with basic entity beans that need to be jsonified.
comment on: http://stackoverflow.com/q/25847561

http://stackoverflow.com/comment/40415811
has text: See edit (2)! I also tried with aliasing, but the second query always happen.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25833192

http://stackoverflow.com/comment/40309403
type: QuestionComment
score: 8
has text: the switch statement is definitely more readable.
comment on: http://stackoverflow.com/q/25774785
type: Comment

http://stackoverflow.com/q/25792929
accepted answer: http://stackoverflow.com/a/25792999
tagged with: java
tagged with: stringbuffer
answer count: 3
has body: I am implementing an monoalphabetic substitution algorithm. Keys and values ​​are stored in the HashMap, and as a parameter of the input string using a variable of StringBuffer class type: public class Mono { private StringBuffer source; private Map&lt;String, String&gt; alphabet; public Mono(String source) { this.source = new StringBuffer(source); alphabet = new HashMap&lt;&gt;(); alphabet.put("a", "f"); alphabet.put( //... etc. } public StringBuffer startEncrypt() { for (int i = 0; i &lt; source.length(); i++) { for (Map.Entry entry : alphabet.entrySet()) { if (entry.getKey().toString().equals(source.charAt(i))) { source.setCharAt(i, entry.getValue().toString()); } } } return source; } } I encountered a problem converting string to char here: source.setCharAt(i, entry.getValue().toString()); So, my question is how to do it? Or is there another, better way of replacing characters? Thanks.
possible better answer: http://stackoverflow.com/a/25793024
has answer: http://stackoverflow.com/a/25793024
has answer: http://stackoverflow.com/a/25792999
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: string
favorite count: 0
has title: Converting String symbol into char
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/25793113

http://stackoverflow.com/comment/40460723
type: Comment
has text: In none of the cases the value passed to the function gets modified (only the local copies of them). However the *state of the object* (i.e. it's fields) passed to `append` is changed. But since you use a primitive type as parameter of `incr`, there is no state. You won't see a effect either, if you try to assign a new value to `list` in `append` (e.g. `list = null;`); the changes wouldn't be visible outside of the method.
type: QuestionComment
comment on: http://stackoverflow.com/q/25857426
score: 0

http://stackoverflow.com/a/25814396
type: Answer
answers question: http://stackoverflow.com/q/25813971
has comment: http://stackoverflow.com/comment/40686266
has comment: http://stackoverflow.com/comment/40382934
upvote count: 4
has comment: http://stackoverflow.com/comment/40832516
downvote count: 0
has body: It's package-private, sure, but there are public APIs that expose the same behavior, e.g. ByteBuffer.wrap(array).getInt(index) and the other methods on ByteBuffer. You're almost certainly better off using that properly designed, well-documented public API than trying to wrap or copy internal implementation details from Java.
score: 4

http://stackoverflow.com/q/25789468
tagged with: arraylist
answer count: 4
has answer: http://stackoverflow.com/a/25789636
type: UnansweredQuestion
has title: Removing the middle elements from an arraylist
type: Question
has answer: http://stackoverflow.com/a/25789513
tagged with: java
has answer: http://stackoverflow.com/a/25789743
has body: My task is design an array list method that checks to see whether the length of the arraylist is odd or even. I can't figure out what I need to do once I divided the length by 2 to check if odd or even but I don't know what to do from here. Once found I need to remove the elements from the array which would decrease the size I assume.
score: 0
has answer: http://stackoverflow.com/a/25789529

http://stackoverflow.com/comment/40202213
score: 0
type: Comment
type: AnswerComment
has text: I'll definitely have to consider modifying the platform drawing function to allow for vertex specifications instead of performing the centering calculations for each vertex, but does it seem reasonable to approach this problem during the stage where I shift everything from immediate mode to using shaders? ie, fixing the floats in the vertex shader to more appropriately map to pixel space before hitting the rasterizer?
comment on: http://stackoverflow.com/a/25716596

http://stackoverflow.com/a/25771823
score: 2
answers question: http://stackoverflow.com/q/25771747
has body: You can get the numeric equivalent of a char using Character.getNumericValue(char): class Sample { public static void main(String ar[]) { char v1='5'; char v2='6'; int i1 = Character.getNumericValue(v1); int i2 = Character.getNumericValue(v2); System.out.println(i1 + i2); } } The function maps chars like '5' to numbers like 5. Fun fact: it also works with other numbering systems like '๕', the Thai number 5.
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/40247499
comment on: http://stackoverflow.com/q/25717892
score: 0
type: QuestionComment
type: Comment
has text: Its not clear. Please let me know if you need any information

http://stackoverflow.com/a/25723527
has comment: http://stackoverflow.com/comment/40220524
has comment: http://stackoverflow.com/comment/40220339
downvote count: 0
has body: Well for web form databinding (ie form POST) the issue is that Java reflection is weak on constructors thus it is difficult to do databinding without annotations. A long time ago I contemplated filing a bug that Springs data binding should leverage the oft forgotten @ConstructorProperties (iirc I looked into doing the patch myself but it was rather complicated and would break many things). Someone should probably file a feature request. BTW I'm talking about web databinding (and not dependency injection) because Spring has for a long time had great support for constructor based DI (immutable objects need constructor based injection). In fact I would say constructor based injection or (static method factories) are becoming the preferred practice over traditional getter/setter components (you can see this in many Spring classes changes over the years moving toward final and constructors). Anyway I was able to do web data binding with immutable objects using Jackson https://gist.github.com/agentgt/4458079 (Although its using Jackson for databinding the request does not have to be in JSON) You might also want to see Spring Webflow DataBinding to immutable objects via a constructor? where I original came up with the gist and has more info.
upvote count: 2
has comment: http://stackoverflow.com/comment/40220037
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25720135

http://stackoverflow.com/q/25765619
upvote count: 18
tagged with: oauth
tagged with: oauth-2.0
linked to: http://stackoverflow.com/q/13387698
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: 17
has body: I'm learning OAuth 2.0 and couldn't get the way of securing access token in implicit grant flow. There are some theses in specification and some upvoted SO answers looking contradicting to each other. Could somebody clear it up? Quotes from SO answers and specification that are confusing me: (From spec) Redirection URI used to deliver the access token to the client. The access token may be exposed to the resource owner or other applications with access to the resource owner's user-agent. (From spec) Access token credentials (as well as any confidential access token attributes) MUST be kept confidential in transit and storage, and only shared among the authorization server, the resource servers the access token is valid for, and the client to whom the access token is issued. Access token credentials MUST only be transmitted using TLS. (From accepted and upvoted SO answer) In the implicit flow the access token is passed as a hash fragment, only the browsers are aware of hash fragment. Browsers will pass the hash fragment directly to the destination webpage/the redirect URI which is the client's webpage (hash fragment are not part of the HTTP request) so you have to read the hash fragment using Javascript. Hash fragment cannot be intercepted by intermediary servers/routers (this is important). My question: P1 says that token delivered to client via Redirection URI and P2 says delivery channel MUST be TLS-ed. But P3 says that hash fragment not sending to the network. How access token reaches client if it is not sending because it's hash fragment? Anyway, it has to be sended by network isn't it? Or sending token with redirection URI makes some magic without network deals? The only probable explanation - under the hood browser sends only non-hash part of url by network and after loading new page, just inserts hash fragment and make it available to JS. If I'm right I still can't understand why don't we simply send token with reliable, secured HTTPS channel as response para…
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/25786877
accepted answer: http://stackoverflow.com/a/25786877
favorite count: 0
has title: How exactly hash fragment based security works?
tagged with: user-agent

http://stackoverflow.com/a/25729615
accepted answer of: http://stackoverflow.com/q/25729553
upvote count: 43
answers question: http://stackoverflow.com/q/25729553
type: AcceptedAnswer
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/81492961
has body: When you call Arrays.asList it does not return a java.util.ArrayList. It returns a java.util.Arrays$ArrayList which is a fixed size list backed by the original source array. In other words, it is a view for the array exposed with Java's collection-based APIs. String[] sourceArr = {"A", "B", "C"}; List&lt;String&gt; list = Arrays.asList(sourceArr); System.out.println(list); // [A, B, C] sourceArr[2] = ""; // changing source array changes the exposed view List System.out.println(list); //[A, B, ] list.set(0, "Z"); // Setting an element within the size of the source array System.out.println(Arrays.toString(sourceArr)); //[Z, B, ] list.set(3, "Z"); // java.lang.ArrayIndexOutOfBoundsException System.out.println(Arrays.toString(sourceArr)); list.add("X"); //java.lang.UnsupportedOperationException list.remove("Z"); //java.lang.UnsupportedOperationException You cannot add elements to it and you cannot remove elements from it. If you try to add or remove elements from them you will get UnsupportedOperationException.
has comment: http://stackoverflow.com/comment/95939930
score: 42

http://stackoverflow.com/comment/40388788
type: QuestionComment
has text: @Gian thanks for point that out. Renamed it for a separate test case. What needs to be clarified?
comment on: http://stackoverflow.com/q/25818128
score: 0
type: Comment

http://stackoverflow.com/a/25743818
has comment: http://stackoverflow.com/comment/40256590
upvote count: 2
has comment: http://stackoverflow.com/comment/40256077
has body: As the Error points out, you have problems with permission. (Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "file.encoding" "read")) Further, you are missing the security-Tag in your JNLP: <?xml version="1.0" encoding="utf-8"?> Jnlp Test Test <homepage href="http://localhost:8585/" /> Test <all-permissions/> <!-- SEE HERE FOR EXAMPLE --!> <j2se version="1.6+" /> <jar href="TestJnlp.jar" /> <application-desc main-class="com.test.TestJnlp" /> IMPORTANT EDIT: As of Java 7u51, there are some changes in security! you may check following: https://blogs.oracle.com/java-platform-group/entry/new_security_requirements_for_rias Persmission-Info also needs to be added to META-INF/MANIFEST.MF!
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25743090

http://stackoverflow.com/comment/40382565
comment on: http://stackoverflow.com/a/25814079
type: Comment
has text: @Nulano: `ByteBuffer` is complicated, but it's also very, very tightly optimized. It's intended _exactly_ for the sort of use case you're describing. And as described in my answer, it's not particularly long or complicated to use for what you're describing.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25847508
tagged with: log4j2
has comment: http://stackoverflow.com/comment/40441776
type: AnsweredQuestion
score: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25847745
type: Question
downvote count: 0
has body: I've run into an issue trying to log into a log file and the console using Log4j 2. I'm using JSON configuration, which is loaded just fine. My configuration (log4j2.json) in its entirety is as follows: { "configuration": { "appenders": { "Console": { "name": "consoleAppender", "PatternLayout": { "pattern": "%d{DEFAULT} %-5p [%t]: %m%n" } }, "File": { "name": "fileAppender", "fileName": "log.txt", "PatternLayout": { "pattern": "%d{DEFAULT} %-5p [%t]: %m%n" } } }, "loggers": { "logger": { "name": "fileLogger", "level": "info", "appender-ref": { "ref": "fileAppender" } }, "root": { "level": "info", "appender-ref": { "ref": "consoleAppender" } } } } } I've tested logging with the following class: import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class LoggingTest { static final Logger log = LogManager.getLogger(LoggingTest.class.getName()); public static void main(String[] args) { log.trace("A trace log from " + LoggingTest.class.getName() + ".main(String[])"); log.debug("A debug log from " + LoggingTest.class.getName() + ".main(String[])"); log.info("An info log from " + LoggingTest.class.getName() + ".main(String[])"); log.warn("A warn log from " + LoggingTest.class.getName() + ".main(String[])"); log.error("An error log from " + LoggingTest.class.getName() + ".main(String[])"); log.fatal("A fatal error log from " + LoggingTest.class.getName() + ".main(String[])"); } } When executed the console, as expected, contains the following messages: 2014-09-15 14:40:42,411 INFO [main]: An info log from LoggingTest.main(String[]) 2014-09-15 14:40:42,412 WARN [main]: A warn log from LoggingTest.main(String[]) 2014-09-15 14:40:42,412 ERROR [main]: An error log from LoggingTest.main(String[]) 2014-09-15 14:40:42,412 FATAL [main]: A fatal error log from LoggingTest.main(String[]) The log file log.txt is created, but remains empty. I've also tried using the RollingFileAppender with the exact same outcome. I tried changing the loggers' append…
answer count: 1
favorite count: 0
upvote count: 2
has title: Why is only the root logger working in Log4j 2 with JSON config?
has comment: http://stackoverflow.com/comment/40441715
accepted answer: http://stackoverflow.com/a/25847745

deserialization
type: Tag
tags question: http://stackoverflow.com/q/25768137
tag name: deserialization
tags question: http://stackoverflow.com/q/25742724

http://stackoverflow.com/comment/40344359
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25793751
type: QuestionComment
has text: can you post the xml for `R.layout.activity_map`

http://stackoverflow.com/a/25834663
score: 0
has body: Well, this might not be what you want to hear but I think all the calcs must be placed within the triangle object. So you would end up with something like: public interface Triangle { int X1(); int Y1(); int X2(); int Y2(); int X3(); int Y3(); double a(); double b(); double c(); boolean isTheSumOfSidesLessThanAThird(); boolean isATriangleInAccordancePythagorianTheorem(); } After refactoring the triangle class, I would tidy up the asserts: // Given... Rtriangle test = RtriangleProvider.getRtriangle(); // When and Then... assertThat(test, isNotNullValue()); assertThat(test.isTheSumOfSidesLessThanAThird(), isTrue()); assertThat(test.isATriangleInAccordanceWithPythagorianTheorem(), isTrue()); I think the calcs to assert whether the sum of the sides is &lt; than a 3rd and if the triangle is Pythagorian belong to the triangle itself so I would start off by moving these methods to the triangle class. You should avoid keeping complex logic (such as these calcs) in the test itself because you may make a mistake when writing the test code and, depending on what mistake you made, the test will pass with flying colors though it asserts wrong values. There are situations where you cannot avoid writing complex logic in the test but you must do everything you can to avoid being caught in these situations. I don't know how this RTriangleProvider class works but you should be able to mock its behaviour so that it sets known values for Xs and Ys and therefore you would know what to expect when calling a(), b(), c(), isTheSumOfSidesLessThanAThird() and isATriangleInAccordanceWithPythagorianTheorem(). Keep in mind: If you are going to mock the RTriangleProvider, you might need to make its factory method non-static. If you cannot mock the behaviour of the RTriangleProvider, you may want to review its design and implementation because it's likely it has technical flaws.
answers question: http://stackoverflow.com/q/25833570
type: Answer

http://stackoverflow.com/q/25844026
has comment: http://stackoverflow.com/comment/40443186
upvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25848375
tagged with: bouncycastle
has comment: http://stackoverflow.com/comment/40439891
score: 6
linked to: http://stackoverflow.com/q/1179672
has title: Key length limit with Java Cryptography Extension
type: Question
tagged with: jca
has comment: http://stackoverflow.com/comment/40437162
has comment: http://stackoverflow.com/comment/40439964
tagged with: java
has body: I am aware that the keylenght in the Sun/Oracle JVM is limited for judical reasons. However as far as I understood the concept of the JCE (Java Cryptography Extension) is that a user can choose it's own security provider to compensate this limitation. For this reason I am trying to operate the Bounce Castle as security provider in conjunction with the Orcale JDK 1.7. In order to figure out the actual allowed keylegths I am using this code: import org.bouncycastle.jce.provider.BouncyCastleProvider; import javax.crypto.Cipher; import java.security.GeneralSecurityException; import java.security.Provider; import java.security.Security; public class JCETest { public static void main( String[] args ) throws GeneralSecurityException { BouncyCastleProvider bouncyCastleProvider = new BouncyCastleProvider(); Security.addProvider(bouncyCastleProvider); System.out.println( "\nSecurity-Provider:" ); for( Provider prov : Security.getProviders() ) { System.out.println( " " + prov + ": " + prov.getInfo() ); } System.out.println( "\nMaxAllowedKeyLength (for '" + Cipher.getInstance("AES").getProvider() + "' using current 'JCE Policy Files'):\n" + " DES = " + Cipher.getMaxAllowedKeyLength( "DES" ) + "\n" + " Triple DES = " + Cipher.getMaxAllowedKeyLength( "Triple DES" ) + "\n" + " AES = " + Cipher.getMaxAllowedKeyLength( "AES" ) + "\n" + " Blowfish = " + Cipher.getMaxAllowedKeyLength( "Blowfish" ) + "\n" + " RSA = " + Cipher.getMaxAllowedKeyLength( "RSA" ) + "\n" ); } } The output for the Orcale JDK 1.7 and it's build in providers is: Security-Provider: SUN version 1.7: SUN (DSA key/parameter generation; DSA signing; SHA-1, MD5 digests; SecureRandom; X.509 certificates; JKS keystore; PKIX CertPathValidator; PKIX CertPathBuilder; LDAP, Collection CertStores, JavaPolicy Policy; JavaLoginConfig Configuration) SunRsaSign version 1.7: Sun RSA signature provider SunEC version 1.7: Sun Elliptic Curve provider (EC, ECDSA, ECDH) SunJSSE version 1.7: Sun JSSE provider(PKCS12, SunX509 key/trust …
has comment: http://stackoverflow.com/comment/40440639
accepted answer: http://stackoverflow.com/a/25848375
has comment: http://stackoverflow.com/comment/40436129
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40436414
favorite count: 0
tagged with: jce
tagged with: cryptography

http://stackoverflow.com/q/25806187
has answer: http://stackoverflow.com/a/25806470
tagged with: arraylist
has title: Value of arraylist keeps reseting in meny
type: AnsweredQuestion
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/40366167
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25806470
has body: I'm going to try and explain this the best I can. In school we are making a program that allows you to choose if you want to make a array or a ArrayList then add numbers to them. That part is working fine. The problem is in the meny you are also going to get the options to convert an array to ArrayList and the other way around. When I try to send in the array or arraylist to the class using a case switch, I get the error that I have not initialized. But if I set it to null to start with it, will just reset the users input the next time it starts the meny. So I'm wondering if there is a way to initialize the array and arraylist once, and then skip it the next time around? I know this is a bad explanation but if you look at the code maybe you understand what I'm trying to ask. package labb; import java.util.ArrayList; import java.util.Scanner; public class Meny { @SuppressWarnings("resource") public static boolean meny(Scanner input){ Scanner inputMeny = new Scanner(System.in); ArrayList&lt;Integer&gt; arrayListNumbers = null; System.out.println("\n What do you want to do? \n 1 : Arraylist? \n 2 : Array? \n 3 : Convert your Array to an Arraylist \n 4 : Convert your Arraylist to an Array \n 5 : Exit"); int answer = inputMeny.nextInt(); switch(answer){ case(1)://arrayList arrayListNumbers = Array.readNumbersFromUser(input); PrintNumbers.PrintOutNumbers(arrayListNumbers); System.out.println("\n"); PrintNumbers.PrintOutNumbers2(arrayListNumbers); return true; case(2)://array int[] arrayNumbers = Array.readNumbersFromUserArray(input); PrintNumbers.printNumbersArray(arrayNumbers); System.out.println(); PrintNumbers.printNumbers2Array(arrayNumbers); return true; case(3)://array to arrayList case(4)://arrayList to array int[] array = Convert.convertArrayListToArray(arrayListNumbers); case(5): System.out.println("Good bye"); inputMeny.close(); return false; default: System.out.println("Wrong input"); inputMeny.close(); return false; } } }
type: Question
tagged with: java
upvote count: 1
answer count: 1

http://stackoverflow.com/q/25713251
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25714401
upvote count: 2
has answer: http://stackoverflow.com/a/25714401
tagged with: java
has body: I am building my site for the first time with Wicket and I want to create a portal, where the username would be displayed on multiple places (user menu, header, maybe somewhere else on the page..). Wicket apparently doesn't like labels with the same wicket:id, because I get: The component [Component id = userName] was rendered already. You can render it only once during a render phase. Is there some other way to display the same dynamic text on different places without creating a new label for each and every one?
type: Question
has title: Wicket - Display same text on multiple places
has comment: http://stackoverflow.com/comment/40195179
has answer: http://stackoverflow.com/a/25713500
answer count: 2
has comment: http://stackoverflow.com/comment/40195327
downvote count: 0
favorite count: 0
tagged with: wicket
accepted answer: http://stackoverflow.com/a/25713500

mysql
tags question: http://stackoverflow.com/q/25723343
tags question: http://stackoverflow.com/q/25737018
tags question: http://stackoverflow.com/q/25862498
tags question: http://stackoverflow.com/q/25776794
tags question: http://stackoverflow.com/q/25871629
tags question: http://stackoverflow.com/q/25812633
tags question: http://stackoverflow.com/q/25727099
tags question: http://stackoverflow.com/q/25801264
tags question: http://stackoverflow.com/q/25807418
tags question: http://stackoverflow.com/q/25784926
tags question: http://stackoverflow.com/q/25746509
tag name: mysql
tags question: http://stackoverflow.com/q/25732088
tags question: http://stackoverflow.com/q/25792134
tags question: http://stackoverflow.com/q/25843199
tags question: http://stackoverflow.com/q/25844890
tags question: http://stackoverflow.com/q/25844862
tags question: http://stackoverflow.com/q/25745495
tags question: http://stackoverflow.com/q/25866957
tags question: http://stackoverflow.com/q/25743447
tags question: http://stackoverflow.com/q/25725035
tags question: http://stackoverflow.com/q/25780996
tags question: http://stackoverflow.com/q/25784833
tags question: http://stackoverflow.com/q/25798983
tags question: http://stackoverflow.com/q/25740149
tags question: http://stackoverflow.com/q/25767784
tags question: http://stackoverflow.com/q/25717892
tags question: http://stackoverflow.com/q/25742440
tags question: http://stackoverflow.com/q/25736619
tags question: http://stackoverflow.com/q/25814212
tags question: http://stackoverflow.com/q/25827079
tags question: http://stackoverflow.com/q/25856532
tags question: http://stackoverflow.com/q/25803260
tags question: http://stackoverflow.com/q/25784252
tags question: http://stackoverflow.com/q/25770711
tags question: http://stackoverflow.com/q/25753082
tags question: http://stackoverflow.com/q/25861862
tags question: http://stackoverflow.com/q/25819835
tags question: http://stackoverflow.com/q/25764169
type: Tag
tags question: http://stackoverflow.com/q/25752475
tags question: http://stackoverflow.com/q/25798984
tags question: http://stackoverflow.com/q/25720308
tags question: http://stackoverflow.com/q/25867429
tags question: http://stackoverflow.com/q/25805743
tags question: http://stackoverflow.com/q/25718775
tags question: http://stackoverflow.com/q/25855678
tags question: http://stackoverflow.com/q/25764778
tags question: http://stackoverflow.com/q/25829164
tags question: http://stackoverflow.com/q/25741463
tags question: http://stackoverflow.com/q/25810077
tags question: http://stackoverflow.com/q/25758128
tags question: http://stackoverflow.com/q/25864841
tags question: http://stackoverflow.com/q/25806263
tags question: http://stackoverflow.com/q/25858284
tags question: http://stackoverflow.com/q/25798250
tags question: http://stackoverflow.com/q/25723388
tags question: http://stackoverflow.com/q/25734450
tags question: http://stackoverflow.com/q/25720691
tags question: http://stackoverflow.com/q/25737927
tags question: http://stackoverflow.com/q/25714246
tags question: http://stackoverflow.com/q/25821677
tags question: http://stackoverflow.com/q/25769544
tags question: http://stackoverflow.com/q/25813993
tags question: http://stackoverflow.com/q/25847798
tags question: http://stackoverflow.com/q/25757013
tags question: http://stackoverflow.com/q/25768135
tags question: http://stackoverflow.com/q/25811732
tags question: http://stackoverflow.com/q/25785956
tags question: http://stackoverflow.com/q/25753220
tags question: http://stackoverflow.com/q/25738350
tags question: http://stackoverflow.com/q/25715586
tags question: http://stackoverflow.com/q/25763319
tags question: http://stackoverflow.com/q/25800357

search-engine
type: Tag
tags question: http://stackoverflow.com/q/25813162
tags question: http://stackoverflow.com/q/25815654
tag name: search-engine

http://stackoverflow.com/q/25845333
has answer: http://stackoverflow.com/a/25845448
score: 0
answer count: 2
tagged with: sql
has body: I am trying to update a table with a JSON call. @Override public List&lt;GroupsDetails&gt; editGroupList(String Name, String startDate, String endDate, Integer Status_GroupID, Integer GroupsID) { SessionFactory sessionFactory=HibernateSessionManager.getSessionFactory(); Session session=sessionFactory.getCurrentSession(); Transaction transaction=session.beginTransaction(); try{ transaction.begin(); @SuppressWarnings("unchecked") List&lt;GroupsDetails&gt; groupList=session.createQuery("UPDATE GroupsDetails SET Name='" + Name + "', StartDate='" + startDate + "', EndDate='" + endDate + "', Status_GroupID=" + Status_GroupID + " WHERE GroupsID=" + GroupsID).list(); System.out.println(startDate); return groupList; }finally{ session.close(); } } But I keep getting an error which says that does not support DML operations. The error is : Request processing failed; nested exception is org.hibernate.hql.QueryExecutionRequestException: Not supported for DML operations [UPDATE com.nebuilder.ats.pojo.GroupsDetails SET Name='Alpha', StartDate='21-06-2014', EndDate='23-08-2014', Status_GroupID=1 WHERE GroupsID=1] org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.hibernate.hql.QueryExecutionRequestException: Not supported for DML operations [UPDATE com.nebuilder.ats.pojo.GroupsDetails SET Name='Alpha', StartDate='21-06-2014', EndDate='23-08-2014', Status_GroupID=1 WHERE GroupsID=1] org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:894) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) When Im trying createSQLQuery Request processing failed; nested exception is org.hibernate.exception.GenericJDBCException: could not execute query org.springframework.web.util.NestedServletExce…
has title: SQL syntax error while trying to retrieve primary key
tagged with: spring
has answer: http://stackoverflow.com/a/25845575
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40438057
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40438155
type: Question
accepted answer: http://stackoverflow.com/a/25845448
has comment: http://stackoverflow.com/comment/40438030
has comment: http://stackoverflow.com/comment/40438207
possible better answer: http://stackoverflow.com/a/25845575

http://stackoverflow.com/q/25716485
has comment: http://stackoverflow.com/comment/40229820
has comment: http://stackoverflow.com/comment/40204908
tagged with: primary-key
tagged with: java
has title: Generating unique IDs
has comment: http://stackoverflow.com/comment/40201486
has comment: http://stackoverflow.com/comment/40238345
type: Question
tagged with: jpa
tagged with: database
score: 0
has comment: http://stackoverflow.com/comment/40202243
has body: Lets consider that I have a simple bug tracking system hosted on 10 servers and there is a centralized database. I have to ensure that bug ID is unique at all times and of course ID should be meaningful. Couple of alternatives that I can think of are Use an ID generation strategy provided by ORM frameworks such JPA (may be a sequence generator strategy or more precisely a Table generation strategy can be adopted). However I see these strategies as an increased overload on database as we are asking it to generate an ID before we insert it into the table. I can use UUID which provides an Unique ID but those are not meaningful. Those are just 128 bit numbers. Can we come up with a strategy that lets us to create ID at the application level and pass it on to Database just to insert it. Point worth noticing is its a distributed environment where there are can be concurrent session yet the ID generated by the applications running in various servers should be Unique. Apologies for writing an essay before I put in my question but just looking for best way to handle the requirement and clear off any myths that I have in the approaches I mentioned above :)
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25727605
answer count: 1
has comment: http://stackoverflow.com/comment/40226230
has comment: http://stackoverflow.com/comment/40228815
has comment: http://stackoverflow.com/comment/40273765
has body: Problem (small concise version): I have a jar file that I can edit, but I want to make a method, in a specific class in that jar to call another class that will be under another jar. The idea is that the existing.jar would only have the method call the external.jar and the external.jar would return a value to the existing.jar in order to continue its processing. Problem (long detailed version): I use p6spy to capture the sqls that my application generates but I need to filter that sql to a very specific level, not only the function "sqlExpression" of p6spy does not work as even if it did it would not be sufficient. I currently have decompiled (I did not find the sources of the project, and yes, it is an open source project) p6spy and edited the formattedlogger.class in order to suit my need. My problem is, this is a "solution" that many people will have to use and the filter that I applied is not enough to some and to other simply doesnt work because they need something I need excluded. I did a bit of research and decided that I should take the adapter route, I decided that the p6spy.jar will remain untouched, but it will call a class from another jar file which will then contain the specificity of the filter. But I do not know how to do that. :( Scenario: OS: CentOS release 6.4 (Final) Which most likely is a virtual machine. Application Server: jboss-4.3.0.GA Which contains multiple instances under the server folder. I have the p6spy.jar under the app_server/server/instance/lib I understand that I will have to have the adapter under the same folder. Does anyone have any idea how this should be done, where I could read about such things or how I should proceed, maybe a different solution or perhaps another idea. I'm open to suggestions. *Edit 1: I have a p6spy.jar file which contains a class that I edit to suit my needs. (FormattedLogger.class) the class is at it follows: package com.p6spy.engine.logging.appender; public abstract class FormattedLogger { protected St…
has comment: http://stackoverflow.com/comment/40539735
has comment: http://stackoverflow.com/comment/40305547
accepted answer: http://stackoverflow.com/a/25744164
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40222712
tagged with: java
has comment: http://stackoverflow.com/comment/40231654
has comment: http://stackoverflow.com/comment/40252603
tagged with: p6spy
has answer: http://stackoverflow.com/a/25744164
type: Question
has comment: http://stackoverflow.com/comment/40223030
tagged with: adapter
has comment: http://stackoverflow.com/comment/40226213
score: 0
has title: How to implement a adapter pattern (or a more eloquent solution to the following situation)?
has comment: http://stackoverflow.com/comment/40229343

http://stackoverflow.com/comment/40443264
type: Comment
type: QuestionComment
has text: Compilation issue :)
comment on: http://stackoverflow.com/q/25847391
score: 0

http://stackoverflow.com/q/25833912
answer count: 1
has title: Android Testing - Cannot set the proper config
favorite count: 0
has body: I've an Android app, and I'd like to create test cases for it. I've read the Docs in the Android Dev's docs, and tried a lot of things... Here's the main structure of my app: I created the SadAppTest class, by ALT+ENTER over the SadApp extends Application class in the editor, and choose the Create Test option, see: Here's the code of the generated test class: package com.procode.saveadog; import android.test.ApplicationTestCase; /** * Testing Fundamentals */ public class SadAppTest extends ApplicationTestCase<SadApp> { public SadAppTest() { super(SadApp.class); } } I tried to add a simple test, which tests something in the SadApp class. In the docs, I read that I should get the Application object in the code by the getActivity() function. I've created a very simple test, which asks the User's UUID from the Application class, and compares, that the given UUID will be the same. Code: public void testUserUuid(){ assertEquals(getApplication().getUserId(), getApplication().getUserId()); } But this test throws a NullPointerException! java.lang.NullPointerException at com.example.myapp.SadAppTest.testUserUuid(SadAppTest.java:14) at java.lang.reflect.Method.invokeNative(Native Method) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191) at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176) at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554) at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701) Precisly the getActivity() method gives back null, 'cause this test runs fine: public void testUserUuid(){ assertTrue(getApplication() == null); } What am I missing?
has answer: http://stackoverflow.com/a/27066438
accepted answer: http://stackoverflow.com/a/27066438
tagged with: android
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: unit-testing
type: Question
tagged with: testing
upvote count: 1

http://stackoverflow.com/a/25763562
has comment: http://stackoverflow.com/comment/40293889
score: 5
has comment: http://stackoverflow.com/comment/40320354
has body: Lets walk through the code: Assign s1 to the String "java" and assign s2 to the String "". String s1="java"; String s2=""; Loop from i = s1.length() - 1 to i &gt;= 0 downwards. for (int i=s1.length()-1;i&gt;=0;i--) { s2+=s1.charAt(i); } Lets go through this: Iteration 1, i = s1.length() - 1 = 3, the code becomes: s2 += s1.charAt(3); What does this mean? Well, += is a compound concatenation operator, so lets replace it: s2 = s2 + s1.chartAt(3); charAt(n) gives the nth character of a String, zero indexed - lets replace that too: s2 = s2 + "a" So, we take s2 which is "" and concat it with "a", we assign the result back to s2. Iteration 2, i = 2, the code becomes: s2 += s1.charAt(2); Now, we know that s1.charAt(2) is "v" and s2 is "a" so: s2 = "a" + "v" = "av" Iteration 3, i = 1, the code becomes: s2 += s1.charAt(1); Now, we know that s1.charAt(1) is "a" and s2 is "av" so: s2 = "av" + "a" = "ava" Iteration 4, i = 0, the code becomes: s2 += s1.charAt(0); Now, we know that s1.charAt(0) is "j" and s2 is "ava" so: s2 = "ava" + "j" = "avaj" And the loop terminates since i &lt;= 0. So what does the line s2+=s1.charAt(i) do? It takes the ith character (zero indexed) of s1 and appends it to s2. It should be noted that this code can be written much more efficiently as: String s1 = "java"; String s2 = new StringBuilder(s1).reverse().toString(); This has two advantages: It is much shorter and more readable. It is much faster, the concatenation operator on a String must: create a new char[] of size left.length + right.length copy the original String's contents into the char[] copy the rhs contents into the char[] 4 return the char[] wrapped in a new String This is very expensive - to add a single character to a String the entire original String must be copied over. This is because String is immutable. Don't believe me - read this excellent article. Then never use String += in a loop again.
upvote count: 5
has comment: http://stackoverflow.com/comment/40294327
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25763357
answers question: http://stackoverflow.com/q/25763357
type: Answer
has comment: http://stackoverflow.com/comment/40350736

http://stackoverflow.com/comment/82655713
type: Comment
has text: I do not know English very well right now. if you want I'm write turkish, you translate google.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/47844026

http://stackoverflow.com/a/31062162
upvote count: 8
type: Answer
has body: Can't leave a comment because I don't have enough reputation. I have also bumped into this question when I set this as an environment variable in Windows. It turns out you need to use ^ to escape | character instead. http://www.robvanderwoude.com/useless.php#EscapeChar So this worked for me -Dhttp.nonProxyHosts=localhost^|127.0.0.1^|*.foo.com
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25744252
score: 8
answers question: http://stackoverflow.com/q/25744252

http://stackoverflow.com/comment/40437790
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25844530
has text: I will surely make a note about it. Thanks again for the help.
type: Comment

http://stackoverflow.com/q/25756919
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40276847
tagged with: forms
has comment: http://stackoverflow.com/comment/40276876
type: Question
accepted answer: http://stackoverflow.com/a/25757053
has title: Adding "New" fields once existing fields are filled in
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25757053
has body: I've programmed in Java before, but I'm fairly new to creating GUI's, and as such, am new to Swing. I'm trying to create a mastermind-like game where the user has a certain number of guesses to determine the secret code. The problem I am having is finding a way to have the input fields for the potentially varying number of turns appear one at a time. If the user gets 10 guesses, only the input field and submit button for the first guess appear to begin with. After submitting the first guess, the second field and submit button should appear. After the second is submitted, the 3rd set appears, and so on and so forth until the user either gets the code correct or exhausts all his turns. I've got a solid game, as it worked beautifully as a CLI-based application, but I really want to turn it into a GUI, and this one aspect is bogging me down. Thanks in advance for any help that might be provided. I received feedback that my scope was too broad or something of that nature. I'm not sure how I can make this question any less broad. What I want to do is have a guess field in a window and a submit button that replicate a specified number of times or until the guess is correct. For example, The game in question is similar to mastermind. When the game starts, one input box and one submit button display. If the user gets it wrong, a new guess box and a new submit button display for the second guess. This process continues until the user has guessed X number of times or until the user gets the code right. I know how to add fields statically at the beginning, but I want to form to be dynamic and change as the game progresses, and this is specifically what I am having trouble getting to happen. I can't even find where to begin looking for the answer. I have been through the Swing documentation, and many other tutorials and resources for both Java and Swing, and I have yet to find or devise a clear solution. If it helps in narrowing down where to focus, I was able to get the game up…
tagged with: user-interface
has comment: http://stackoverflow.com/comment/40300117
has answer: http://stackoverflow.com/a/25756954
tagged with: field
has comment: http://stackoverflow.com/comment/40300028
tagged with: swing
possible better answer: http://stackoverflow.com/a/25756954

http://stackoverflow.com/q/25752930
answer count: 1
has title: How does AffineTransform work?
has comment: http://stackoverflow.com/comment/40269721
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25753781
tagged with: swing
tagged with: java
type: Question
tagged with: concatenation
tagged with: transformation
has comment: http://stackoverflow.com/comment/40269541
linked to: http://stackoverflow.com/q/3405799
score: 0
has body: How does concatenation of matrices makes sense when defining operators? Why are there even 3 dimensional matrices when we are dealing with 2 dimensions? I feel really stupid asking this but I lack any kind of information about this even though I'm quite familiar with vector analysis and algebra... Why aren't just the transformation or scaling matrices multiplied and then applied as an operator to the coordinates? I'm trying to make a zoom-to-mouse feature to my already translatable-by-mouse grid and for 2 days I just can't. Is there a way to use setTranslate or setScale on the transformer without resetting the already existing operator? How does the composition of concatenation work? EDIT Finally I got the zoom-to-and-from-a-point algorithm right... The trick is to apply translations that are dependent on the zoomLevel itself before you apply anything else, while saving the previous operator: (In case someone is interested in this..) AffineTransform savedTransform = new AffineTransform(transformer); AffineTransform tempTransform = new AffineTransform(); tempTransform.translate(-0.25*(mouseX-transOfGridXD-game.curWS*sF*sqSize/2), -0.25*(mouseY-transOfGridYD-game.curWS*sF*sqSize/2)); //sF is the zoom level, game.curWS*sqSize is the grid size in pixels, transOfGrid is the translation of the transform tempTransform.concatenate(savedTransform); transformer.setTransform(tempTransform ); transformer.translate(-(game.curWS)*sqSize*0.125, -(game.curWS)*sqSize*0.125); transformer.scale(1.25, 1.25);
has comment: http://stackoverflow.com/comment/40270974

http://stackoverflow.com/q/25827055
has title: Time complexity of hash table and arraylist
has comment: http://stackoverflow.com/comment/40404629
score: 0
has comment: http://stackoverflow.com/comment/40404666
upvote count: 1
has comment: http://stackoverflow.com/comment/40404582
favorite count: 0
linked to: http://stackoverflow.com/q/4100677
has comment: http://stackoverflow.com/comment/40404571
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25827106
downvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40404616
type: Question
has body: Why is the time complexity of haskey is O(1). For finding a key it has to iterate all the element on the list so why it is O(1) What is the time complexity of contains method of arraylist
answer count: 1
has comment: http://stackoverflow.com/comment/40404736

http://stackoverflow.com/q/25829412
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25922544
upvote count: 2
tagged with: maven
downvote count: 1
has body: I am having trouble running a java application (static void main) with the m2e plugin. I have created a multi-module project through the ordinary eclipse wizard. It seems as if code in the test directory of one module cannot reference code in the test directory of another module at runtime (compiling works just fine). Version information Eclipse = Luna, Build 4.4.0, Build id 20140612-0600 m2e = 1.5.0.20140606-0033 I have created an extremely simple (and contrived) example to demonstrate my problem. Please go easy on me for the pointlessness of this code. Also, forgive me for the verbosity here. Sadly maven questions almost require it. Here is the project directory structure: --Project Explorer |--animals/ |--src/test/java/ |--com.example.problem.animals |--Animal.java |--JRE System Library [JavaSE-1.8] |--src/ |--target/ |--pom.xml |--dogs/ |--src/test/java/ |--com.example.problem.animals |--Beagle.java |--JRE System Library [JavaSE-1.8] |--Maven Dependencies |--animals/ |--src/ |--target/ |--pom.xml |--parent/ |--animals/ |--dogs/ |--src/ |--pom.xml The parent module pom.xml: 4.0.0 com.example.problem parent 0.0.1-SNAPSHOT pom Parent Parent module for example project. animals dogs org.apache.maven.plugins maven-compiler-plugin 1.8 1.8 The animals module pom.xml: 4.0.0 com.example.problem parent 0.0.1-SNAPSHOT animals Animals Module to hold common animal code. The dogs module pom.xml: 4.0.0 com.example.problem parent 0.0.1-SNAPSHOT dogs Dogs Module to hold dog specific code. com.example.problem animals 0.0.1-SNAPSHOT The idea here is to have the Beagle object annotated with @Animal. The annotation lives under the test directory of "animals", while our java runnable class Beagle lives under the test directory of "dogs". Animal.java: package com.example.problem.animals; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Simple annotation to denote an ani…
type: Question
tagged with: testing
score: 1
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/25963845
tagged with: m2eclipse
answer count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/25963845
has title: How do I run a command line program using m2e (Eclipse/Maven) in the test scope, with test dependencies?
possible better answer: http://stackoverflow.com/a/25922544

http://stackoverflow.com/a/25842721
answers question: http://stackoverflow.com/q/25842424
has comment: http://stackoverflow.com/comment/40434327
has comment: http://stackoverflow.com/comment/40434503
score: 0
type: Answer
has body: You can use the java.util.Map&lt;String, String&gt; to store the String values as key and value pairs in your Servlet. Like, Map&lt;String, String&gt; json = new HashMap&lt;String, String&gt;(); json.put("fileId", fileId); json.put("name", fileName); and return the String by converting this Map into String using, org.codehaus.jackson.map.ObjectMapper. return new ObjectMapper().writeValueAsString(json); // this will return String to retrieve the key value pairs in your Ajax response in success method, success: function(response) { console.log(response.fileId); console.log(response.fileName); }

http://stackoverflow.com/a/25770303
has body: Your first idea will work. It took me a while to figure it out, but the procedure is outlined in my answer to my question How can I hot deploy a resource-adapter activation in JBoss 7? Basically, you will deploy the WMQ RAR (wmq.jmsra.rar) as is. Then you deploy a configuration only RAR which contains the ra.xml from the wmq.jmsra.rar archive and an ironjacamar.xml (both in the META-INF sub-folder). You can find the details in the link. The official way to do this, though, is to follow the procedure outlines in the 2nd link above. I avoided this because I wanted a full WMQ RAR deployment and configuration to be deployed into a vanilla AS7 server, and the official procedure requires editing a few internal configuration files in the AS7 install. Here's an example WMQ ironjacamar.xml deployment descriptor.
score: 1
has comment: http://stackoverflow.com/comment/40319026
upvote count: 1
has comment: http://stackoverflow.com/comment/40313739
answers question: http://stackoverflow.com/q/25765153
downvote count: 0
type: Answer

http://stackoverflow.com/a/25781281
has body: You need to add provider to persistence-unit in your persistence.xml: org.eclipse.persistence.jpa.PersistenceProvider
has comment: http://stackoverflow.com/comment/40342209
upvote count: 3
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25766872
score: 3

http://stackoverflow.com/comment/40391843
type: Comment
type: QuestionComment
has text: @ErwinBolwidt Does it really matter? The question can be generalized to a set of K symbols and an array of N elements where K < N without any change in meaning nor solution.
score: 0
comment on: http://stackoverflow.com/q/25819723

http://stackoverflow.com/q/25723446
upvote count: 1
accepted answer: http://stackoverflow.com/a/25723615
has comment: http://stackoverflow.com/comment/40214375
has answer: http://stackoverflow.com/a/25723615
type: AnsweredQuestion
downvote count: 0
has title: What is the fastest file / way to parse a large data file?
score: 1
tagged with: parsing
favorite count: 0
type: Question
tagged with: google-app-engine
tagged with: http://stackoverflow.com/tag/csv
answer count: 2
tagged with: http://stackoverflow.com/tag/xml
possible better answer: http://stackoverflow.com/a/25728222
tagged with: java
has answer: http://stackoverflow.com/a/25728222
has body: So I am working on a GAE project. I need to look up cities, Country Names and Country Codes for sign ups, LBS, ect ... Now I figured that putting all the information in the Datastore is rather stupid as it will be used quite frequently and its gonna eat up my datastore quotations for no reason, specially that these lists arent going to change, so its pointless to put in datastore. Now that leaves me with a few options: API - No budget for paid services, free ones are not exactly reliable. Upload Parse-able file - Favorable option as I like the certainty that the data will always be there. So I got the files needed from GeoNames (link has source files for all countries in case someone needs it). The file for each country is a regular UTF-8 tab delimited file which is great. However, now that I have the option to choose how to format and access the data, the question is: What is the best way to format and retrieve data systematically from a static file in a Java servelet container ? The best way being the fastest, and least resource hungry method. Valid options: TXT file, tab delimited XML file Static Java Class with Tons of enums I know that importing country files as Java Enums and going through their values will be very fast, but do you think this is going to affect memory beyond reasonable limits ? On the other hand, every time I need to access a record, the loop will go through a few thousand lines until it finds the required record ... reading line by line so no memory issues, but incredibly slow ... I have had some experience with parsing an excel file in a Java servelet and it took something like 20 seconds just to parse 250 records, on large scale, response time WILL timeout (no doubt about it) so is XML anything like excel ?? Thank you very much guys !! Please provide opinions, all and anything is appreciated !

http://stackoverflow.com/a/25831156
score: 0
type: Answer
has body: As you didn't show more, my answer will be : use @include to include to second file into the first. That way the inclusion occurs at the source level.
answers question: http://stackoverflow.com/q/25830067

http://stackoverflow.com/comment/40355086
score: 0
type: AnswerComment
has text: I am moving from one activity(Activity1 in my example) to another(Confirmation) in my android app so I can't directly call a method from one to the other but I may be able to use this strategy to store the method in the model then fetch that in the Confirmation. Wish me luck
comment on: http://stackoverflow.com/a/25799438
type: Comment

http://stackoverflow.com/a/25828206
score: 2
has comment: http://stackoverflow.com/comment/40406573
upvote count: 2
has body: Why not just e(\d\d)\.?(\d\d)? As long as you don't have any TV shows named "The55 show" or similar, it's not going to break. The episode numbers will be captured in the groups of the match. See it in action here.
has comment: http://stackoverflow.com/comment/40406632
answers question: http://stackoverflow.com/q/25828078
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40406595

http://stackoverflow.com/a/25801378
score: 1
type: Answer
answers question: http://stackoverflow.com/q/25800955
upvote count: 1
has body: Yes.. This is runtime polymorphism or overridding. Case 1: A a = new C(); Case 2: C c = new C(); Rules of polymorphism: Variable Method Static Method Reference of Superclass(Case 1) Super Sub Super Reference of Subclass(Case 2) Sub Sub Sub These are the rules of polymorphism. So if you create any member variables of these types, you will always see results in this format. Hence the result you see.
downvote count: 0

http://stackoverflow.com/a/25805831
has body: ArrayList doesn't have an equals() method. It extends AbstractList which defines / implements equals(). clone() merely copies references, so the objects in both the lists are the same. From oracle docs : equals() does this : Compares the specified object with this list for equality. Returns true if and only if the specified object is also a list, both lists have the same size, and all corresponding pairs of elements in the two lists are equal. (Two elements e1 and e2 are equal if (e1==null ? e2==null : e1.equals(e2)).) In other words, two lists are defined to be equal if they contain the same elements in the same order. This implementation first checks if the specified object is this list. If so, it returns true; if not, it checks if the specified object is a list. If not, it returns false; if so, it iterates over both lists, comparing corresponding pairs of elements. If any comparison returns false, this method returns false. If either iterator runs out of elements before the other it returns false (as the lists are of unequal length); otherwise it returns true when the iterations complete.
score: 0
answers question: http://stackoverflow.com/q/25805719
type: Answer

vertica
tag name: vertica
tags question: http://stackoverflow.com/q/25724763
type: Tag

http://stackoverflow.com/comment/40285260
type: QuestionComment
has text: See [What every programmer should know about floating point](http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html) and http://floating-point-gui.de/basic/
score: 0
comment on: http://stackoverflow.com/q/25761703
type: Comment

http://stackoverflow.com/a/25797401
upvote count: 1
has body: Serialization serialises the objects fields, not its methods. The contents of the methods remain in the class definition, not in the instance itself.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25797359
score: 1

http://stackoverflow.com/comment/40288770
comment on: http://stackoverflow.com/q/25763711
score: 0
type: Comment
type: QuestionComment
has text: You need to right click on your project and run that on server not your java file? Run that and see if issue still persists, paste the URL here

http://stackoverflow.com/a/25845715
upvote count: 8
answers question: http://stackoverflow.com/q/25845204
has comment: http://stackoverflow.com/comment/45705341
score: 8
has body: The best way is to replace collections with queries, especially when the expected size is large enough to lead to a performance issue: You remove the bidirectional @OneToMany side, leaving only the owning @ManyToOne side You select the parent entity (e.g. Country) run queries like: select c from City c where c.country = :country select c from County c where c.country = :country select count(p), c.name from People p join p.country group by c.name
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43111113
comment on: http://stackoverflow.com/q/25821794
has text: I will look in to doing that if the project manager gives me the time.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40408236
comment on: http://stackoverflow.com/q/25829005
score: 0
type: Comment
type: QuestionComment
has text: Depends on what this is being used for, but if you want to be fancy you can implement iterable and that will make your loops more readable and 1-off error free.

http://stackoverflow.com/q/25746013
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has title: The \r\n of textarea
has body: A case of html as below: 1.&lt;input type="text"&gt;, the input is "aa\r\nbb" 2.&lt;textarea&gt;&lt;/textarea&gt;, the input is "aa", "bb" and a newline between them. Then I get the data from backend is both "aa\r\nbb" But when I transfer it into JSON with some tools, the result is different. &lt;input type="text"&gt; ,the result is "aa\\r\\nbb", but for textrea part, the result is still is "aa\r\nbb" . So why isn't the "\" of textarea transfered to "\\"?
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/42068
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/40256684
favorite count: 0
has comment: http://stackoverflow.com/comment/40258062
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40258865
has comment: http://stackoverflow.com/comment/40257005
answer count: 0
score: 1

http://stackoverflow.com/a/25742460
score: 1
has comment: http://stackoverflow.com/comment/40250869
accepted answer of: http://stackoverflow.com/q/25742230
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25742230
has body: You could store the last access time along with the attribute and when you use the attribute, first check if it is not too old. Create a wrapper class for it, something like: class AttrWrapper&lt;T extends Serializable&gt; { public final T value; public final long timeoutMs; private long lastAccess = System.currentTimeMillis(); public AttrWrapper(T value, long timeoutMs) { this.value = value; this.timeoutMs = timeoutMs; } public boolean isValid() { long now = System.currentTimeMillis(); if (now - lastAccess &gt; timeoutMs) return false; lastAccess = now; return true; } } And store it like this: // 1 minute timeout: session.setAttribute("myattr", new AttrWrapper&lt;&gt;("This is the value", 60*1000)); And access it like this: AttrWrapper&lt;?&gt; attr = (AttrWrapper&lt;?&gt;) session.getAttribute("myattr"); if (attr != null) { if (attr.isValid()) { // Attribute is valid, you can use it } else { // Attribute is invalid, timed out, remove it session.removeAttribute("myattr"); } } You can even create a helper, utility method for this so you don't have to repeat code: public static &lt;T extends Serializable&gt; T getAttr(String name, HttpSession sess) { @SuppressWarnings("unchecked") AttrWrapper&lt;T&gt; attr = (AttrWrapper&lt;T&gt;) sess.getAttribute("myattr"); if (attr == null) return null; if (attr.isValid()) return attr.value; // Attribute is valid, you can use it // Attribute is invalid, timed out, remove it sess.removeAttribute("myattr"); return null; }
has comment: http://stackoverflow.com/comment/40250149
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/comment/65826174
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/34124852
type: Comment
has text: This fixed the issue for me in Felix.

http://stackoverflow.com/comment/40434564
has text: Again, check for equality. If converting to either `float` or `double` then to `BigDecimal` gives the same numerical value as converting directly to `BigDecimal`, the float or double was exact.
type: AnswerComment
comment on: http://stackoverflow.com/a/25834542
score: 0
type: Comment

http://stackoverflow.com/q/25764226
has title: How to autofill a textfield with dashes for SSN
score: 0
has comment: http://stackoverflow.com/comment/40289504
has comment: http://stackoverflow.com/comment/40289333
has comment: http://stackoverflow.com/comment/40290086
type: UnansweredQuestion
has body: I'm working on a java based project and need to add dashes in a textfield when a user enters a ssn with no dashes. i have tried to use regex but the can't seem to get the exact format. eg, a user would enter 999999999, i want to autocorrect the input to look like 999-99-9999 TIA.
answer count: 0
tagged with: java
type: Question

http://stackoverflow.com/comment/40264300
comment on: http://stackoverflow.com/a/25750104
has text: The `pointList` is an ArrayList that is declared in the `Proj1Panel` class beginning. As far as I know, the MouseListener picks up on where the mouse clicks, then saves the point as an element in `pointList`, recalling it later, along with the size it is after the last point was added.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40437324
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25841775
has text: I can't just rollback. For example. Service A select some rows and dealing with them some long-running process with batch of updates to the rows at the end. Meanwhile service B is doing payment for one of these rows which already service A is using. Now we have situation that Service B changed state from unpaid to paid and commit changes to database, but service B doesn't know about changes and will just override state from paid to unpaid when it will commit his own changes. Both services are using 3rd party services and I can't repeat the operations again. I need some kind of merge.
type: AnswerComment

http://stackoverflow.com/comment/40254211
type: Comment
has text: try adding provided for the dependency in the parent pom file
comment on: http://stackoverflow.com/q/25744615
score: 0
type: QuestionComment

bitset
tags question: http://stackoverflow.com/q/25748270
tag name: bitset
type: Tag

http://stackoverflow.com/comment/40470794
type: QuestionComment
comment on: http://stackoverflow.com/q/25863377
score: 0
has text: put your logcat error
type: Comment

http://stackoverflow.com/comment/118811912
comment on: http://stackoverflow.com/a/25797282
type: AnswerComment
has text: @MarcinGołębski When you want to do that, then you can, `ObjectMapper` should be able to do that for you. But it would make it harder to access the individual items from your data.
score: 0
type: Comment

http://stackoverflow.com/comment/40484307
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25869958
type: QuestionComment
has text: In the bean, I declared mark as 'String' and in _Database_ I stored mark as 'Varchar2'

http://stackoverflow.com/q/25741209
upvote count: 6
tagged with: nlp
type: AnsweredQuestion
has title: Diminutive words stemming / lemmatization
tagged with: java
has comment: http://stackoverflow.com/comment/42115620
has answer: http://stackoverflow.com/a/27294819
score: 6
tagged with: morphological-analysis
type: Question
tagged with: lucene
accepted answer: http://stackoverflow.com/a/27294819
has comment: http://stackoverflow.com/comment/40259495
answer count: 1
downvote count: 0
favorite count: 0
has body: Currently I use 'lucene' and 'elasticsearch', and have next problem. I need get stemmed form or lemma for diminutive word. For instance : doggy -> dog kitty -> cat etc. But I get next results : doggy -> doggi kitty -> kitti Is there any way (not important ready to use library, any algorithm, approach etc.) to get root / original word form for diminutive word forms? Target language : Russian. For example : собачка -> собака кошечка -> кошка Thanks in advance!
tagged with: elasticsearch

http://stackoverflow.com/a/25871443
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40496589
type: Answer
has comment: http://stackoverflow.com/comment/40496620
has comment: http://stackoverflow.com/comment/40496913
accepted answer of: http://stackoverflow.com/q/25870156
has body: I wrote fully working example for you. It contains XML reading, filtering old dates and average usage counting. I used xpath to retrieve elements from your XML file. Please note that usage list you provided contains only dates MORE than 3 months old. So to make it work (and output something else than 0) you need to add / modify it to have more recent dates. Just copy and pase this example and add usage list xml file to same source folder. package com.test; import java.io.IOException; import java.util.Calendar; 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.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; public class AverageUsage { public static void main(String[] args) { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder; Document doc = null; int usageSum = 0; int usageCount = 0; // Create calendar representing now (used later) Calendar threeMonthsBefore = Calendar.getInstance(); // Subtract 3 months from now threeMonthsBefore.add(Calendar.MONTH, -3); try { builder = factory.newDocumentBuilder(); doc = builder.parse("src/data.xml"); // Create XPathFactory object XPathFactory xpathFactory = XPathFactory.newInstance(); // Create XPath object XPath xpath = xpathFactory.newXPath(); // Create xpath expression to query our totals XPathExpression expr = xpath.compile("/USAGE_LIST/TOTAL"); // Evaluate expression result on XML document NodeList nodes = (NodeList) expr.evaluate(doc, XPathConstants.NODESET); // Iterate over all TOTAL elements for(int i = 0; i &lt; nodes.getLength(); i++){ // Current total element Element total = (Element)nodes.item(i); // Get YEAR, MONTH, USA…
answers question: http://stackoverflow.com/q/25870156
score: 0

http://stackoverflow.com/q/25843149
tagged with: java
has comment: http://stackoverflow.com/comment/40434370
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/40436193
tagged with: eclipse
score: 0
has title: Unable to show view in debug mode eclipse luna
has comment: http://stackoverflow.com/comment/40434591
has body: I recently switched to eclipse luna(windows 64bit) for android. I not able to add any new view in debug mode, which makes the debugging inconvenient.Although in java mode I'm able to add views! I tried searching but did not find any solution. Please help !
has comment: http://stackoverflow.com/comment/41645817
has comment: http://stackoverflow.com/comment/40434529
has comment: http://stackoverflow.com/comment/41779515
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40434623
answer count: 0
tagged with: eclipse-luna

http://stackoverflow.com/a/25778633
score: 1
upvote count: 1
downvote count: 0
has body: It is the beauty of Inheritance. It's not polymorphysm. Simply we can define polymorphysm is "Same thing in multiple ways". Your program AA is a interface. B is a sub Class, inherite from AA interface. Therefore we can say B is AA In your C class invoke(AA aa) method accepting any AA type thing. So B is AA. Therefore that method accepting B class object. You can't give AA instance(Because we can't create objects using interfaces). As well as you can use Annonymous class for running that method. It is like this.. class Main { public static void main(String... args) { //B b = new B(); C c = new C(); c.invoke(new AA(){ public void sayHello(){ System.out.println("Annonymous class"); } }); } }
type: Answer
answers question: http://stackoverflow.com/q/25778347

http://stackoverflow.com/comment/40395026
score: 0
type: QuestionComment
type: Comment
has text: @kiheru You're right. I take back my comment.
comment on: http://stackoverflow.com/q/25821678

http://stackoverflow.com/comment/40291608
type: QuestionComment
comment on: http://stackoverflow.com/q/25765025
score: 0
has text: @UdayA.Navapara Only solution i can think of is somehow loading the content inside an ` `...
type: Comment

http://stackoverflow.com/comment/40352734
type: Comment
comment on: http://stackoverflow.com/a/25798459
has text: @Pshemo it is a good point but I never saw 3kk, it is usually 3k
score: 0
type: AnswerComment

http://stackoverflow.com/a/25854344
downvote count: 0
has body: The String l1 = kb.nextLine(); is still searching through the input until it gets a line separator, which you have not input yet. Put this readLine after the prompt to get the order you are expecting. System.out.println("Fiddlesticks!"+"Give me a 5 letter word: "+ l1); String l1 = kb.nextLine();
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25854270
score: 1

osgi
tags question: http://stackoverflow.com/q/25773355
type: Tag
tags question: http://stackoverflow.com/q/25722965
tags question: http://stackoverflow.com/q/25724101
tags question: http://stackoverflow.com/q/25846456
tags question: http://stackoverflow.com/q/25864041
tag name: osgi
tags question: http://stackoverflow.com/q/25839531
tags question: http://stackoverflow.com/q/25765473

http://stackoverflow.com/q/25807311
type: Question
has comment: http://stackoverflow.com/comment/40370229
has comment: http://stackoverflow.com/comment/40367999
tagged with: bytecode
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25811754
has title: java bytecode .. replacing icosnt_ with bipush<>
has comment: http://stackoverflow.com/comment/40368373
has comment: http://stackoverflow.com/comment/40368251
has comment: http://stackoverflow.com/comment/40369724
favorite count: 0
has body: I am trying to understand why when I replace the iconst_5 (08) with bipush 20 (1014) it won't work. Would it be possible to set an integer other than -1 to 5 in this case? A7 00 07 goto pos.00000170 15 0E iload local.0E 08 iconst_5 6C idiv 36 16 istore local.16 2A aload_0 2B iload_1 15 16 iload local.16 B7 00 E9 invokespecial void hui.surf.I.V.A(java.io.PrintWriter, int) 84 0F 01 iinc local.0F, 1 here's the decompiled snippet: enter code here { i6 = paramBoolean1 ? i4 / 2 : i4 / 5; A(paramPrintWriter, i6); } I need to replace the integer number 5 with 20. If I replace 08 with 10 14 this is what the editor does: A7 00 07 goto pos.00000170 15 0E iload local.0E 10 14 bipush 20 36 16 istore local.16 2A aload_0 2B aload_1 15 16 iload local.16 B7 00 E9 invokespecial void hui.surf.I.V.A(java.io.PrintWriter, int) 84 0F 01 iinc local.0F, 1 A7 FE F3 goto pos.0000006F this is what the decompiled code looks like: (JDgui decompiler) { i6 = paramBoolean1 ? i4 / 2 : 20; A(paramPrintWriter, i6); }
has comment: http://stackoverflow.com/comment/40368604
has comment: http://stackoverflow.com/comment/40368912
has comment: http://stackoverflow.com/comment/40369172
has comment: http://stackoverflow.com/comment/40368309
has comment: http://stackoverflow.com/comment/40369517
has comment: http://stackoverflow.com/comment/40369221
has comment: http://stackoverflow.com/comment/40368546
has comment: http://stackoverflow.com/comment/40369281
accepted answer: http://stackoverflow.com/a/25811754
upvote count: 1
has comment: http://stackoverflow.com/comment/40368857
has comment: http://stackoverflow.com/comment/40369129
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40368743
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40368409

http://stackoverflow.com/q/25769818
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8020228
duplicate of: http://stackoverflow.com/q/23140263
has title: java nested if statement else not working
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40299953
has comment: http://stackoverflow.com/comment/40299847
linked to: http://stackoverflow.com/q/23140263
score: 0
has comment: http://stackoverflow.com/comment/40299836
answer count: 1
has body: the else part of the statement is not executing when none of the other statements are true. if (personPlay.equals(computerPlay)) System.out.println("It's a tie!"); else if (personPlay.equals("R")) if (computerPlay.equals("S")) System.out.println("Rock crushes scissors. You win!!"); else if (personPlay.equals("P")) if (computerPlay.equals("R")) System.out.println("Paper raps around rock. You win!"); else if (personPlay.equals("S")) if (computerPlay.equals("P")) System.out.println("Scissors cut paper. You win!"); else System.out.println("you lose");
has answer: http://stackoverflow.com/a/25769889

http://stackoverflow.com/comment/40355035
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25799125
has text: Yep, looks like the nine numbers should be outside the loop. You can't accumulate them if they are changing each time the loop changes
type: Comment

http://stackoverflow.com/comment/40245722
type: Comment
has text: So, my guess was all wrong. But I still feel confused. In link to JSR133 FAQ you posted, they mentioned "correctly constructed object". Could I speculate that object was constructed within a final-field-safe context, when neither pointer to this object nor pointer to it's final field leaked during construction? Or I am all wrong again?
comment on: http://stackoverflow.com/a/25739765
score: 0
type: AnswerComment

http://stackoverflow.com/a/25782982
score: 1
upvote count: 1
has body: Try to use a JFormattedTextField with the corresponding NumberFormat.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25782655

http://stackoverflow.com/q/25738001
tagged with: android
has comment: http://stackoverflow.com/comment/40245352
has comment: http://stackoverflow.com/comment/40250572
tagged with: voice-recognition
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25740495
has title: PocketSphinx android demo runtime exception
upvote count: 1
has body: I downloaded the source code of pocket sphinx demo. I'm trying to run it but it is throwing a runtime exception. I've posted the logcat of my code. 09-09 11:45:38.980: I/System.out(7912): Sending WAIT chunk 09-09 11:45:38.980: W/ActivityThread(7912): Application edu.cmu.pocketsphinx.demo is waiting for the debugger on port 8100... 09-09 11:45:39.030: I/dalvikvm(7912): Debugger is active 09-09 11:45:39.210: I/System.out(7912): Debugger has connected 09-09 11:45:39.210: I/System.out(7912): waiting for debugger to settle... 09-09 11:45:39.400: I/System.out(7912): waiting for debugger to settle... 09-09 11:45:39.600: I/System.out(7912): waiting for debugger to settle... 09-09 11:45:39.810: I/System.out(7912): waiting for debugger to settle... 09-09 11:45:40.000: I/System.out(7912): waiting for debugger to settle... 09-09 11:45:40.210: I/System.out(7912): waiting for debugger to settle... 09-09 11:45:40.400: I/System.out(7912): waiting for debugger to settle... 09-09 11:45:40.600: I/System.out(7912): waiting for debugger to settle... 09-09 11:45:40.810: I/System.out(7912): waiting for debugger to settle... 09-09 11:45:41.010: I/System.out(7912): debugger has settled (1359) 09-09 11:45:41.930: D/dalvikvm(7912): threadid=1: still suspended after undo (sc=1 dc=1) 09-09 11:45:48.960: I/dalvikvm(7912): threadid=4: reacting to signal 3 09-09 11:45:48.960: D/dalvikvm(7912): threadid=1: still suspended after undo (sc=1 dc=1) 09-09 11:45:48.960: I/dalvikvm(7912): Wrote stack traces to '/data/anr/traces.txt' 09-09 11:45:52.310: D/dalvikvm(7912): GC_EXTERNAL_ALLOC freed 44K, 49% free 2778K/5379K, external 0K/0K, paused 26ms 09-09 11:45:58.770: D/CLIPBOARD(7912): Hide Clipboard dialog at Starting input: finished by someone else... ! 09-09 11:46:05.860: D/dalvikvm(7912): GC_CONCURRENT freed 366K, 50% free 2845K/5639K, external 7K/1286K, paused 2ms+3ms 09-09 11:46:05.870: I/Assets(7912): Skipping asset models/grammar/menu.gram: checksums are equal 09-09 11:46:05.870: I/Assets(7912): S…
type: Question
tagged with: pocketsphinx-android
has comment: http://stackoverflow.com/comment/40247486
has comment: http://stackoverflow.com/comment/40245687
has comment: http://stackoverflow.com/comment/40246361
downvote count: 0
answer count: 1
favorite count: 0
tagged with: offline
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40247220

http://stackoverflow.com/q/25770563
has answer: http://stackoverflow.com/a/48235310
has answer: http://stackoverflow.com/a/51892139
has comment: http://stackoverflow.com/comment/101500265
score: 36
has title: 0 test class found in package ‘<default package>’
has body: I have recently installed IntelliJ IDEA 13.1.4 and the jRebel plugin. I have licensed it ok and created and added configurations in catalina.bat file. When running jRebel from within IntelliJ, it seems to be monitoring the correct directories but I get the following message: 0 test class found in package ‘’ This then tells me that it has failed to start. Does anybody know what I might need to change to get this to work?
favorite count: 0
answer count: 9
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/48319345
has answer: http://stackoverflow.com/a/58301899
has answer: http://stackoverflow.com/a/27368591
has answer: http://stackoverflow.com/a/47140066
has answer: http://stackoverflow.com/a/43278381
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/74488111
upvote count: 36
has answer: http://stackoverflow.com/a/41413298
tagged with: intellij-idea
downvote count: 0
has answer: http://stackoverflow.com/a/45583525

http://stackoverflow.com/q/25816351
has answer: http://stackoverflow.com/a/26302352
has comment: http://stackoverflow.com/comment/40385739
type: Question
upvote count: 9
score: 9
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25816671
has comment: http://stackoverflow.com/comment/40388541
favorite count: 0
has title: Java 2D Perlin Noise for Random Terrain Generation
possible better answer: http://stackoverflow.com/a/26334533
has answer: http://stackoverflow.com/a/26334533
has body: My name is Chris and I'm working on my first Java game. Thus far, I have created a tile based 2D game, however my level is done in such a way so that if I create an image and its all green, then that green would stand for a grass tile. If I put a pixel of blue, the game would assign that as a water tile. However, that limits the game to how I design the level, I'd much rather have an infinite terrain of tiles. Being a beginner, I looked up different ways to do so. A particularly poignant method was something called a Perlin Noise. I looked into it but it seemed very complex. Would somebody mind defining it in simpler terms? Also, if you have any tutorials that 'dumb' it down a bit and give a brief overview, that'd be fantastic! Sorry I haven't been too specific, I'm actually avoiding from doing so.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25816671
tagged with: java

http://stackoverflow.com/a/25850309
answers question: http://stackoverflow.com/q/25839209
has body: Here's one way to do this, although it's slightly odd: public static Date parseDate(String input) { final String format = "MM/dd/yyyy"; if (input.length != format.length) { //Check the length, helps to avoid the cases mentioned earlier. throw new ParseException("Lengths do not match", 0); } SimpleDateFormat format = new SimpleDateFormat(format); format.setLenient(false); return format.parse(input); } (This is what I said in the comment earlier)
score: 0
type: Answer

http://stackoverflow.com/a/25797485
score: 1
has comment: http://stackoverflow.com/comment/40350889
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40350711
upvote count: 1
answers question: http://stackoverflow.com/q/25797386
has body: You are confusing the array with its contents. The array itself cannot be a negative integer, because it's an array, not an integer. To access the array's contents use a[n] where n is the index of the element you want to access. int[] a = {1, 4, 5, -2, -4, 6, 10, 3, -2}; for (int n = 0; n &lt; a.length; n++) { if (a[n] &lt; 0) { System.out.println(n); } }

http://stackoverflow.com/a/25726502
score: 0
answers question: http://stackoverflow.com/q/25714060
has body: You are getting a NullPointerException, so first be sure that customTest[1] should never be null. When you are putting float count = Float.parseFloat(customTest[1]);, first log the value of customTest[1], as I think customTest[1] is null. Edit: float count = 0; if(customTest[1]!=null){ count = Float.parseFloat(customTest[1]); }
type: Answer

http://stackoverflow.com/q/25731451
upvote count: 1
tagged with: apache
has answer: http://stackoverflow.com/a/25732077
accepted answer: http://stackoverflow.com/a/25732077
answer count: 1
favorite count: 0
downvote count: 0
has title: Empty User-Agent in Requst creates NPE in legazy API
has body: Is there a good way of setting a user-agent string in a incoming HTTP request within a Java application? I'm using a old library that fails with a nullPointer cased by empty user-agent. The library can not be replaced, and it is not a quick fix to decompile and fix the error in the library.
tagged with: request
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jboss
type: Question

http://stackoverflow.com/comment/40355669
type: AnswerComment
has text: @NathanSpangenberg That's fine - *Fix* the identing. Then verify my analysis for yourself, which will be easier when everything is properly aligned.
type: Comment
comment on: http://stackoverflow.com/a/25800055
score: 0

http://stackoverflow.com/comment/40429707
type: QuestionComment
comment on: http://stackoverflow.com/q/25839613
score: 0
has text: ok do one thing u can use blustack also ...if that dont wont let me know
type: Comment

http://stackoverflow.com/comment/40246117
score: 0
type: AnswerComment
type: Comment
has text: Yes, it is possible. Edited my answer.
comment on: http://stackoverflow.com/a/25739137

http://stackoverflow.com/q/25809662
type: Question
has title: Get the previous element of a double linked List
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25809857
has comment: http://stackoverflow.com/comment/40372190
answer count: 2
tagged with: sorting
favorite count: 0
has answer: http://stackoverflow.com/a/25810203
has comment: http://stackoverflow.com/comment/40372129
upvote count: 0
tagged with: list
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40372213
has comment: http://stackoverflow.com/comment/40372290
downvote count: 1
has body: Here's the class declaring my variables: private class MyListElement { private final Integer value; private MyListElement nextElement; private MyListElement(final Integer value) { this.value = value; } } Here's how I add an element to my list: private void addNewElement() { System.out.print("Please type the number to be added to the list: "); Integer newValue = null; while (newValue == null) { try { newValue = Integer.parseInt(userInput.nextLine()); } catch (final Exception e) { System.out.println("Wrong value. Please insert new value."); } } MyListElement newElement = new MyListElement(newValue); if (firstElement != null) { placeElementInList(newElement); } else { firstElement = newElement; } } And finally, the problem: First, I declare a variable to contain the last element on the list; that's okay. But how could I get its previous element to loop through the list and print it in reverse? private void printInReverse() { MyListElement tmpElement = firstElement; while (tmpElement.nextElement != null) { tmpElement = tmpElement.nextElement; } MyListElement firstReverseElement = tmpElement; MyListElement elementInList = firstReverseElement; while (elementInList != null) { System.out.print(elementInList.value + ", "); elementInList = elementInList.nextElement; } System.out.println(""); } The "elements" are hypothetical pointers to the values on list. EDIT: This is how I sort the list (ascending order). private void placeElementInList(final MyListElement newElement) { if (newElement.value &lt; firstElement.value) { newElement.nextElement = firstElement; firstElement = newElement; } else { MyListElement previousElement = firstElement; MyListElement elementInList = firstElement.nextElement; while (elementInList != null) { if (newElement.value &lt; elementInList.value) { break; } previousElement = elementInList; elementInList = elementInList.nextElement; } previousElement.nextElement = newElement; newElement.nextElement = elementInList; } }

http://stackoverflow.com/comment/40382371
comment on: http://stackoverflow.com/a/25814079
type: Comment
score: 1
has text: @Nulano: Why bother, if there's equivalent public APIs as discussed in my answer?
type: AnswerComment

http://stackoverflow.com/q/25807386
type: AnsweredQuestion
tagged with: enums
has comment: http://stackoverflow.com/comment/40368124
tagged with: java
has title: Java Enum : Having Multiple Strings within one Enums
has answer: http://stackoverflow.com/a/25807490
has comment: http://stackoverflow.com/comment/40368556
type: Question
has body: I am new student java learning its basics My objective is to create a Enum which contains various categories like Emails, Username, Passwords, MaterialType etc. Further I wanted that within one Category I can declare various strings and my sample code is as below: public enum MyEnums { Usernames { public String toString() { return "This is a GmailUsername"; } /*public String toString() { return "This is a GalleryComment"; }*/ }, Password { public String toString() { return "This is a public password"; } /* public String GmailPassword() { return "This is a Gmail Password"; } */ }, Emails { public String toString() { return "This is a public contact email address"; } /* public String EmailAccount() { return "This is a public Email Account address"; } */ }, PhoneNumbers { public String toString() { return "This is Phonenumber"; } /* public String Phone() { return "This is a phone number"; }*/ } } and I call the code as public static void main (String args[]) { System.out.println(MyEnums.Emails); System.out.println(MyEnums.Usernames ); System.out.println(MyEnums.PhoneNumbers); System.out.println(MyEnums.Password); } My question is why on using second string type function it is giving error, example In the password category for GmailPassword() why it is not working. Is there is any other way to declare multiple strings in enum in category wise manner like public Enum myEnum{ Category1 { "String 1","String2",......."String N" } ....... ....... ....... ....... CategoryN { "String 1","String2",......."String N" }
accepted answer: http://stackoverflow.com/a/25807490
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40368946
has answer: http://stackoverflow.com/a/25807464
possible better answer: http://stackoverflow.com/a/25807429
has answer: http://stackoverflow.com/a/25807429

http://stackoverflow.com/a/25718645
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25717781
upvote count: 1
has body: I solved my problem by myself. It is a fetch problem. When I try remove University by using sessionFactory.delete(university), this university does not fetch any faculties. So the removal will not be cascade enabled.
answers question: http://stackoverflow.com/q/25717781

http://stackoverflow.com/comment/40206988
type: QuestionComment
comment on: http://stackoverflow.com/q/25719208
score: 0
has text: I already have a login page when we dont have session. Now we have a demo to the client where we dont want to show them a secction of the application, and I was looking for an easy solution with Spring security, instead have to remove part of the application and create a version for them. The PO wants that if you click in that secction of the application a "in development" page must be showed as I explain in my question
type: Comment

http://stackoverflow.com/a/25839073
score: 4
has body: You can work with any JDK if your Eclipse supports the latest one. You need to install JDK7, then you go to Window, Preferences. Type installed in the field and choose Installed JREs. Then, give the path of your JDK. Finally, right click on your project, Properties, Java compiler and select the appropriate JDK and compiler compliance.
type: Answer
answers question: http://stackoverflow.com/q/25839054
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/29954604
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25724894
upvote count: 1
has body: The date of creation is pretty straight forward to get using the jobConfigHistory plugin and the /jobConfigHistory/api/json endpoint. Choose the earliest json object (the earliest two are usually noted as "operation": "Changed" for some reason) or choose the json object that has "operation": "Created". I think that a plugin shouldn't be needed to ascertain the date of creation for a Job, but this method does seem to work. I've created a Jenkins Improvement Ticket 28164 requesting the core provide this detail.
score: 1

http://stackoverflow.com/comment/40229149
type: QuestionComment
score: 1
has text: You are returning null right after your while loop.
comment on: http://stackoverflow.com/q/25731329
type: Comment

http://stackoverflow.com/comment/40327202
comment on: http://stackoverflow.com/q/25784845
has text: what does reloadUser() do ? Can you post the code ?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25785846
upvote count: 2
type: Answer
score: 1
downvote count: 1
has body: If you download file from URL then try below code with folder name and file name public void DownloadFile(String strUrl, String folderName, String fileName) { try { File dir = new File(Environment.getExternalStorageDirectory() + "/" + folderName); if (dir.exists() == false) { dir.mkdirs(); } URL url = new URL(strUrl); File file = new File(dir, fileName); URLConnection ucon = url.openConnection(); InputStream is = ucon.getInputStream(); BufferedInputStream bis = new BufferedInputStream(is); ByteArrayBuffer baf = new ByteArrayBuffer(20000); int current = 0; while ((current = bis.read()) != -1) { baf.append((byte) current); } FileOutputStream fos = new FileOutputStream(file); fos.write(baf.toByteArray()); fos.flush(); fos.close(); } catch (IOException e) { e.printStackTrace(); } }
answers question: http://stackoverflow.com/q/25785609

http://stackoverflow.com/q/25807305
linked to: http://stackoverflow.com/q/12432585
has comment: http://stackoverflow.com/comment/40368048
favorite count: 0
upvote count: 3
tagged with: android
tagged with: facebook
has title: How to retrieve data stored with Shared Preference in MainActivity class to SplashScreen activity class?
tagged with: splash-screen
linked to: http://stackoverflow.com/q/25606897
answer count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: sharedpreferences
duplicate of: http://stackoverflow.com/q/12432585
score: 3
tagged with: java
has body: I successfully managed to integrate Facebook api in my first android application, but now I'm stuck in using the access_token to avoid Login steps in my application after successful login at first time. I'm successful in storing the token_access after login, but not able to use it after relaunching the app. App flows as: SplashScreen Activity -> LoginRegister Activity -> MainActivity My code SplashScreen activity Class: public class Splash_Screen extends Activity { Login log; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.splash__screen); Thread thread = new Thread() { public void run() { try { sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { Class classs; log=new Login(); if (log.get() == false) classs = Login_Register.class; else classs = Main.class; Intent intent = new Intent(Splash_Screen.this, classs); intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(intent); overridePendingTransition(0, 0); } } }; thread.start(); } } Login class(Login is a Fragment places inside LLoginRegister Activity class): public class Login extends Fragment implements OnClickListener{ boolean me; Facebook fb; static String access_token;; static SharedPreferences Logininfo; static long expires; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View login = inflater.inflate(R.layout.login, container, false); // TODO Auto-generated method stub login.findViewById(R.id.Login).setOnClickListener(this); login.findViewById(R.id.googlepluslog).setOnClickListener(this); login.findViewById(R.id.facebooklog).setOnClickListener(this); return login; } @SuppressWarnings("deprecation") @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); fb = new Facebook(getString(R.string.APP_ID)); } @Suppres…
linked to: http://stackoverflow.com/q/23654853
type: Question

http://stackoverflow.com/q/25870162
favorite count: 0
has title: Project facet WebSphere Web (Co-existence) version 8.0 is not supported
tagged with: websphere-liberty
accepted answer: http://stackoverflow.com/a/25871626
type: AnsweredQuestion
downvote count: 0
score: 7
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/25871626
type: Question
tagged with: websphere
has body: I have been tasked with working on a web portal application at work. I have been given a pre-existing copy of project folders from eclipse. I am unable to get it to run. I am trying to setup a local server and do the development locally, then move it to the production server. For my server I have setup WebSphere Application Server V8.5.5 Liberty Profile. I created a "Hello World" project to make sure that it is working. It is. When I try to right click the project and select Run As -> Run on Server... I see the following: I'm not sure if this helps, but here are Project Facets: Current software: Eclipse, Java EE IDE, Kepler, Release 4.3.2 WebSphere Application Server V8.5.5 Liberty Profile Java Compiler 1.7 (1.6, 1.5, 1.4, 1.3)
upvote count: 7
answer count: 1
tagged with: jsp

http://stackoverflow.com/a/25845663
accepted answer of: http://stackoverflow.com/q/25830428
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40439265
has comment: http://stackoverflow.com/comment/40439047
has comment: http://stackoverflow.com/comment/40438768
has comment: http://stackoverflow.com/comment/40438915
type: Answer
has comment: http://stackoverflow.com/comment/40438540
score: 1
has comment: http://stackoverflow.com/comment/40438611
has comment: http://stackoverflow.com/comment/40438840
has body: does the version of struts2 causes any issues, since i am using 2.1.6 ? Yes, it does. excludePattern has been introduced in... 2.1.7. Please consider upgrading (due to a lot of improvement and security fixes) to the latest Struts version (2.3.16.3 today, 2.3.18 soon). With 2.3.18, you will also be able to use the new JakartaStreamMultiPartRequest, and try dangerous stuff like setting 100 GigaBytes of Request size as you are doing now :)
answers question: http://stackoverflow.com/q/25830428
has comment: http://stackoverflow.com/comment/40439077

http://stackoverflow.com/q/25765732
has body: I need to attach a Base64 binary element to a SOAP message...Im doing a dry run to check if I can convert a value read from a file into Base64 binary.. Here is the below code..In the last line I try to print the type of encoded1(I assume it should be Base64 binary values) but I get the following display..."Attachment[B"...How can I confirm if its Base64 binary string? Path path = Paths.get("c:/tomcatupload/text.csv"); byte[] attachment1 = Files.readAllBytes(path); byte[] encoded1 = Base64.encode(attachment1); System.out.println("Attachment"+ encoded1.getClass().getName());
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40292403
score: 1
accepted answer: http://stackoverflow.com/a/25765956
has title: Base64 binary data type in java
favorite count: 0
upvote count: 2
answer count: 2
possible better answer: http://stackoverflow.com/a/25765955
has answer: http://stackoverflow.com/a/25765955
tagged with: java
has comment: http://stackoverflow.com/comment/40292103
downvote count: 1
has comment: http://stackoverflow.com/comment/40292095
has answer: http://stackoverflow.com/a/25765956
has comment: http://stackoverflow.com/comment/40292102
has comment: http://stackoverflow.com/comment/40292463
has comment: http://stackoverflow.com/comment/40292385
type: Question

http://stackoverflow.com/q/25757033
type: Question
tagged with: private-methods
answer count: 2
score: 0
possible better answer: http://stackoverflow.com/a/25757488
tagged with: java
has answer: http://stackoverflow.com/a/25757488
has answer: http://stackoverflow.com/a/25760775
has comment: http://stackoverflow.com/comment/40277348
has body: I'm new at Java and I'm attempting on my very first coding, but i hit a bump as in if i type private before data types it will say The value of the field Teacher.tea_id is not used The value of the field Teacher.name is not used Nevertheless, if i removed "private" method then the error also was solved, so i wonder is the method automatically converted to public when i removed "private"? And why error exists with private? Btw, i also have another class namely "score", i'm not sure if i set a variable like sum which represents the sum total of several other variables, can i just continue use it in other classes such as the teacher in this case? But of course they are in the same package. FYI, the teacher class looks like that: public class Teacher { private int tea_id; private String name; Score Score; public Teacher(int tea_id, String name) { this.name = name; this.tea_id = tea_id; Score = new Score(); } public void input(float num, int course){} public void input(float[] score){} public void check(){} public float getSum(){return Score.sum;} public float getAverage(){return Score.average;} } Hope i have clearly delivered my problem to you, and will clarify further if needed.
has comment: http://stackoverflow.com/comment/40277029
has comment: http://stackoverflow.com/comment/40365915
has title: The value of some fields is not used when i add private method
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25760775
linked to: http://stackoverflow.com/q/22478523

http://stackoverflow.com/comment/40480608
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25868906
type: QuestionComment
has text: http://stackoverflow.com/a/23170607/1393766

http://stackoverflow.com/comment/40215126
type: QuestionComment
has text: @Zuhayr Hamayun refer my answer
comment on: http://stackoverflow.com/q/25723798
type: Comment
score: 0

http://stackoverflow.com/q/25834027
has answer: http://stackoverflow.com/a/25834164
has answer: http://stackoverflow.com/a/25834172
downvote count: 0
has answer: http://stackoverflow.com/a/25834092
has answer: http://stackoverflow.com/a/25834161
favorite count: 0
answer count: 5
has comment: http://stackoverflow.com/comment/40417487
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40417610
has comment: http://stackoverflow.com/comment/40417155
has answer: http://stackoverflow.com/a/25834078
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40417121
has comment: http://stackoverflow.com/comment/40417773
upvote count: 1
has comment: http://stackoverflow.com/comment/40417886
type: Question
has comment: http://stackoverflow.com/comment/40417153
has title: Different static blocks executed in java with an empty main and with an object initialization
has body: Here is my code: class Developer{ static{ System.out.println("In static block Developer"); } Developer(){ System.out.println("In constructor Developer"); } } public class Programmer extends Developer{ static{ System.out.println("In static block Programmer"); } Programmer(){ System.out.println("In constructor Programmer"); } public static void main(String args[]){ //Different static block when no commented //Developer d = new Programmer(); } } The output is this (when nothing in main): In static block Developer In static block Programmer However, if I write in the main method Developer d = new Programmer() the ouput is: In static block Programmer In constructor Developer In constructor Programmer The static block in class Developer is not executed. Is there any logical explanation?

http://stackoverflow.com/comment/40431982
has text: What's going on `AnimateAdditionAdapter.java` line 352 ? I can't find this class in github and it looks like it should have been here: https://github.com/nhaarman/ListViewAnimations/tree/master/lib-manipulation/src/androidTest/java/com/nhaarman/listviewanimations/itemmanipulation/animateaddition
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25841729
score: 0

http://stackoverflow.com/comment/40355415
type: Comment
comment on: http://stackoverflow.com/a/25799841
score: 0
type: AnswerComment
has text: No, the else statement isn't necessary, but I just like to have it there for some odd reason.

http://stackoverflow.com/a/25800870
answers question: http://stackoverflow.com/q/25800632
has comment: http://stackoverflow.com/comment/40357230
type: Answer
upvote count: 1
has body: Every application have their on session and sessionId on application server. management of session in java is depends that how to manage it. Generally session stored in cookies. HttpSessionAttributeListener you can use object of that class to receive events. we can develop a bean with name session or any your want and implements the HttpSession interface to get pattern methods. that bean will contains all the information which you want to store in session.
downvote count: 3
score: -2

http://stackoverflow.com/q/25717637
has comment: http://stackoverflow.com/comment/40203704
possible better answer: http://stackoverflow.com/a/25717784
has answer: http://stackoverflow.com/a/25717784
has body: I want to make an Excel worksheet like this: NAME | ADDRESS | PH ==================== Dad | IND | 123 Mom | IND | 123 Me | IND | 123 Dad, Mom and Me are in the List. I've already tried to make the code, but it seems wrong. It doesn't write row by row, but instead overwrite everything in every loop. Here's the code: HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("new sheet"); Row row1 = sheet.createRow((short) 0); row1.createCell(0).setCellValue("Name"); row1.createCell(1).setCellValue("Address"); row1.createCell(2).setCellValue("Ph"); List&lt;pegawai&gt; list_pegawai = test.list_pegawai(); int a = list_pegawai.size(); for (pegawai p : list_pegawai) { for (i = 1; i &lt;= a; i++) { Row row2 = sheet.createRow((short) i); row2.createCell(0).setCellValue(p.getName()); row2.createCell(1).setCellValue(p.getAddress()); row2.createCell(2).setCellValue(p.getPh()); } } FileOutputStream fileOut = new FileOutputStream("C:\\Users\\Documents\\workbook.xls"); wb.write(fileOut); fileOut.close(); JOptionPane.showMessageDialog(null, "SUCCESS"); Thanks for your guys' answer and help :)
has title: loop create row inside list looping
tagged with: netbeans
tagged with: apache-poi
accepted answer: http://stackoverflow.com/a/25717795
has comment: http://stackoverflow.com/comment/40203588
tagged with: excel
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25717795
tagged with: java
type: Question
score: 0
answer count: 2

http://stackoverflow.com/a/25791750
has body: The array will contains long values, but the array size accepts only ints
has comment: http://stackoverflow.com/comment/40339694
has comment: http://stackoverflow.com/comment/40339577
downvote count: 0
upvote count: 8
type: Answer
score: 8
has comment: http://stackoverflow.com/comment/40339674
answers question: http://stackoverflow.com/q/25791726
has comment: http://stackoverflow.com/comment/40339630

http://stackoverflow.com/q/25832882
favorite count: 0
has title: Read data One by one to JTextField from file
has comment: http://stackoverflow.com/comment/40444355
type: UnansweredQuestion
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/40421095
tagged with: swing
tagged with: jtextfield
has answer: http://stackoverflow.com/a/25833040
type: Question
has body: I am developing a gui using swing in which i need to read integer values from a text file in JTextField.The text file has only 5 values so i need to make 5 texfields in my gui and input the values one by one in my Jtextfield from the text file. Please help
score: -2
upvote count: 0
answer count: 1

http://stackoverflow.com/a/25869462
has body: External DSLs can lead to far better performance, and usability, than internal DSLs. The purpose of a DSL is to let an engineer specify a problem or solution succinctly and clearly, so he is able solve that problem more quickly and effectively. To the extent the problem has no need for high performance, one can build an internal DSL out of a set of subroutines and simply call them to achieve the desired effect. It is reasonable to note that most computations are not expensive, thus the standard warning about "premature optimization". However, many DSLs do need high performance (SQL, expert systems, lexer and parser generators). These solutions often require sophisticated algorithms (parsing, name resolution, flow analysis, boolean equation construction/simplification) to analyze the DSL specification instance provided by the engineer, and then apply special algorithms (pattern matching, FSA construction, Rete networks) perhaps along with sophisticated code generation and optimizations (query optimizations, special case handling, code motion, algebraic simplification) to produce the effective answer. In this case, internal DSLs are IMHO pretty much a disaster, because it is very hard to reason about just the API calls without getting reasoning about the rest of the language tangled into the process. It is also hard to find the boundaries of the DSL specification instance; where does it end, and just plain programming end? In general, I think "external" DSLs, those with a specialized notation (be it text or graph) are simply easier to write (and then read). In some cases, one cannot in realize the DSL without the notation (consider LR parser generators or Rete networks; these are not practical to code by hand, you have to have external DSL and supporting tools). If the purpose is to enable engineers to solve problems many times, I believe readability and expressiveness are what you should optimize, not ease of implementation. SQL is much easier to read than any proced…
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25869181
answers question: http://stackoverflow.com/q/25869181
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/44495458
has body: To generate random numbers from range 0 to 350, limiting the result to 10, and collect as a List. Later it could be typecasted. However, There are no guarantees on the type, mutability, serializability, or thread-safety of the List returned. List&lt;Object&gt; numbers = new Random().ints(0,350).limit(10).boxed().collect(Collectors.toList()); and to get thearray of int use int[] numbers = new Random().ints(0,350).limit(10).toArray();
downvote count: 0
score: 8
upvote count: 8
answers question: http://stackoverflow.com/q/25793098
type: Answer
has comment: http://stackoverflow.com/comment/102295524

http://stackoverflow.com/comment/40240504
has text: Why a down vote? I am ready to correct myself but please advise.
comment on: http://stackoverflow.com/a/25736539
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25835052
has title: Use Jackson to process Ember JSON API request
has body: I'm using Ember to build the client application and the backend is an Java Servlet, using Jackson to process the calls. The create customer call from ember looks like this : { "customer":{ "name":"4545", "email":"454545", "authenticator":"facebook" } } With the JSON data in this format I CANNOT use the simple solution from Jackson mapper.readValue(jsonData, Customer.class); As the customer fields are not in the first level of the JSON data. I had to process the JSON data to get the customer fields, and implemented like this : JsonNode rootNode = mapper.readTree(jsonData); Iterator iterator = rootNode.fields(); Entry first = (Entry) iterator.next(); ObjectNode node = (ObjectNode) first.getValue(); mapper.readValue(node.toString(), Customer.class); But I'm looking for a better way to do it, or something out of the box from Jackson. any suggestions ?
score: 0
accepted answer: http://stackoverflow.com/a/25835472
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: servlet-3.0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25835472
tagged with: jackson
type: Question
tagged with: ember.js

http://stackoverflow.com/q/25781929
has title: The tag liferay-ui:include is missing on liferay 6.2
tagged with: liferay-6
has answer: http://stackoverflow.com/a/25841748
possible better answer: http://stackoverflow.com/a/25786661
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: liferay
score: 0
answer count: 2
tagged with: jsp
has body: I am using liferay 6.2-ee-sp1 and I am trying use liferay-ui:include. I need to use a page.jsp from the other jar file. I find out that it is possible with this tag, but I have some troubles with it. My jsp page looks like: . . &lt;%@taglib prefix="liferay-ui" uri="http://liferay.com/tld/ui" %&gt; . . &lt;liferay-ui:include page="/html/jsp/page.jsp" servletContext="&lt;%=this.getServletContext() %&gt;"/&gt; And when I start my liferay I will get this error: No tag "include" defined in tag library imported with prefix "liferay-ui" So I looked to the liferay-ui.tld and there is no include tag. My question is: How can I find/import/include/use the liferay-ui:include tag?
accepted answer: http://stackoverflow.com/a/25841748
has answer: http://stackoverflow.com/a/25786661

http://stackoverflow.com/comment/40293515
has text: Please delete your manifest file and do a maven clean install. Pretty sure that the package is not imported in your manifest. If this problem continues then import the package manually and investigate as to why isn't it getting pulled in on its own.
score: 0
comment on: http://stackoverflow.com/q/25766370
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25774099
answer count: 1
score: 0
has body: I have this line in my code: private transient final Logger logger = LoggerFactory.getLogger(getClass()); I build my project and the pmd check tells me that: The Logger variable declaration does not contain the static and final modifiers. What can I do to fix this? I tried putting the static modifier but it comes up with this error: Cannot make a static reference to the non-static method getClass() from the type Object
accepted answer: http://stackoverflow.com/a/25774141
has title: Pmd error regarding logger
tagged with: static
has answer: http://stackoverflow.com/a/25774141
tagged with: logging
type: AnsweredQuestion
tagged with: pmd
tagged with: java
type: Question

http://stackoverflow.com/comment/40318626
type: QuestionComment
score: 0
has text: Do you insert each record with java?
comment on: http://stackoverflow.com/q/25779593
type: Comment

http://stackoverflow.com/a/25825525
has body: You can do that by using the correct format: DateFormat.getTimeInstance().
answers question: http://stackoverflow.com/q/25825496
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40401727
downvote count: 0

http://stackoverflow.com/a/25901592
upvote count: 1
has body: First, we'll build two maps, one for each list, mapping names to objects. Then we iterate over the differences between the key sets, processing whichever kind of object had that name. The maps let us avoid scanning through the list looking for the object with that name. (In using Map rather than Multimap, I'm relying on the asker's comment on another answer that within each list, names are unique. If you're still using Java 7, replace the method reference with a Function implementation.) Map&lt;String, Object1&gt; map1 = Maps.uniqueIndex(list1, Object1::getName); Map&lt;String, Object2&gt; map2 = Maps.uniqueIndex(list2, Object1::getName); for (String name : Sets.difference(map1.keySet(), map2.keySet())) processObject1(map1.get(name)); for (String name : Sets.difference(map2.keySet(), map1.keySet())) processObject2(map2.get(name)); If all you want to do is build lists or sets of the objects in exactly one list, processObject1 and processObject2 can just add the objects to collections. uniqueIndex's iteration order is that of the input iterable, and difference returns a SetView with the same iteration order as its first argument, so you can process objects in the order they appeared in the input lists, if that order is relevant to your problem. Java 8 streams provide basically the same functionality: Map&lt;String, Object1&gt; map1 = list1.stream().collect(Collectors.toMap(Function.identity(), Object1::getName)); Map&lt;String, Object2&gt; map2 = list2.stream().collect(Collectors.toMap(Function.identity(), Object2::getName)); map1.keySet().stream().filter(n -&gt; !map2.keySet().contains(n)).map(map1::get).forEachOrdered(o1 -&gt; processObject1(o1)); map2.keySet().stream().filter(n -&gt; !map1.keySet().contains(n)).map(map2::get).forEachOrdered(o2 -&gt; processObject1(o2)); Again, you can replace the forEachOrdered call with collect(Collectors.toList()) if you just want to collect the objects.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40569897
accepted answer of: http://stackoverflow.com/q/25764803
answers question: http://stackoverflow.com/q/25764803
type: Answer
score: 1

http://stackoverflow.com/comment/40418173
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25834145
has text: Thanks. I´ll look into it. I'll let you know how it workrd.
score: 0

http://stackoverflow.com/comment/40209468
score: 0
type: Comment
has text: can you explain the difference between Fragment or Activity and why using that can be more helpful. sorry, But I'm a little new to android.
type: AnswerComment
comment on: http://stackoverflow.com/a/25720586

http://stackoverflow.com/comment/40375876
has text: Hi, thanks for the answer. I did that and now I'm getting another error saying: "incompatible types: boolean[] cannot be converted to int[]. What should I do?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25811411
type: AnswerComment

http://stackoverflow.com/a/25978727
answers question: http://stackoverflow.com/q/25868260
has body: This should work: In my_app_dir->config.xml add &lt;preference name="KeepRunning" value="false" /&gt; And below document.addEventListener("deviceready", function() {... add document.addEventListener('backbutton', function() { navigator.app.exitApp(); }, false); Afterwards open cmd, go to your project folder and run cordova build android; cordova run --device android;
score: 0
type: Answer

http://stackoverflow.com/a/25735252
downvote count: 0
has body: Bubble sort is an O(n^2) algorithm so you need 2 for loops for a single array. If you have n arrays then you would need 3 for loops in order to sort all the rows. Which makes it O(n^2*m) algorithm. ( where m is the amount of rows) Soooo... for(int i = 0; i &lt; rowCount; i++){ for(int j = 0; j &lt; colCount; j++){ for(int k = 0; k &lt; colCount; k++){ if(differencearray[i][k]&gt;differencearray[i][k+1]){ int temp = differencearray[i][k]; differencearray[i][k] = differencearray[i][k+1]; differencearray[i][k+1] = temp; } } } }
upvote count: 2
has comment: http://stackoverflow.com/comment/65869808
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25735217
type: Answer
accepted answer of: http://stackoverflow.com/q/25735217
has comment: http://stackoverflow.com/comment/65923929
score: 2

http://stackoverflow.com/comment/40241810
comment on: http://stackoverflow.com/a/25737333
type: AnswerComment
type: Comment
has text: these only create sequencly at run time new schema not for update not possible to retrieve for old record,i need one time config to create schema if not exist and also continously to update record
score: 0

web-services
tags question: http://stackoverflow.com/q/25830428
tags question: http://stackoverflow.com/q/25786740
type: Tag
tags question: http://stackoverflow.com/q/25752801
tags question: http://stackoverflow.com/q/25771456
tags question: http://stackoverflow.com/q/25719317
tags question: http://stackoverflow.com/q/25742440
tags question: http://stackoverflow.com/q/25782995
tags question: http://stackoverflow.com/q/25815736
tags question: http://stackoverflow.com/q/25784704
tags question: http://stackoverflow.com/q/25758366
tags question: http://stackoverflow.com/q/25804889
tags question: http://stackoverflow.com/q/25735215
tags question: http://stackoverflow.com/q/25805738
tags question: http://stackoverflow.com/q/25771670
tags question: http://stackoverflow.com/q/25787897
tags question: http://stackoverflow.com/q/25743507
tags question: http://stackoverflow.com/q/25787970
tags question: http://stackoverflow.com/q/25842042
tags question: http://stackoverflow.com/q/25759949
tags question: http://stackoverflow.com/q/25793068
tags question: http://stackoverflow.com/q/25723820
tags question: http://stackoverflow.com/q/25720308
tags question: http://stackoverflow.com/q/25873358
tags question: http://stackoverflow.com/q/25862271
tags question: http://stackoverflow.com/q/25781866
tags question: http://stackoverflow.com/q/25750003
tags question: http://stackoverflow.com/q/25871816
tags question: http://stackoverflow.com/q/25822991
tags question: http://stackoverflow.com/q/25806263
tags question: http://stackoverflow.com/q/25763643
tags question: http://stackoverflow.com/q/25746957
tags question: http://stackoverflow.com/q/25756912
tags question: http://stackoverflow.com/q/25722572
tags question: http://stackoverflow.com/q/25761257
tags question: http://stackoverflow.com/q/25724545
tags question: http://stackoverflow.com/q/25757016
tags question: http://stackoverflow.com/q/25749332
tags question: http://stackoverflow.com/q/25762562
tags question: http://stackoverflow.com/q/25767250
tags question: http://stackoverflow.com/q/25727300
tags question: http://stackoverflow.com/q/25822958
tags question: http://stackoverflow.com/q/25850288
tags question: http://stackoverflow.com/q/25808282
tags question: http://stackoverflow.com/q/25802400
tags question: http://stackoverflow.com/q/25758267
tags question: http://stackoverflow.com/q/25802920
tag name: web-services
tags question: http://stackoverflow.com/q/25769531
tags question: http://stackoverflow.com/q/25851228
tags question: http://stackoverflow.com/q/25863005
tags question: http://stackoverflow.com/q/25856092
tags question: http://stackoverflow.com/q/25758106
tags question: http://stackoverflow.com/q/25790958
tags question: http://stackoverflow.com/q/25861498
tags question: http://stackoverflow.com/q/25782045
tags question: http://stackoverflow.com/q/25838289
tags question: http://stackoverflow.com/q/25728775
tags question: http://stackoverflow.com/q/25825577
tags question: http://stackoverflow.com/q/25757161
tags question: http://stackoverflow.com/q/25724765
tags question: http://stackoverflow.com/q/25785560
tags question: http://stackoverflow.com/q/25847959
tags question: http://stackoverflow.com/q/25796734

http://stackoverflow.com/comment/40454834
type: QuestionComment
comment on: http://stackoverflow.com/q/25854530
score: 0
type: Comment
has text: @Pokechu22 I men't to sort it, so that the given spots in the new array, was containing the amounts of 1's 2's 3's and so on like this: res[9] = 3 (instances of 9) That way she says its possible to create the shown diagram with a nested loop and no if's

http://stackoverflow.com/comment/40325416
type: Comment
comment on: http://stackoverflow.com/q/25779414
score: 0
type: QuestionComment
has text: @ATH that is correct, JavaFX apps don't need a main. Some IDEs or tools may expect a main though to allow the app to be executed from within the IDE environment. Also, sometimes the lack of a main confuses developers who expect to see a main, so it's probably best to always include a main to your app, even if all it does is just invoke the launch method.

http://stackoverflow.com/q/25745672
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40258993
downvote count: 2
type: Question
has title: Java parse XML string
has answer: http://stackoverflow.com/a/25745826
has comment: http://stackoverflow.com/comment/40256055
score: -2
tagged with: java
has body: I have an string which I am attempting to extract values from, for convenience I thought that converting the string to a Document and then parsing the xml would be the best way to do this but I am running into all sorts of problems! The string looks like: 0 Test Content 09-Sep-14 13:56 Test Title Can someone point me in the correct way to achieve my goal of reading the values from the tags . I have attempted using the following snippet but I all the values in the array are null! Document xml = null; Node T = null; try { xml = stringToDom(message); T = xml.getLastChild(); } catch (SAXException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ParserConfigurationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } if(xml.getFirstChild() != null){ }
answer count: 3
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40261282
has answer: http://stackoverflow.com/a/51679794
has comment: http://stackoverflow.com/comment/40255857
linked to: http://stackoverflow.com/q/562160
has comment: http://stackoverflow.com/comment/40256320
has comment: http://stackoverflow.com/comment/40255767
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25747304

http://stackoverflow.com/a/25814136
has comment: http://stackoverflow.com/comment/40406344
has comment: http://stackoverflow.com/comment/40382765
has comment: http://stackoverflow.com/comment/40406479
has comment: http://stackoverflow.com/comment/40394552
has comment: http://stackoverflow.com/comment/40406213
answers question: http://stackoverflow.com/q/25813940
score: 0
has comment: http://stackoverflow.com/comment/40384500
has comment: http://stackoverflow.com/comment/40384356
has body: Calendar rightNow = Calendar.getInstance(); int hour = rightNow.get(Calendar.HOUR); int min = rightNow.get(Calendar.MINUTE); System.out.println("TimeMinutes:" + hour * 60 + min); EDIT: Except using split use the above.
has comment: http://stackoverflow.com/comment/40383246
upvote count: 1
type: Answer
downvote count: 1
has comment: http://stackoverflow.com/comment/40398124
has comment: http://stackoverflow.com/comment/40398164

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/25732107
tag name: google-oauth

http://stackoverflow.com/comment/40260938
score: 1
type: QuestionComment
has text: @JustinNiessner Why can't Object be an interface instead of concrete class? Since it is a class in Java what is the use of being a class instead of interface?
comment on: http://stackoverflow.com/q/25748294
type: Comment

http://stackoverflow.com/comment/40314400
type: QuestionComment
has text: In test2 I have used Node as key but each time I insert it into HashMap it is considered as new key. So at the end I will end up with millions of entries in HashMap.
comment on: http://stackoverflow.com/q/25777159
score: 0
type: Comment

http://stackoverflow.com/q/25746509
type: UnansweredQuestion
score: 11
has answer: http://stackoverflow.com/a/25977404
linked to: http://stackoverflow.com/q/12969308
has comment: http://stackoverflow.com/comment/40364647
tagged with: transactions
has body: We have a Service which is @Stateful. Most of the Data-Operations are atomic, but within a certain set of functions We want to run multiple native queries within one transaction. We injected the EntityManager with a transaction scoped persistence context. When creating a "bunch" of normal Entities, using em.persist() everything is working fine. But when using native queries (some tables are not represented by any @Entity) Hibernate does not run them within the same transaction but basically uses ONE transaction per query. So, I already tried to use manual START TRANSACTION; and COMMIT; entries - but that seems to interfere with the transactions, hibernate is using to persist Entities, when mixing native queries and persistence calls. @Stateful class Service{ @PersistenceContext(unitName = "service") private EntityManager em; public void doSth(){ this.em.createNativeQuery("blabla").executeUpdate(); this.em.persist(SomeEntity); this.em.createNativeQuery("blablubb").executeUpdate(); } } Everything inside this method should happen within one transaction. Is this possible with Hibernate? When debugging it, it is clearly visible that every statement happens "independent" of any transaction. (I.e. Changes are flushed to the database right after every statement.) I've tested the bellow given example with a minimum setup in order to eliminate any other factors on the problem (Strings are just for breakpoints to review the database after each query): @Stateful @TransactionManagement(value=TransactionManagementType.CONTAINER) @TransactionAttribute(value=TransactionAttributeType.REQUIRED) public class TestService { @PersistenceContext(name = "test") private EntityManager em; public void transactionalCreation(){ em.createNativeQuery("INSERT INTO `ttest` (`name`,`state`,`constraintCol`)VALUES('a','b','c')").executeUpdate(); String x = "test"; em.createNativeQuery("INSERT INTO `ttest` (`name`,`state`,`constraintCol`)VALUES('a','c','b')").executeUpdate(); String y = "test2"; em.cre…
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has title: How to run native SQL queries in the same Hibernate transaction?
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/25830441
has answer: http://stackoverflow.com/a/29079609
has comment: http://stackoverflow.com/comment/40365274
has comment: http://stackoverflow.com/comment/40414904
answer count: 3
upvote count: 11
favorite count: 0

http://stackoverflow.com/comment/40204563
comment on: http://stackoverflow.com/a/25718057
score: 0
type: AnswerComment
has text: could you please add your table structure here and also set hibernate log level to debug so that you can get more information about it.. also add code of Faculty entity class...
type: Comment

http://stackoverflow.com/q/25741671
has answer: http://stackoverflow.com/a/25742631
has comment: http://stackoverflow.com/comment/40248838
score: -1
tagged with: http://stackoverflow.com/tag/xml
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/40249502
has comment: http://stackoverflow.com/comment/40250125
has body: in my app i cant use XML layout for some reason now i need to create a layout which its XML code is: <ir.adad.AdView android:id="@+id/ad" android:layout_width="wrap_content" android:layout_height="wrap_content" token="fhsfxfhdghghrgfggh" /> now i need to create a java code which its the same as this XML code! is there any way?how i can do this? i:ir.adad.adview is a ad services and i put its liberally in my app.
has comment: http://stackoverflow.com/comment/40249239
accepted answer: http://stackoverflow.com/a/25742631
has comment: http://stackoverflow.com/comment/40249584
has title: use java code instead of XML?
type: AnsweredQuestion
upvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25742444
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25742444
tagged with: android
has comment: http://stackoverflow.com/comment/40248796

http://stackoverflow.com/a/52203779
has comment: http://stackoverflow.com/comment/99277506
type: Answer
has comment: http://stackoverflow.com/comment/99319989
has body: First, send an object to the firebase server FirebaseDatabase.getInstance().getReference("serverTimeTest").setValue(new KKModel()); Model class class KKModel{ public String someField = "value"; public Object creationDate = ServerValue.TIMESTAMP; public String creationDate() { return SimpleDateFormat.getDateInstance(DateFormat.SHORT, Locale.US).format(creationDate); } } Usage object.creationDate() working fine test results "9/6/18"
upvote count: 2
answers question: http://stackoverflow.com/q/25744398
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/99164214

http://stackoverflow.com/q/25837809
has title: Why is `enum of enum of enum..` allowed?
score: 13
upvote count: 13
has body: I cannot understand why this even compile. I've tried with different formats and they all seem to work.. why is it legal to have an enum of enum of enum of..? interface I { enum E implements I { VAL; } class Test { I.E f1 = I.E.VAL; I.E.E f2 = I.E.VAL; I.E.E.E f3 = I.E.VAL; I.E.E.E.E.E f4 = I.E.VAL; I.E v1 = I.E.VAL; I.E v2 = I.E.E.VAL; I.E v3 = I.E.E.E.E.E.E.VAL; I.E v4 = I.E.E.E.E.E.E.E.E.E.E.VAL; } } My IDE reports it compiles just fine, although I.E.E does not make sense to me.
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25837821
tagged with: syntax
tagged with: java
type: Question
tagged with: enums
accepted answer: http://stackoverflow.com/a/25837821
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40329441
has text: Sorry. i forgot to do so.. your answer was also correct. thanks for the reply.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25786067
type: Comment

http://stackoverflow.com/comment/40441203
has text: Perfect! Indeed I have changed the alignment with padding and this is working! If you post this comment as answer, I will mark it as correct :-)! Thanks
score: 0
comment on: http://stackoverflow.com/q/25847016
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40218338
score: 0
comment on: http://stackoverflow.com/a/25725573
type: Comment
has text: @AndrewThompson: true, but perhaps it then goes to one of it just not feeling "right" to me. The cell isn't acting so much as a button but as a clickable location (again JLabel would work great) that holds an icon and does not get depressed. Maybe I'm just being stubborn because yes, it would work as a JButton with swapping icons (as I added to my answer actually before seeing your comment). But thanks for the comment!
type: AnswerComment

http://stackoverflow.com/comment/109506358
has text: Far more flexible and easier to implement than writing TypeAdapters for entire object classes.
type: Comment
comment on: http://stackoverflow.com/a/50138173
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40356703
type: Comment
type: QuestionComment
has text: I don't think you mean to compare `Solocomparator` to itself.
comment on: http://stackoverflow.com/q/25800652
score: 0

http://stackoverflow.com/a/25765260
has body: The problem seems to be that all spaces (or line breaks) seem to have been removed from your .svg, and so the XML tags aren't recognized properly (e.g.: instead of <svg xmlns ... you have <svgxmlns ... which is supposed to be closed by etc.) It seems to be ok after adding the spaces\breaks where needed: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" width="64" height="48" id="svg3033" version="1.1" inkscape:version="0.48.5r10040" sodipodi:docname="200mn.svg"> <defs id="defs3035"/> <sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="5.916495" inkscape:cx="61.898573" inkscape:cy="54.220135" inkscape:document-units="px" inkscape:current-layer="layer1" showgrid="false" inkscape:window-width="1280" inkscape:window-height="962" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1"/> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/> <dc:title></dc:title> </cc:Work> </rdf:RDF> <g inkscape:label="Layer1" inkscape:groupmode="layer" id="layer1" transform="translate(0,-1004.3622)"> 200m </g>
answers question: http://stackoverflow.com/q/25764713
has comment: http://stackoverflow.com/comment/40300488
score: 0
type: Answer

http://stackoverflow.com/comment/40329639
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25786350
type: Comment
has text: I just show as example, How about this list from db?

http://stackoverflow.com/q/25840106
tagged with: java
has body: As the title, I get a SQLException when I use dbms_random function like this: SELECT DBMS_RANDOM.value(1, 100) AS datas FROM dual but the SQL is correctly executed in PL/SQL. Besides, the connection pool which I use is Druid. Exception Stack as follow: 15-Sep-2014 11:02:04.397 SEVERE [http-apr-8080-exec-7] com.jfinal.core.ActionHandler.error /chart/tableData?QUERY_ID=16 com.jfinal.plugin.activerecord.ActiveRecordException: java.sql.SQLException: sql injection violation, deny object : dbms_random : select distinct (a.demand_id) as demand_id, a.demand_title as demand_title, f.product_version_id, h.name, to_char(a.qa_time, 'yyyy-mm-dd') as qa_time, e.op_name as op_name, dbms_random.value(1, 100) as datas from demand_request a, assignment b, group_op_info d, op_login e, product_version f, project g, province h where a.demand_id = b.demand_id and b.closer_id = d.op_id and d.op_id = e.op_id and a.project_code = g.proj_code and g.area_id = h.id at com.jfinal.plugin.activerecord.DbPro.find(DbPro.java:323) at com.jfinal.plugin.activerecord.DbPro.find(DbPro.java:334) at com.jfinal.plugin.activerecord.Db.find(Db.java:233) at com.qms.db.chart.ChartController.tableData(ChartController.java:23) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at com.jfinal.core.ActionInvocation.invoke(ActionInvocation.java:55) at com.jfinal.core.ActionHandler.handle(ActionHandler.java:73) at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:72) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardCon…
upvote count: 1
has answer: http://stackoverflow.com/a/25840385
type: Question
has comment: http://stackoverflow.com/comment/40431342
tagged with: sqlexception
tagged with: druid
has title: java.sql.SQLException: sql injection violation, deny object : dbms_random
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
score: 1

http://stackoverflow.com/comment/40262767
has text: sorry, please find my modified code.
comment on: http://stackoverflow.com/q/25738561
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/q/25772383
type: UnansweredQuestion
tagged with: persistence
has comment: http://stackoverflow.com/comment/40310232
tagged with: ebean
type: Question
score: 0
answer count: 1
has title: Play framework + ebean: Nested models are being saved as null
has answer: http://stackoverflow.com/a/25776245
has body: I think this is a simple problem: I have two models, for example; @Entity case class User(name: String, email: String) extends Model { @Id var id: Int = 0 } And then; @Entity case class Task( subject: String, body: String, @ManyToOne user: User) extends Model { @Id var id: Int = 0 } What I see is that when I fetch all Tasks from the database (find().all()), I see that user = null for all the Tasks, while debugging, if I set a breakpoint at newTask.save(), I see that the user field of that instance is correctly set. What's wrong with this?
tagged with: java
tagged with: playframework

http://stackoverflow.com/comment/40203354
type: QuestionComment
score: 1
has text: can you find jmap using "locate jmap" ??
comment on: http://stackoverflow.com/q/25715067
type: Comment

http://stackoverflow.com/q/25838757
tagged with: bukkit
type: Question
answer count: 1
tagged with: minecraft
accepted answer: http://stackoverflow.com/a/25839158
favorite count: 0
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25839158
type: AnsweredQuestion
tagged with: java
has title: How do I deserialize a Player's inventory?
has body: Here's my serialization method. How would I go about deserializing/loading it later on? invs is my inventories.yml FileConfiguration variable. public void action(Player p){ PlayerInventory i = p.getInventory(); int slot = 0; for(ItemStack item : i){ Map&lt;String, Object&gt; itemS = item.serialize(); if(Main.invs.get(p.getName() + ".inventory.slot." + slot) == null){ Main.invs.createSection(p.getName()+ ".inventory.slot." + slot); } Main.invs.set(p.getName() + ".inventory.slot." + slot, itemS); slot = slot + 1; } slot = 0; }

http://stackoverflow.com/a/25770224
upvote count: 2
has comment: http://stackoverflow.com/comment/40306072
type: Answer
score: 2
has body: This is explained in the SableCC documentation, aka Étienne Gagnon's master's thesis: Unlike alternatives, elements have an obvious candidate for name which is the identifier of the element itself. This will work, as long as an element does not appear twice in the same alternative. In that case the current version SableCC requires a name for at least one of the two elements. (For backward compatibility, one occurrence of the repeated element can remain unnamed). SableCC will issue an error if not enough names are provided. Element names are specified by prefixing the element with an identifier between square brackets followed by a colon. In other words, you can't use id twice in the production for function_head without giving at least one of them a name (whether or not you're generating an AST). Try something like this: function_head = func id l_par [parameter]:id r_par;
answers question: http://stackoverflow.com/q/25769828
accepted answer of: http://stackoverflow.com/q/25769828
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25850366
downvote count: 5
tagged with: string
has body: I want to delete tag and link text from my html. Simple example: String inputString = " test link "; I tried to use something like this: String result = inputString.replaceAll("</?a[^>]*>", " "); but it deletes only tag Expected output: String result = " test ";
answer count: 3
has answer: http://stackoverflow.com/a/25850594
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/40447004
has title: How to delete tag and link text from html in java
accepted answer: http://stackoverflow.com/a/25850462
tagged with: regex
favorite count: 0
upvote count: 2
score: -3
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25850464
tagged with: java
has answer: http://stackoverflow.com/a/25850464
tagged with: tags
has comment: http://stackoverflow.com/comment/40446963
has comment: http://stackoverflow.com/comment/40446856
has answer: http://stackoverflow.com/a/25850462
type: Question

http://stackoverflow.com/comment/40238253
comment on: http://stackoverflow.com/q/25735922
score: 0
type: Comment
type: QuestionComment
has text: this is a very broad and opinion based question - exception handling depends on your style and what you are used to.

http://stackoverflow.com/a/32540466
has body: Considering everyone is posting older ways of hiding the ActionBar here is the proper way of implementing it within styles for AppCompat support library. Which I highly suggest moving toward if you haven't already. Simply removing the ActionBar If you are using the appcompat support libraries, this is the easiest and recommended way of hiding the ActionBar to make full screen or start implementing to toolbar within your layouts. Then to change your toolbar color <android.support.v7.widget.Toolbar android:id=”@+id/my_awesome_toolbar” android:layout_height=”wrap_content” android:layout_width=”match_parent” android:minHeight=”?attr/actionBarSize” android:background=”?attr/primary” /> Last note: Your Activity class should extend AppCompatActivity public class MainActivity extends AppCompatActivity { }
has comment: http://stackoverflow.com/comment/102524744
upvote count: 18
answers question: http://stackoverflow.com/q/25863676
has comment: http://stackoverflow.com/comment/52938782
downvote count: 0
has comment: http://stackoverflow.com/comment/52938445
type: Answer
score: 18
has comment: http://stackoverflow.com/comment/52939512

http://stackoverflow.com/comment/40473973
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25862222
has text: Umm..i just use Java Swing in Class B. because it is Main screen..
score: 0

http://stackoverflow.com/a/25872403
has comment: http://stackoverflow.com/comment/40498139
type: Answer
has comment: http://stackoverflow.com/comment/40497689
has body: What version and brand of OOo you are using? On which operating system? Where did you download the OXT from? How you tried to install the extension (command line, double click in a file manager, from within OOo)?
answers question: http://stackoverflow.com/q/25869777
score: 0

http://stackoverflow.com/comment/40204409
score: 0
type: Comment
type: QuestionComment
has text: k . . I want the value of `node` in jsp page. how can I achive that.
comment on: http://stackoverflow.com/q/25718053

http://stackoverflow.com/comment/40319115
type: Comment
has text: Well the thing is that it's over a network so unless your telling me that there is a way to transact between two sybase servers. I'd be the happiest to hear it
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25779993

http://stackoverflow.com/comment/40330373
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25785908
has text: ... does MyOnBootReciver class is registerd as reciver in manifest or from code ?
score: 0

http://stackoverflow.com/q/25755587
tagged with: java
type: Question
answer count: 2
tagged with: for-loop
score: 0
tagged with: while-loop
possible better answer: http://stackoverflow.com/a/25755631
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25755631
favorite count: 0
has comment: http://stackoverflow.com/comment/40274739
accepted answer: http://stackoverflow.com/a/25755750
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40274791
has title: Making babies in "x" families
has answer: http://stackoverflow.com/a/25755750
has body: I'm attempting a code wherein you put in an input of x families, then the program should have each family have babies (with a 50/50 chance to have one of either sex) until one of each sex each achieved. Then, it should output the average, the number of families with 2, 3, 4, and 5 or more babies, and the most common number of babies it took to achieve the goal. I believe I have messed up after the while statement (somewhere in the cluster of if statements). Any help is greatly appreciated. Thanks! public class BoysAndGirls { public static void main(String[] args) { int families = Integer.parseInt(args[0]); int boy = 0; int girl = 0; int fam2 = 0; int fam3 = 0; int fam4 = 0; int fam5 = 0; int total = 0; for (int i = 0; i &lt; families; i++) { while ((boy &lt;= 1) || (girl &lt;= 1)) { if (Math.random() &lt; 0.5) { boy = boy + 1; } else { girl = girl + 1; } total++; } if (total == 2) { fam2++; } if (total == 3) { fam3++; } if (total == 4) { fam4++; } if (total &gt;= 5) { fam5++; } } double average = total / families; System.out.println("Average: " + average + " babies were had to get at least one of each sex."); System.out.println("Number of families with 2 children: " + fam2); System.out.println("Number of families with 3 children: " + fam3); System.out.println("Number of families with 4 children: " + fam4); System.out.println("Number of families with 5 or more children: " + fam5); //System.out.println("The most common number of children was " + common + "."); } }

http://stackoverflow.com/comment/40467446
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25861325
has text: oh I already changed the definition of getMyData to JNIEXPORT, so that was not a problem
score: 0

http://stackoverflow.com/a/25770414
has body: Those come from SCCS (Source Code Control System), the SCM Sun used to use. When a file was checked in %I% would be converted to the version of the file and %G% to the date the file was checked in. If memory serves correctly Sun moved to Mercurial around 2007 or so, so I don't think there's much danger of these getting updated! %E% was the date (in yy/mm/dd format, where %G% was mm/dd/yy). I don't know about %W%!
answers question: http://stackoverflow.com/q/25770145
upvote count: 2
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/40390975
has text: yeah but what if there is an empty row in between?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25819296
type: Comment

http://stackoverflow.com/a/25755273
answers question: http://stackoverflow.com/q/25755181
type: Answer
has comment: http://stackoverflow.com/comment/40273959
has body: Instead of using ListView, You may programmatically construct a viertical LinearLayout, and add TextView in each line, you can set the alignment of the TextView in lines accordingly.
has comment: http://stackoverflow.com/comment/40274064
has comment: http://stackoverflow.com/comment/40273995
score: 0

http://stackoverflow.com/comment/40215910
has text: @kiheru beat you in 13 sec :P ...
comment on: http://stackoverflow.com/q/25723984
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/42685998
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25799078
has text: Can you solved this problem? I have the same issue in my app :/, Thanks!

http://stackoverflow.com/comment/40413809
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25832120
has text: I think we might need to see your testing `Board` state as well. However it's worth mentioning that you are accessing `(Y, X)` which struck me as strange (convention is `(X, Y)`, no?)

http://stackoverflow.com/comment/40330804
type: Comment
type: QuestionComment
has text: You must use window listener for this purpose. But you can write it once if the action is common and use it for all dialogs
score: 2
comment on: http://stackoverflow.com/q/25786904

http://stackoverflow.com/a/25953001
score: 3
has body: Emanuel, I am facing some similar issues when trying to save objects with 1-to-1 relations. After spending pretty enough time with greenDAO I have found, that all "relational" objects should have appropriate mapping IDs of their "parents" before being saved to DB. So I may suggest, that if you take a look at setUser methods of your generated Picture and Address entities, you will see something like: public void setUser(User user) { synchronized (this) { this.user = user; userId = user == null ? null : user.getId(); user__resolvedKey = userId; } } Crucial is userId = user == null ? null : user.getId(); There are race conditions, as your created User object will not get ID until it is actually saved to DB. And if it does not have ID, there is a chance, that setUser of its relational entities will not work normally. In your case you may try to change save sequence to: //1. Save user to DB, this will give it ID userDao.insert(bill); //2. Set user entity with ID to its relational entities billsPicture.setUser(bill); billsAddress.setUser(bill); //3. Save relational entities pictureDao.insert(billsPicture); addressDao.insert(billsAddress); Hope my answer will be helpful to you.
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25835038
downvote count: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25835038
type: Answer

http://stackoverflow.com/q/25794589
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25795477
has title: Returning an int value from a method java
tagged with: java
possible better answer: http://stackoverflow.com/a/25794673
has comment: http://stackoverflow.com/comment/40353372
type: Question
has comment: http://stackoverflow.com/comment/40345938
has comment: http://stackoverflow.com/comment/40345409
has comment: http://stackoverflow.com/comment/40345184
has comment: http://stackoverflow.com/comment/40346078
has answer: http://stackoverflow.com/a/25804153
score: 0
has comment: http://stackoverflow.com/comment/40345158
tagged with: random
has body: I'm pretty new to java, but I'm trying to make a simulation of the finger game, 'Sticks', using my limited knowledge. This may not be the neatest, but if you're going to make a suggestion on me to do something, link a page explaining what that thing is, and I'll read it. Ok, so the issue comes up basically when I call a method to decide who's turn it is and trying to return the value for the "count" up to 5, but it's not returning to main() public static int TurnCalcBB(int PLH, int PRH, int BRH, int BLH, int Death) { //Attacking with bot Right hand Random botAtk = new Random(); if(botAtk.nextInt(2) == 1 &amp;&amp; PRH &lt;= 5) { PRH = BRH + PRH; JOptionPane.showMessageDialog(null,"Your right hand is now at " + PRH); return PRH; } else if(botAtk.nextInt(2) == 0 &amp;&amp; PLH &lt;= 5){ PLH = BRH + PLH; JOptionPane.showMessageDialog(null, "Your left hand is now at " + PLH); return PLH; } return Death; } Death is there because I was getting an error telling me that I always need to return SOMETHING so I'm returning a static value. Basically, the problem is getting PLH (player left hand) or PRH (player right hand) to return to main. If I'm not wrong, they should return as their initial variable name (PL, and PR) with the returned value correct? If not, what can I do to fix this? The code is a lot larger than this, and this issue is happening throughout the whole program, so I'm showing just 1 method and assuming they're all the same issue; the methods are almost all the same. Also, while I'm typing a question already, is nextInt() the best way to do a random number generator? When I had it as nextInt(1) it was exclusively attacking the left hand, and when I switched it to nextInt(2) now it's attacking both, but occasionally the code... "crashes" (what I mean by crashes is that it generates a number outside of what the If statements are looking for). I obviously need to to generate either a 1 or a 2 (or 0 and 1 if 0 counts).
answer count: 3
has comment: http://stackoverflow.com/comment/40346931
has comment: http://stackoverflow.com/comment/40345321
has comment: http://stackoverflow.com/comment/40345245
has comment: http://stackoverflow.com/comment/40381645
has comment: http://stackoverflow.com/comment/40362049
tagged with: return
accepted answer: http://stackoverflow.com/a/25795477
has comment: http://stackoverflow.com/comment/40345420
has comment: http://stackoverflow.com/comment/40346139
has answer: http://stackoverflow.com/a/25794673
has comment: http://stackoverflow.com/comment/40353211

http://stackoverflow.com/comment/78427015
comment on: http://stackoverflow.com/a/38406198
type: Comment
has text: Not able to find repository
score: 0
type: AnswerComment

http://stackoverflow.com/q/25727679
has answer: http://stackoverflow.com/a/25755976
upvote count: 2
type: UnansweredQuestion
has title: how to save the best tree after 10 fold cross validation on J48 / C4.5 using Weka API
tagged with: machine-learning
type: Question
tagged with: java
tagged with: weka
score: 2
answer count: 1
downvote count: 0
tagged with: decision-tree
tagged with: artificial-intelligence
favorite count: 0
has body: hope everyone is in the best of health. I want to do 10 fold cross validation on a set of data, using J48 as the classifier. So the data is loaded, then i want to create training and test sets using 10 fold cross validation, and after 10 trees are generated i want to save the tree with the best classification accuracy and use that as the rule base. So far my program loads the data, does 10 fold cross validation and then Ive tired to save the classifier. However am not sure if i am on the right track as i want to save the best tree out of the 10, and also save the rules. How can i do this ? Also where would i create test sets ? is my program doing the split correctly ? Thank you for any advice and help. import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Random; import weka.classifiers.Evaluation; import weka.classifiers.trees.J48; import weka.core.Instances; import weka.core.Range; public class Unpruned { public static void main(String [] args) { try { BufferedReader bReader = readDataFile("weather.arrf"); Instances train = new Instances(bReader); train.setClassIndex(train.numAttributes() -1); //last attribute is the class attribute J48 myTree = new J48(); myTree.setUnpruned(true); Evaluation eval=new Evaluation(train); //first supply the classifier //then the training data //number of folds //random seed eval.crossValidateModel(myTree, train, 10, new Random(1)); System.out.println("Percent correct: "+ Double.toString(eval.pctCorrect())); myTree.buildClassifier(train); System.out.print(myTree.graph()); weka.core.SerializationHelper.write("D:/myTree.model", myTree); }catch(Exception e) { e.printStackTrace(); } } public static BufferedReader readDataFile(String filename) { BufferedReader inputReader = null; try { inputReader = new BufferedReader(new FileReader(filename)); } catch (FileNotFoundException ex) { System.err.println("File not found: " + filename); } return inputReader; } } UPDATE : @matthew spence…

http://stackoverflow.com/a/25737692
type: Answer
has comment: http://stackoverflow.com/comment/40242125
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40245499
accepted answer of: http://stackoverflow.com/q/25737579
has comment: http://stackoverflow.com/comment/40247685
has comment: http://stackoverflow.com/comment/40246707
answers question: http://stackoverflow.com/q/25737579
has body: you have to also put following jar files in your lib. itext-pdfa itext-xtra as per appropriate version. try to put whole required code. Look into stack trance it may be refer to that class line where error was occur.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25730620
score: 0
tagged with: java
has body: I have lucene document like this id age status 1 1 2 C G 2 2 G 3 2 1 C G 4 2 5 C H I did search like age: 2 AND status: 'G' It returned the first three document. The problem is I did not want the third document with id:3. I only wanted the first two result. The data is arranged like this: for id 1: age 1 has status C age 2 has status G for id 3: age 2 has status C age 1 has status G and I wanted age 2 with status G not C.. This is why id 3 is wrong for me. how do I achieve this? I am using java
has answer: http://stackoverflow.com/a/25733367
tagged with: lucene
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25733367
has title: Lucene search two parameter separated by space
type: Question
answer count: 1

http://stackoverflow.com/comment/40284520
has text: @BatScream,Yes i do have
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25758353

http://stackoverflow.com/comment/40199831
has text: There are too many questions here... I recommend removing code until you get *one* compiler error, and ask a specific question about it.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25715535

http://stackoverflow.com/comment/40366652
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25806157
has text: i also put my code. please help me why i am getting 404 error

http://stackoverflow.com/q/25861041
type: UnansweredQuestion
tagged with: maven
has body: I spent 7h trying to make JSVGCanvas from Batik display a simple svg file. I can't make it work. The funny thing is that I always get different error messages given the versions of the dependencies I'm using. My last try gave me that : java.lang.NoSuchMethodError: org.apache.batik.dom.svg.SVGDOMImplementation.createCSSEngine(Lorg/apache/batik/dom/svg/SVGOMDocument;Lorg/apache/batik/css/engine/CSSContext;)Lorg/apache/batik/css/engine/CSSEngine; at org.apache.batik.bridge.BridgeContext.initializeDocument(Unknown Source) at org.apache.batik.bridge.GVTBuilder.build(Unknown Source) at org.apache.batik.swing.svg.GVTTreeBuilder.run(Unknown Source) and also sometimes : Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/apache/batik/gvt/event/AbstractAWTEventDispatcher Caused by: java.lang.ClassNotFoundException: org.apache.batik.gvt.event.AbstractAWTEventDispatcher at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) But I already saw thousands of these errors, always about noSuchMethodException, or ClassNotFoundException, but it happens inside the batik classes and I don't succeed to attach the source so I can't even try to debug it... My code is pretty simple : public class Test { private static JFrame mainFrame; public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { mainFrame = new JFrame("test"); mainFrame.setSize(800,600); mainFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); mainFrame.setVisible(true); Container pane = mainFrame.getContentPane(); pane.setLayout(new BorderLayout()); JSVGCanvas canvas = new JSVGCanvas(); …
tagged with: http://stackoverflow.com/tag/svg
tagged with: java
upvote count: 1
tagged with: swing
type: Question
has title: Can't make JSVGCanvas from Batik work in a Maven project
has answer: http://stackoverflow.com/a/29052970
downvote count: 0
answer count: 1
tagged with: batik
score: 1
favorite count: 0

http://stackoverflow.com/q/25788843
downvote count: 0
tagged with: java
has body: I want to sort an Object[][] by the first column which consists of ints. Take, for example, this array: Object[][] array = {{1, false, false}, {2, true, false}, {0, true, true}}; Now, I want to create a new array whose rows are sorted in a way that the first element of each row ascends: Object[][] newArray = ...; System.out.println(Arrays.deepToString(newArray)); What it should print: {{0, true, true}, {1, false, false}, {2, true, false}} Thank you.
has answer: http://stackoverflow.com/a/25789128
type: Question
upvote count: 2
tagged with: arrays
tagged with: sorting
possible better answer: http://stackoverflow.com/a/72335340
favorite count: 0
has answer: http://stackoverflow.com/a/25788961
accepted answer: http://stackoverflow.com/a/25788961
answer count: 3
has title: Java: Sorting a 2D array by first (int filled) column
has answer: http://stackoverflow.com/a/72335340
score: 2
type: AnsweredQuestion

http://stackoverflow.com/comment/40211012
type: Comment
comment on: http://stackoverflow.com/q/25721628
score: 0
has text: What exactly is the problem? From what you tell us it sounds as if you already solved it.
type: QuestionComment

http://stackoverflow.com/comment/40399030
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25823689
score: 0
has text: Are all icons displayed in just one row(multiple columns)? or there is one icon per row?

http://stackoverflow.com/comment/40206996
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25719032
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/60806/discussion-between-chopu-and-vks).

http://stackoverflow.com/q/25720691
has title: JPA - dynamic query with count of total results
upvote count: 1
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: spring
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/30185478
has body: In my webapplication i have a table that shows data of "UserEntity". Since there are many users, this table supports pagination. The table contains a lot of filters that may be set by the client and submitted to the server for results. The result contain a page of 10 users, and a count of total users in the DB. In order for the server to generate the result for the client i execute 2(!!!) different queries: 1) query for the filtered userEntity by page index and limit(10) 2) query for the total users in the specific filter My question is: Is it possible to query for all of these in a single query instead of two? Thanks!
tagged with: jpa
downvote count: 0

http://stackoverflow.com/comment/40238815
type: Comment
score: 0
has text: Although I'm sure you've come across it already, just in case, `while(flag)` is the same as `while(flag == true)`, just shorter. The answers can tell you what the flag means
type: QuestionComment
comment on: http://stackoverflow.com/q/25735598

http://stackoverflow.com/comment/92819923
comment on: http://stackoverflow.com/a/25775685
score: 1
type: AnswerComment
has text: Full code please? I'm confused by the order of your method calls. I used your code exactly as is and it failed. It told me the method wasn't invoked.
type: Comment

http://stackoverflow.com/a/25738050
has body: Change your web.xml to a version that supports EL (2.5+ XSD): <?xml version="1.0" encoding="ISO-8859-1"?> or whichever version <?xml version="1.0" encoding="UTF-8"?>
score: 3
upvote count: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25713607
accepted answer of: http://stackoverflow.com/q/25713607

http://stackoverflow.com/comment/40386425
score: 0
type: Comment
type: QuestionComment
has text: Create a themes class which serves up all the images that you need and dispose all (which are not already disposed) in the destructor / dispose method.
comment on: http://stackoverflow.com/q/25816834

http://stackoverflow.com/q/25774391
has comment: http://stackoverflow.com/comment/40311202
has body: I have been attempting to encrypt a text file with the PGP encryptor in my Mule flow and have so far been unsuccessful. I am executing against the CloudHub Mule Runtime (Dec 2013) as I intend to deploy to CloudHub. I have used GnuPG to generate the binary public key from the .asc file provided to me by my client and put the resulting .gpg file in my src/main/resources directory. Even though it doesn't seem like I should have to I generated my own secret gpg keyring and provided that in my application as well. When I attempt to run my flow it keeps giving me an NPE: Root Exception stack trace: java.lang.NullPointerException at org.mule.module.pgp.KeyBasedEncryptionStrategy.checkKeyExpirity(KeyBasedEncryptionStrategy.java:100) at org.mule.module.pgp.KeyBasedEncryptionStrategy.safeGetCryptInfo(KeyBasedEncryptionStrategy.java:87) at org.mule.module.pgp.KeyBasedEncryptionStrategy.encrypt(KeyBasedEncryptionStrategy.java:54) I'm not sure what is causing this. Any ideas? UPDATE: I've updated to use the latest version of AnyPoint Studio with the 3.5.1 runtime and get the same error, on line 98 this time which is the same line of code. UPDATE AND MY SOLUTION: I got it to work. It was an error on my part. I had a principal in the Encryption element that was overriding the principal from the Global element. I had placed this principal in the configuration to overcome an initial error telling me it was required. Removing this principal seems to have resolved all of my problems. ANOTHER UPDATE I can successfully encrypt using the pub and sec keys provided in a Mule blog post, however, attempting to use the gpg file that I exported from the public key (.asc file) that my client provided but I again get the NPE mentioned above. I have followed all the steps I can find for importing their key into my keyring and exporting it as a binary. I'm stumped. FINAL UPDATE So it turns out the success with the keys from the Mule blog were giving me a success that I didn't completely understand…
downvote count: 0
has comment: http://stackoverflow.com/comment/40337406
favorite count: 0
has title: PGP Encryption in Mule keeps failing with NullPointerException
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/40340457
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: pgp
has comment: http://stackoverflow.com/comment/40332347
has comment: http://stackoverflow.com/comment/40337985
tagged with: mule
tagged with: mule-studio

http://stackoverflow.com/a/25746768
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40259943
has comment: http://stackoverflow.com/comment/40264205
has comment: http://stackoverflow.com/comment/40260088
type: Answer
has comment: http://stackoverflow.com/comment/40259710
has body: That's a lot of changes you have to do. Let's start with the basic. Add a boolean to your RadioStation for the favorite state. public boolean isFavorite; Next on your getView add the favorite button click listener(add its reference to the viewholder too, but let's keep it simple this time) public class RadioAdapter extends BaseAdapter { ArrayList&lt;RadioStation&gt; myList = new ArrayList&lt;RadioStation&gt;(); LayoutInflater inflater; Context context; ListView mListview; public RadioAdapter(Context context, ArrayList&lt;RadioStation&gt; myList, ListView list) { this.myList = myList; this.context = context; mListView = list; inflater = LayoutInflater.from(this.context); } @Override public int getCount() { return myList.size(); } @Override public RadioStation getItem(int position) { return myList.get(position); } @Override public long getItemId(int position) { return 0; } @Override public View getView(final int position, View convertView, ViewGroup parent) { MyViewHolder mViewHolder; if(convertView == null) { convertView = inflater.inflate(R.layout.activity_menu_row, null); mViewHolder = new MyViewHolder(); convertView.setTag(mViewHolder); } else { mViewHolder = (MyViewHolder) convertView.getTag(); } mViewHolder.tvTitle = detail(convertView, R.id.label, myList.get(position).getTitle()); mViewHolder.tvDesc = detail(convertView, R.id.label2, myList.get(position).getDescription()); mViewHolder.ivIcon = detail(convertView, R.id.icon, myList.get(position).getImgResId()); convertView.findViewById(R.id.favButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { myList.get(position).isFavorite=! myList.get(position).isFavorite; //reorder mlist notifyDataSetChanged(); //mListView. smoothscroll here } }); ((ImageView) convertView.findViewById(R.id.favButton)).setImageResource(myList.get(position).isFavorite?R.drawable.favoriteOn:R.drawable.favoriteOff); return convertView; } private TextView detail(View v, int resId, String text) { Tex…
score: 2
has comment: http://stackoverflow.com/comment/40263365
has comment: http://stackoverflow.com/comment/40259668
upvote count: 2
has comment: http://stackoverflow.com/comment/40263177
answers question: http://stackoverflow.com/q/25746349
has comment: http://stackoverflow.com/comment/40260559
accepted answer of: http://stackoverflow.com/q/25746349

http://stackoverflow.com/q/25776665
has comment: http://stackoverflow.com/comment/40313017
type: Question
has body: im really stuck on this problem for homework and i cant seem to get my code to work. I have to use the .indexOf() method and . subString() method, and it has to be able to count both caps and lowercase vowels. any if any help will be greatly appreciated i'm really stuck. public class StringAnalyzer { public static int numberOfVowels(String aWord) { int num = 0; int length = aWord.length() -1; int index = 0; String vowels = "aeiouAEIOU"; while(index &lt;= length) { aWord = aWord.substring(index, index +1); num++; } return num; } public static void main(String[] args) { numberOfVowels("derp"); } }
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/40313056
has answer: http://stackoverflow.com/a/25776739
score: 0
has comment: http://stackoverflow.com/comment/40313031
accepted answer: http://stackoverflow.com/a/25776739
has title: Finding the number of vowels in a string
has comment: http://stackoverflow.com/comment/40312990
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40312992
tagged with: java

http://stackoverflow.com/q/25793564
type: Question
tagged with: android-optionsmenu
has title: Cannot save editText value in Android AlertDialog popup in OptionsMenu
has answer: http://stackoverflow.com/a/25793746
score: 0
answer count: 3
tagged with: android
has answer: http://stackoverflow.com/a/25793657
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25793685
tagged with: android-alertdialog
tagged with: java
has comment: http://stackoverflow.com/comment/40343191
has body: My code works like this: I click the optionsmenu, select "edit tip rate". Then, a popup appears containing a textfield and a cancel button and a save button. I enter a value in the textfield, then click save. At this point I get a nullpointer exception for the textfield ("field", in the code below) public class MainActivity extends Activity { public static final String PREFS_NAME = "MyPrefs"; // tip and tax rates private String tax_rate; private String tip_rate; // default tip and tax private String default_tax_rate = "10.0"; private String default_tip_rate = "12.0"; // tip and tax rate keys public static final String TaxRate = "tax_rate_key"; public static final String TipRate = "tip_rate_key"; // dialog popup final Context context = this; SharedPreferences sharedpreferences; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Retrieve preferences sharedpreferences = getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); if (sharedpreferences.contains(TaxRate)) { tax_rate = sharedpreferences.getString(TaxRate, ""); } else { tax_rate = default_tax_rate; } if (sharedpreferences.contains(TipRate)) { tip_rate = sharedpreferences.getString(TipRate, ""); } else { tip_rate = default_tip_rate; } } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); return true; } // This method is called once the menu is selected @Override public boolean onOptionsItemSelected(MenuItem item) { LayoutInflater layoutInflater = LayoutInflater.from(MainActivity.this); switch (item.getItemId()) { // If edit tip rate is selected case R.id.item1: View promptView1 = layoutInflater .inflate(R.layout.prompt_tip, null); editDialog(promptView1, TipRate, R.id.userInput_tip); break; // If edit tax rate is selected case R.id.item2: View promptView2 = layoutInflater .inflate(R.layout.prompt_tax, null); editDialog(promptView2, TaxRate, R.id.userInput_tax); break; } r…

http://stackoverflow.com/comment/40273546
comment on: http://stackoverflow.com/q/25754987
score: 0
type: QuestionComment
type: Comment
has text: Please include the error message in the post itself, not with a link that I won't click on.

http://stackoverflow.com/q/25753404
has comment: http://stackoverflow.com/comment/40270945
has comment: http://stackoverflow.com/comment/40270759
favorite count: 0
has comment: http://stackoverflow.com/comment/40270699
has answer: http://stackoverflow.com/a/25770426
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40271654
upvote count: 1
has comment: http://stackoverflow.com/comment/40272742
tagged with: design-patterns
has title: Right way(s) to create multiple global constants?
has comment: http://stackoverflow.com/comment/40271261
has comment: http://stackoverflow.com/comment/40272129
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40270607
type: Question
has comment: http://stackoverflow.com/comment/40271135
has comment: http://stackoverflow.com/comment/40270947
has comment: http://stackoverflow.com/comment/40270889
has comment: http://stackoverflow.com/comment/40270736
has comment: http://stackoverflow.com/comment/40271793
answer count: 1
downvote count: 0
has body: I work on a (kind of old) application where there's a maze of huge global enums / classes that declare constant keys / classes that declare constant sets of key/values. Many of these values are basically redundant... the same basic constant is declared in different enums under slightly different names, in each one of them it is associated with a different set of values. Often times such a class refers to values in other similar huge classes, to create some hierarchy of constants... as you can see in the example below. What are the right ways to define such constants? Should they be hard coded at all like now? Example: public class ParameterSet { //hundreds of similar declarations.......... public static ParameterTypeAbstract BREADCRUMB1_BREADCRUMB2_BREADCRUMB3_BREADCRUMB4_452 = new ParameterTypeSet( KeywordType.PARAMETER_OF_SOME_TYPE_26659, ParameterGroupType.PARAMETER_OF_SOME_OTHER_TYPE_967347, ParameterScopeType.ACCOUNT_TYPE_557.ACCOUNT_SUB_TYPE_33791.getStringCode(), ParameterScopeImportantType.getStringCodes(), "Some description", true, true, true, null, null); public static ParameterTypeAbstract BREADCRUMB1_BREADCRUMB2_BREADCRUMB3_BREADCRUMB4_453 = new ParameterTypeSet( KeywordType.PARAMETER_OF_SOME_TYPE_90689, ParameterGroupType.PARAMETER_OF_SOME_OTHER_TYPE_867335, ParameterScopeType.ACCOUNT_TYPE_538.ACCOUNT_SUB_TYPE_48224.getStringCode(), ParameterScopeImportantType.getStringCodes(), "Some other description", true, true, true, null, null); //hundreds of similar declarations.......... }
tagged with: anti-patterns
has comment: http://stackoverflow.com/comment/40271027

http://stackoverflow.com/comment/40573289
type: AnswerComment
has text: if it happens in a plain Eclipse Luna version, you should report this to the ResourceBundleEditor authors, as you did.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25889344

http://stackoverflow.com/q/25835553
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40419951
accepted answer: http://stackoverflow.com/a/25836057
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40421016
score: 1
has comment: http://stackoverflow.com/comment/40419915
has title: why won't my jframe appear?
favorite count: 0
has comment: http://stackoverflow.com/comment/40420402
tagged with: jframe
has comment: http://stackoverflow.com/comment/40420036
tagged with: swing
has answer: http://stackoverflow.com/a/25836057
has comment: http://stackoverflow.com/comment/40420776
type: AnsweredQuestion
has body: I am trying to display a simple jframe that I will eventually put a canvas in to render 3d objects. Last year I built two GUI programs that used jframe's and I've looked at those and they work fine, but I can't figure out why nothing happens when I run the program. This is my code: import javax.swing.*; import java.awt.*; public class Hello3d extends JFrame { JFrame frame; JLabel label; public Hello3d() { frame = new JFrame("This is a jframe, YAAAYYYY!!!!"); frame.setSize( 600, 400 ); frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); frame.setLayout( new BorderLayout() ); label = new JLabel("This is where i put somthing 3d"); frame.add( label ); frame.setVisible(true); } public static void main(String[] args) { new Hello3d(); } }

http://stackoverflow.com/comment/40437650
comment on: http://stackoverflow.com/a/25844530
score: 0
type: AnswerComment
has text: You're welcome. Your contentType is working because you are downloading it as `attachment`, it wouldn't work correctly if trying to open it inside the browser with `inline` (although `application/octet-stream` is the right contentType to use if the source is unknown...). Consider storing the right contentType when saving the file, or the first time you'll try displaying the file in the browser you will have problems with many Mime Types.
type: Comment

http://stackoverflow.com/q/25766657
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/40294069
has body: I am having an issue while doing the parsing of my file. Scenario as follows : In the file i got to parse, i have values as follows ABC/123/TEST The first 3 letters are some kind of identifiers, and its the only way i can differ the various line In grammar file: file1: str1?; str1 : NEWLINE identifier1 SLANT INTEGER SLANT ALPHA; INTEGER : [0-9]+; ALPHA : [A-Z]+; SLANT : '/'; NEWLINE : '/n'; identifier1 : 'ABC'; While running the parser, parser is not getting the line identifier as ABC, instead its giving me some strange error mismatched input 'ABC' expecting 'ABC' How can i parse against an exact string in antlr4?
tagged with: antlr
has answer: http://stackoverflow.com/a/25766850
accepted answer: http://stackoverflow.com/a/25766850
score: 0
tagged with: antlr4
has title: Exact String parsing on antlr4

http://stackoverflow.com/comment/40438278
type: Comment
type: QuestionComment
has text: Welcome and do check ur php on broswer i think it will not work change $_POST to $_REQUEST so that u can check in broswer as well with get method
score: 0
comment on: http://stackoverflow.com/q/25844862

http://stackoverflow.com/comment/40445983
type: AnswerComment
comment on: http://stackoverflow.com/a/25849537
has text: yes i have changed and tested its not redirecting, on the responce in js i put an alert, that alert displaying the jsp page waht i need to redirect. $.post("./login", { userName:username, pass:passwword }, function(data,status){ alert(data); });
score: 0
type: Comment

http://stackoverflow.com/q/25718272
downvote count: 3
type: Question
upvote count: 0
answer count: 3
has answer: http://stackoverflow.com/a/25718434
has title: Java - Read in text file, compute employee hours from most to least
favorite count: 0
accepted answer: http://stackoverflow.com/a/25718434
has body: This is for my beginning Java class. There are similar questions asking to sort the values that are given in an array; I know how to do that, but here I need to read in a text file, and then sort the values and display them by employee name and the hours that they worked, while also keeping the order from most to least. This is what the text file looks like: Jim 4 5 6 1 2 3 4 Harry 6 5 1 3 9 2 0 John 2 3 1 6 7 8 4 Lisa 2 1 5 4 1 2 6 And here is all that I know about reading in text files and my current code for this project. import java.util.Scanner; import java.io.File; import java.io.FileNotFoundException; public class EmployeeWorkHours { public static void main(String[] args) { Scanner in = new Scanner(System.in); File file = new File("/Users/ODonnell/Desktop/inputData.txt"); try { Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String line = scanner.nextLine(); System.out.println(line); } scanner.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } } }
score: -3
possible better answer: http://stackoverflow.com/a/25718338
has answer: http://stackoverflow.com/a/25718338
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25718564
linked to: http://stackoverflow.com/q/109383
tagged with: java

http://stackoverflow.com/comment/40434867
comment on: http://stackoverflow.com/q/25843346
type: Comment
has text: Unless mymapper or myFn throws an exception why do you think it would not be the case?
type: QuestionComment
score: 1

http://stackoverflow.com/q/25723459
answer count: 1
has title: Cross browser testing using TestNG
has answer: http://stackoverflow.com/a/25724423
accepted answer: http://stackoverflow.com/a/25724423
favorite count: 0
tagged with: cross-browser
tagged with: http://stackoverflow.com/tag/xml
score: 2
has body: My Code is @BeforeTest @Parameters("browser") public void browserinitialization(String browser) throws Exception { if(browser.equalsIgnoreCase("ie")) { System.setProperty("webdriver.ie.driver", "D:\\ESCLIPSE\\TestNG_project\\lib\\IEDriverServer.exe"); DesiredCapabilities caps = DesiredCapabilities.internetExplorer(); caps.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true); driver = new InternetExplorerDriver(caps); } else if(browser.equalsIgnoreCase("chrome")) { System.setProperty("webdriver.ie.driver", "D:\\ESCLIPSE\\TestNG_project\\lib\\chromedriver.exe"); DesiredCapabilities caps = DesiredCapabilities.chrome(); driver = new InternetExplorerDriver(caps); } else { throw new Exception("Browser is not correct"); } driver.get(url); } @Test public void login() throws InterruptedException { driver.findElement(By.id("txtUserName")).sendKeys("name"); driver.findElement(By.id("txtPassword")).sendKeys("password"); driver.findElement(By.id("btnOk")).click(); Thread.sleep(5000); } @AfterTest public void quit() { driver.quit(); } My XML file is <?xml version="1.0" encoding="UTF-8"?> <suite name="TestSuite" thread-count="2" parallel="tests" > <parameter name="browser" value="Chrome" /> <parameter name="browser" value="IE" /> I got the error as : FAILED CONFIGURATION: @BeforeTest browserinitialization org.testng.TestNGException: Parameter 'browser' is required by @Configuration on method browserinitialization but has not been marked @Optional or defined in C:\Users\arunkumars\AppData\Local\Temp\testng-eclipse--441013644\testng-customsuite.xml at org.testng.internal.Parameters.createParameters(Parameters.java:155) at org.testng.internal.Parameters.createParameters(Parameters.java:358) at org.testng.internal.Parameters.createConfigurationParameters(Parameters.java:86) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:199) at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:138) at org.testng.TestRunner.beforeRun(…
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: selenium
has comment: http://stackoverflow.com/comment/40215160
type: Question
has comment: http://stackoverflow.com/comment/40215223
upvote count: 2

http://stackoverflow.com/a/25817136
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25817092
has body: I am not familiar with Unix, but, don't you need to call this through the unix shell, perhaps by calling bash or other shell commands with your command array? For example the answers here Other problems Threading: you are currently asking your process to run on the Swing event thread, which if successful will cause your GUI to completely freeze and be non-usable until the process ends. You should make all calls like this background to the GUI thread such as can be achieved by using a SwingWorker object. GUI mistakes: You're calling setBounds on your JButton and adding to a container that probably uses a null layout, which marks this as code from a Swing newbie, since this means that you're making inflexible GUI's that are very difficult to upgrade or enhance. Use the layout managers to place your components. The Swing layout manager will help show you how to fix this. Regarding when I get everything working I would like to compile the whole program into a single executable so that the src2srcml is embedded into my executable and isn't required separately. No, this is likely not possible, unless you include the file in your jar as well as code to de-zip it.
type: Answer

http://stackoverflow.com/q/25714449
answer count: 1
has body: I am using ubuntu 14.04. CDH4.7 I am installing as per the procedure given in the link below http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Quick-Start/cdh4qs_topic_3_2.html The problem is I am not able to start the data node . I am getting the error as naveensrikanthd@ubuntu:/$ for x in `cd /etc/init.d ; ls hadoop-hdfs-*` ; do sudo service $x start ; done [sudo] password for naveensrikanthd: * Starting Hadoop datanode: starting datanode, logging to /var/log/hadoop-hdfs/hadoop-hdfs-datanode-ubuntu.out SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. * Starting Hadoop namenode: namenode running as process 15437. Stop it first. * Starting Hadoop secondarynamenode: secondarynamenode running as process 3061. Stop it first. naveensrikanthd@ubuntu:/$ jps 7467 RunJar 8048 RunJar 18363 Jps No Hadoop process is running and this three statements given above[slf4J] are shuffling between namenode,datanode: Below given is the log file for the path: /var/log/hadoop-hdfs/hadoop-hdfs-datanode-ubuntu.out SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation ulimit -a for user hdfs What should I do to rid of this error anyone please help in crossing this error
has title: Hadoop CDH4 Error:SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder"
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25714551
accepted answer: http://stackoverflow.com/a/25714551
tagged with: java
type: Question
tagged with: cloudera
tagged with: ubuntu
score: 0

http://stackoverflow.com/q/25762715
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25780899
possible better answer: http://stackoverflow.com/a/25763919
answer count: 3
has body: I am having a program which supports internationalisation. I have entries where input is provided in Japanese characters. On exporting that entry in XML, using JAXB, Japanese characters looks fine in the file. Proper character is been exported in the XML file. I am facing issue when unmarshal that XML file to get back data as Java object. I am not get proper unmarshalled value of japanese character. Here is my marshalling code: OutputStreamWriter outputWriter = new OutputStreamWriter(new FileOutputStream(file), "UTF-8"); JAXB.marshal(xmlobj, outputWriter); Unmarshalling code: InputStreamReader inputReader = new InputStreamReader(xml, "UTF-8"); xmlobj = JAXB.unmarshal(inputReader, &lt;JAVA_CLASS_TO_UNMARSHAL&gt;); The text I am marshalling-unmarshalling is: 説明_1 It displays correctly on fetching this record and display it to browser, but in case of JAXB unmarshalling incorrect value is displayed. After converting it to HTML compatible code I got value &amp;#35500;&amp;#26126;_1, which is actually correct conversion of Japanese characters. And it should appear as proper character on the browser, but it does not do so. It displays as HTML codes &amp;#35500;&amp;#26126;_1 to the browser. Any guess where I am doing wrong?
downvote count: 0
has answer: http://stackoverflow.com/a/25780899
tagged with: unicode
has comment: http://stackoverflow.com/comment/40287532
favorite count: 0
has title: JAXB: can not read Japanese characters properly
has answer: http://stackoverflow.com/a/25765837
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/25763919
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: jaxb

inheritance
tags question: http://stackoverflow.com/q/25813921
tags question: http://stackoverflow.com/q/25793028
tags question: http://stackoverflow.com/q/25860620
tags question: http://stackoverflow.com/q/25777771
tags question: http://stackoverflow.com/q/25732510
tags question: http://stackoverflow.com/q/25785873
tag name: inheritance
tags question: http://stackoverflow.com/q/25805789
tags question: http://stackoverflow.com/q/25811227
tags question: http://stackoverflow.com/q/25839675
type: Tag
tags question: http://stackoverflow.com/q/25715266
tags question: http://stackoverflow.com/q/25830601
tags question: http://stackoverflow.com/q/25800955
tags question: http://stackoverflow.com/q/25728055
tags question: http://stackoverflow.com/q/25716974
tags question: http://stackoverflow.com/q/25712896
tags question: http://stackoverflow.com/q/25815183
tags question: http://stackoverflow.com/q/25847300
tags question: http://stackoverflow.com/q/25799838
tags question: http://stackoverflow.com/q/25734667
tags question: http://stackoverflow.com/q/25788390
tags question: http://stackoverflow.com/q/25852634
tags question: http://stackoverflow.com/q/25805076
tags question: http://stackoverflow.com/q/25749411
tags question: http://stackoverflow.com/q/25838954
tags question: http://stackoverflow.com/q/25868972
tags question: http://stackoverflow.com/q/25756126
tags question: http://stackoverflow.com/q/25727152
tags question: http://stackoverflow.com/q/25818698

http://stackoverflow.com/q/25851293
has answer: http://stackoverflow.com/a/25851425
has title: Java Regex: Why matcher.group() does not work without matcher.find()?
possible better answer: http://stackoverflow.com/a/25851495
upvote count: 4
tagged with: regex
has answer: http://stackoverflow.com/a/25851347
downvote count: 0
tagged with: java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25851495
score: 4
answer count: 3
has body: Following code gives exception on first run. But when I set break point on matcher line and evaluate a few commands in Netbeans Watcher. It works. Why?? String regex = "/I-TASSER/output/(?&lt;jobId&gt;.*?)&gt;"; Pattern pattern; Matcher matcher; if (Pattern.compile(regex).matcher(document.html()).find()) { pattern = Pattern.compile(regex); matcher = pattern.matcher(document.html()); jobId = matcher.group("jobId"); //always give exception, so breakpoint here } I put following four lines in netbeans variable watcher matcher.group("jobId"); //exception matcher.find(); //true matcher.group("jobId"); //S12345 /*found*/ Why it is?
accepted answer: http://stackoverflow.com/a/25851347
favorite count: 0

for-loop
tags question: http://stackoverflow.com/q/25714171
tags question: http://stackoverflow.com/q/25863552
tags question: http://stackoverflow.com/q/25800068
tags question: http://stackoverflow.com/q/25818028
tags question: http://stackoverflow.com/q/25737493
tags question: http://stackoverflow.com/q/25778431
tags question: http://stackoverflow.com/q/25777981
tags question: http://stackoverflow.com/q/25715535
tags question: http://stackoverflow.com/q/25784218
tags question: http://stackoverflow.com/q/25776702
tag name: for-loop
tags question: http://stackoverflow.com/q/25825584
tags question: http://stackoverflow.com/q/25825431
tags question: http://stackoverflow.com/q/25810308
tags question: http://stackoverflow.com/q/25714902
tags question: http://stackoverflow.com/q/25750327
tags question: http://stackoverflow.com/q/25832432
tags question: http://stackoverflow.com/q/25781054
type: Tag
tags question: http://stackoverflow.com/q/25832120
tags question: http://stackoverflow.com/q/25765559
tags question: http://stackoverflow.com/q/25791972
tags question: http://stackoverflow.com/q/25841793
tags question: http://stackoverflow.com/q/25756494
tags question: http://stackoverflow.com/q/25755587
tags question: http://stackoverflow.com/q/25799235
tags question: http://stackoverflow.com/q/25860661
tags question: http://stackoverflow.com/q/25730032

http://stackoverflow.com/comment/40238755
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25735885
score: 0
has text: Also, which if statement

http://stackoverflow.com/q/25770309
has answer: http://stackoverflow.com/a/46986937
type: Question
has body: I am trying to run a class with multiple tests under two different conditions. Basically I have a bunch of tests related to a search. I am adding new functionality of a new search strategy, and in the meantime want to run the already written tests under both configurations. As we have multiple classes each with multiple tests I want to streamline this process as much as possible. Ideally it'd be great to do the setup in a @BeforeClass with a data provider so that all tests in the class are basically run twice under the different configurations, but doesn't look like this is possible. Right now I have: public class SearchTest1 { @Test(dataProvider = "SearchType") public void test1(SearchType searchType) { setSearchType(searchType); //Do the test1 logic } @Test(dataProvider = "SearchType") public void test2(SearchType searchType) { setSearchType(searchType); //Do the test2 logic } @DataProvider(name = "SearchType") public Object[][] createData() { return new Object[][]{ new Object[] {SearchType.scheme1, SearchType.scheme2} } } } Is there a better way to do this?
answer count: 2
tagged with: testng
possible better answer: http://stackoverflow.com/a/46986937
has answer: http://stackoverflow.com/a/25771253
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40301116
accepted answer: http://stackoverflow.com/a/25771253
has title: TestNG dataproviders with a @BeforeClass
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/40300755
downvote count: 0
linked to: http://stackoverflow.com/q/520328
favorite count: 0

http://stackoverflow.com/a/25748938
has comment: http://stackoverflow.com/comment/40298462
has comment: http://stackoverflow.com/comment/55173824
type: Answer
accepted answer of: http://stackoverflow.com/q/25746893
upvote count: 4
has body: If your web-services are implemented using SOAP, you can implement 2-phase commit with WS-AtomicTransaction extension. These articles go into details how it can be implemented: Using Web Services Atomic Transactions (Java) Coordinating Web Services Activities with WS-Coordination, WS-AtomicTransaction, and WS-BusinessActivity (.NET, but the concept is the same)
type: AcceptedAnswer
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/40264848
answers question: http://stackoverflow.com/q/25746893

http://stackoverflow.com/q/25838970
favorite count: 0
has body: Example: I got four image with same width and height (e.g. 128px) like: ABCD, then I want to insert another 128x128 image between BC which produce: ABECD, can't figure out how to do that, is it possible?
accepted answer: http://stackoverflow.com/a/25844939
type: Question
tagged with: android
tagged with: java
upvote count: 1
tagged with: bitmap
answer count: 1
has answer: http://stackoverflow.com/a/25844939
tagged with: image
has title: Android - Is it possible to insert an image into another image at specified position?
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/40440415
has text: http://stackoverflow.com/questions/11659485/when-does-hibernate-session-load-throw-an-exception
comment on: http://stackoverflow.com/q/25846210
score: 0
type: Comment
type: QuestionComment

javaplot
type: Tag
tags question: http://stackoverflow.com/q/25782756
tag name: javaplot

http://stackoverflow.com/a/25806012
answers question: http://stackoverflow.com/q/25805892
has body: Here is the solution of your problem. import java.util.Scanner; //trying to print pyramid shape class Try { public static void main(String[] args) { Scanner in=new Scanner(System.in); System.out.println("Enter the number of lines:"); int n=in.nextInt(); int i,j; for(i=n;i&gt;0;i--) { for( j=1;j&lt;=i;j++) { System.out.print(" "); } j=n-(i-1); for(int k=0;k&lt;j;k++) { System.out.print(j+" "); } System.out.println(); } } }
score: 0
type: Answer

embeddable
type: Tag
tags question: http://stackoverflow.com/q/25865820
tag name: embeddable
tags question: http://stackoverflow.com/q/25760361

http://stackoverflow.com/comment/40485774
type: Comment
has text: Thanks a lot! I found the solutions above!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25870776

http://stackoverflow.com/comment/40484751
has text: Why is this downvoted? I think the question is completely legit...
comment on: http://stackoverflow.com/q/25870733
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25775005
accepted answer: http://stackoverflow.com/a/25775697
linked to: http://stackoverflow.com/q/23550817
has comment: http://stackoverflow.com/comment/40310151
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40310073
tagged with: accessor
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40311486
type: Question
has answer: http://stackoverflow.com/a/25775697
has body: I am have a huge amount of trouble with this Java project. I have to Write a class that Keeps Track of the name, breed, date, and weight of the dog I must input a file containing one line per dog. I need an accessor,modifier, Arraylist and a toString Method. The main program then needs to determine the lightest dog and heaviest dog. import java.io.*; import java.util.*; import java.util.ArrayList; public class Kennel { public static void main(String args[]) { String line = ""; // string var to hold entire line if (args.length &lt; 1) { System.out.println("\n You forgot to put a file name on the command line."); System.exit(1); }; String inFile = args[0]; // file name off command line Scanner sc = null; try { sc = new Scanner(new File(inFile)); } catch (Exception e) { System.out.println("File not found"); System.exit(1); } // print a message explaining the purpose of the program. System.out.println("\nThis program inputs file "); System.out.println(args[0]); System.out.println("and outputs information about all the dogs in the registry."); System.out.println("\nWritten by Phil Trout."); System.out.println(); System.out.println("Property "+"Name "+"Value "); System.out.println(); // Loop //double heaviest = 0.0; //double lightest = 1000.0; while(sc.hasNextLine()) { // read a line from the input file via sc into line line = sc.nextLine(); } { //got from email infromation StringTokenizer stk = new StringTokenizer(line); String name = stk.nextToken(); String breed = stk.nextToken(); int month = Integer.parseInt(stk.nextToken()); int day = Integer.parseInt(stk.nextToken()); int year = Integer.parseInt(stk.nextToken()); double weight = Double.parseDouble(stk.nextToken()); Dog list = new Dog(name, breed, month, day, year, weight); ArrayList&lt;Dog&gt; dogs = new ArrayList&lt;Dog&gt;(); dogs.add(list); double firstweight = dogs.get(0).getWeight(); System.out.println(firstweight); for (int i = 0; i&lt; dogs.size(); i++) { double newweight = dogs.get(i).getWeight(); } public c…
tagged with: modifier
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40309962
answer count: 1
has comment: http://stackoverflow.com/comment/40309929
has title: Need help creating a program that finds lightest and heaviest dog

http://stackoverflow.com/a/25874255
type: Answer
accepted answer of: http://stackoverflow.com/q/25872369
has body: Edit : my mistake, see below You add the context path twice. &lt;c:url var="addAction" value="/user/add"&gt; &lt;/c:url&gt; puts the full path (context path + servlet path) in addAction , and you use it in &lt;form:form action=...&gt;, which also adds the context path. You should use instead : &lt;form:form action="/user/add" commandName="user" method="POST"&gt; You only need to use &lt;c:url .../&gt; if you use the path in a link &lt;a href="${addAction}"...&gt; I make confusion with the spring library for Velocity that I am used to and which directly knows about the servlet context. In true JSP, you have to use &lt;c:url ...&gt; to get the correct action url. I really need the stacktrace to help you : I could do some tests and the problem is not where I thought.
downvote count: 0
has comment: http://stackoverflow.com/comment/40510185
score: 1
has comment: http://stackoverflow.com/comment/40514094
has comment: http://stackoverflow.com/comment/40515191
has comment: http://stackoverflow.com/comment/40518548
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40517664
answers question: http://stackoverflow.com/q/25872369
has comment: http://stackoverflow.com/comment/40518695
has comment: http://stackoverflow.com/comment/40516656

http://stackoverflow.com/a/25716229
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25716174
type: Answer
has body: Your issue is using userinput.toString(), when you should be using usersInput = userInput.next();. You are currently retrieving the string representation of the scanner, not getting a word. Corrected main: public static void main(String[] args){ String usersInput; while(myBoolean != true) { System.out.print("Enter a word: "); usersInput = userInput.next(); myBoolean = checkInput(usersInput); } checkifComplete(); }
score: 0
accepted answer of: http://stackoverflow.com/q/25716174

http://stackoverflow.com/comment/40385542
comment on: http://stackoverflow.com/a/25809877
type: AnswerComment
score: 0
type: Comment
has text: Thak you for your answer, but maybe I'm missing something. I tried querying my index using the string escaped as you said, but when I try to print the Query q.toString() what I obtain is: 3:"fuel tank capacity en" and, once again, I did not get any document from my index...

http://stackoverflow.com/comment/40383372
type: AnswerComment
comment on: http://stackoverflow.com/a/25814181
has text: Disabled both firewall and antivirus. On launching SDK manager I am getting exception that I updated in the answer.
type: Comment
score: 0

http://stackoverflow.com/comment/40428106
score: 0
type: Comment
has text: Thank you. So it does the increment first? I thought it does the multiplication first.
type: AnswerComment
comment on: http://stackoverflow.com/a/25839678

http://stackoverflow.com/comment/40477625
comment on: http://stackoverflow.com/a/25866090
type: AnswerComment
type: Comment
has text: Added byte code to show that `Integer.valueOf()` is indeed called. Hope you don't mind :)
score: 2

http://stackoverflow.com/comment/40475655
has text: So is the unchecked cast the only way for me to go here (short of declaring `queue` to be a `BlockingQueue<Runnable>`?
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25866066

http://stackoverflow.com/comment/40257099
comment on: http://stackoverflow.com/a/25746406
score: 0
type: AnswerComment
has text: ok I understand that but does it make sense that it is faster to put everything on a arraylist and then to put it in the treeset?
type: Comment

http://stackoverflow.com/q/25764126
has body: I am retrieving json data and writing to xlsx file, but only last column data is writing and other columns are empty. String table = [{}{}{}]; JSONArray arrayJson = new JSONArray(table); FileOutputStream fos = null ; FileInputStream fis = new FileInputStream(new File("D:/File/filename1.xlsx")); XSSFWorkbook workbook = new XSSFWorkbook (fis); XSSFSheet sheet = workbook.getSheetAt(0); //Create rows XSSFRow row0 = sheet.createRow(0); XSSFCell r1c0 = row0.createCell(0); r1c0.setCellValue("Name"); XSSFRow row1 = sheet.createRow(1); XSSFCell r1c1 = row1.createCell(0); r1c1.setCellValue("Location"); XSSFRow row2 = sheet.createRow(2); XSSFCell r1c2 = row2.createCell(0); r1c2.setCellValue("Distance"); XSSFRow row3 = sheet.createRow(3); XSSFCell r1c3 = row3.createCell(0); r1c3.setCellValue("Super built up area (in sq.ft)"); XSSFRow row4 = sheet.createRow(4); XSSFCell r1c4 = row4.createCell(0); r1c4.setCellValue("No of basement/s &amp; floors"); XSSFRow row5 = sheet.createRow(5); XSSFCell r1c5 = row5.createCell(0); r1c5.setCellValue("Average floor plate"); XSSFRow row6 = sheet.createRow(6); XSSFCell r1c6 = row6.createCell(0); r1c6.setCellValue("Distance"); XSSFRow row7 = sheet.createRow(7); XSSFCell r1c7 = row7.createCell(0); r1c7.setCellValue("Super Built area"); XSSFRow row8 = sheet.createRow(8); XSSFCell r1c8 = row8.createCell(0); r1c8.setCellValue("Name"); XSSFRow row9 = sheet.createRow(9); XSSFCell r1c9 = row9.createCell(0); r1c9.setCellValue("Location"); XSSFRow row10 = sheet.createRow(10); XSSFCell r1c10 = row10.createCell(0); r1c10.setCellValue("Distance"); XSSFRow row11 = sheet.createRow(11); XSSFCell r1c11 = row11.createCell(0); r1c11.setCellValue("Super built up area (in sq.ft)"); XSSFRow row12 = sheet.createRow(12); XSSFCell r1c12 = row12.createCell(0); r1c12.setCellValue("No of basement/s &amp; floors"); XSSFRow row13 = sheet.createRow(13); XSSFCell r1c13 = row13.createCell(0); r1c13.setCellValue("Average floor plate"); XSSFRow row14 = sheet.createRow(14); XSSFCel…
has comment: http://stackoverflow.com/comment/40289676
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40290031
tagged with: java
has answer: http://stackoverflow.com/a/25765699
type: Question
tagged with: http://stackoverflow.com/tag/json
has title: writing json to excel using java poi
score: 0
accepted answer: http://stackoverflow.com/a/25765699
answer count: 1

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/25743734
tags question: http://stackoverflow.com/q/25867989
type: Tag
tags question: http://stackoverflow.com/q/25844059
tags question: http://stackoverflow.com/q/25758680

http://stackoverflow.com/comment/40469368
type: Comment
comment on: http://stackoverflow.com/a/25861960
score: 0
type: AnswerComment
has text: Can you just provide your test case i mean the input and desired out put you want to achieve?

http://stackoverflow.com/q/25746293
tagged with: xml-parsing
has title: How to parse unconventional XML files
possible better answer: http://stackoverflow.com/a/25746632
accepted answer: http://stackoverflow.com/a/25746793
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40257003
has comment: http://stackoverflow.com/comment/40257523
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 3
has answer: http://stackoverflow.com/a/25746793
type: Question
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/25746632
has body: I have the need to take what I consider an "unconventional" XML file that I get in and convert it into what I consider "conventional". The below XML examples have been "scrubbed" of proprietary names/values. Here is what the "unconventional" XML file looks like: <?xml version="1.0" encoding="UTF-8"?> 1 ABC2DEF3 12345 11:20012:3536 someItem5 Data 123456:USD 303.149 117:USD 117.000000:USD 117:USD 292.741 165:USD 165.000000:USD 165:USD 369.075 598:USD 598.000000:USD Some Data | ABC 123 2 I am trying to convert it to something like this: <?xml version="1.0" encoding="UTF-8"?> 1 ABC2DEF3 12345f 11:20012:3536 12345f someItem5 Data 123456:USD 303.149 117:USD 117.000000:USD 117:USD 292.741 165:USD 165.000000:USD 165:USD 369.075 598:USD 598.000000:USD Some Data | ABC 123 2 So basically I am trying to take the "name" attribute and make it the XML node/tag and the value between the node/tag and use it as the "value" for the XML node/tag. I have tried several different parsing/writing "routines" and the below two are the two that have gotten me the closest. So I'm leaving out the other ones as they would be just "noise". Here is what I have tried so far: private Document xmlDocument; public void convertXML() { xmlDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(new StringReader("DSExample.xml"))); DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Node dsNode = xmlDocument.getDocumentElement(); xmlDocument = docBuilder.newDocument(); // Attempt 1: doSomethingDS(dsNode); // This will convert the XML but with NO nesting - creates example output 1 // Attempt 2: traverseDS(dsNode); // This will create an XML with ONLY the root dataItems - Don't know why - creates example output 2 } public void doSomethingDS(Node node) { System.out.println(node.getNodeName()); Element xmlElement = null; // This will be the "root" element/node "dataView": if(node.getNodeName(…
answer count: 2

http://stackoverflow.com/a/25780491
has body: Try this way,hope this will help you to solve your problem. public class CityListAdapter extends BaseAdapter{ private Context context; private List objects; public CityListAdapter ( Context context, int resourceId, List objects) { this.context=context; this.objects=objects; } @Override public int getCount() { return objects.size(); } @Override public long getItemId(int position) { return position; } @Override public Object getItem(int position) { return objects.get(position); } @Override public View getView ( int position, View convertView, ViewGroup parent ) { ViewHolder holder; if(convertView==null){ holder = new ViewHolder(); convertView = LayoutInflater.from(context).inflate(R.layout.layout_city,null); holder.txtName = (TextView) convertView.findViewById(R.id.cityName); holder.txtWiki = (TextView) convertView.findViewById(R.id.cityLinkWiki); holder.imageCity = (ImageView) convertView.findViewById(R.id.ImageCity); convertView.setTag(holder); }else{ holder = (ViewHolder) convertView.getTag(); } holder.txtName.setText(((City)getItem(position)).getName()); holder.txtWiki.setText(((City)getItem(position)).getUrlWiki()); return convertView; } class ViewHolder{ TextView txtName; TextView txtWiki; ImageView imageCity; } }
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25780239

http://stackoverflow.com/a/25753540
downvote count: 0
has comment: http://stackoverflow.com/comment/40271134
has comment: http://stackoverflow.com/comment/40273026
has comment: http://stackoverflow.com/comment/40271330
type: Answer
accepted answer of: http://stackoverflow.com/q/25753383
has comment: http://stackoverflow.com/comment/40273395
has comment: http://stackoverflow.com/comment/40271163
score: 3
answers question: http://stackoverflow.com/q/25753383
upvote count: 3
has body: split regex should be : String[] arr = str.split("(?&lt;=\\G.{20})"); The above split str for every 20 chars For example below code splits str for every 15 chars: String str ="hkdhadhkshdkhskhdkashdkasgi2oyeihsadkahdkashdlkhas"; List&lt;String&gt; list = Arrays.asList(str.split("(?&lt;=\\G.{15})")); System.out.println(list); prints: [hkdhadhkshdkhsk, hdkashdkasgi2oy, eihsadkahdkashd, lkhas]
has comment: http://stackoverflow.com/comment/40273637
type: AcceptedAnswer

jruby
tags question: http://stackoverflow.com/q/25803513
type: Tag
tags question: http://stackoverflow.com/q/25773676
tag name: jruby
tags question: http://stackoverflow.com/q/25796667

http://stackoverflow.com/q/25843241
has title: How to split a string based on given any condition in java?
answer count: 1
has comment: http://stackoverflow.com/comment/40436561
has comment: http://stackoverflow.com/comment/40434687
tagged with: string
favorite count: 0
accepted answer: http://stackoverflow.com/a/25843737
tagged with: regex
type: AnsweredQuestion
downvote count: 3
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40435278
has comment: http://stackoverflow.com/comment/40434679
has body: I am new to java. I need to split and group a string based on given condition in Java like the following example, My sample input string is : M102,M103,M104,M105,M102,M103,M104,M105 I need to split and group the string into an arrays based on the condition like if the string end with ","[eg. M102,] group into array1[] or begin and end with "," [eg. ,M102,M103,..,M104,] group into array2[] or begin with "," [eg. ,M105] group into arrray3[] like the following array1[]={M102} array2[]={M103,M104..M104} array3[]={M105} For this,how to do string splitting with delimiter? can you help me to get this output?
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/25843737
has comment: http://stackoverflow.com/comment/40434608

http://stackoverflow.com/a/25718577
score: 4
upvote count: 4
downvote count: 0
has body: 6UW3xuJinEg (i mean the string after youtu.be/) is the ID most of the time. But for being more sure you can send HTTP GET request to that URL and it will respond you with a HTTP302 redirect response where you can find the actual redirection URL. you can parse that URL your previous code. To send and recieve that request and response you can use libraries like jsoup. but because it's just a simple GET request you can simply use java sockets. Connect to youtube.be on 80 port and write this in output stream: GET /6UW3xuJinEg HTTP/1.1 # Don't forget the blank lines
answers question: http://stackoverflow.com/q/25718304
type: Answer
has comment: http://stackoverflow.com/comment/40719558
has comment: http://stackoverflow.com/comment/40205663
has comment: http://stackoverflow.com/comment/40205696

http://stackoverflow.com/a/25807278
downvote count: 0
type: Answer
has body: Instead of just calling showOpenDialog without obtaining a reference to the result, do this button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int result = chooser.showOpenDialog(frame); Then you check if the result == JFileChooser.APPROVE_OPTION which means the Open button was pressed. Then you can get the selected file int result = chooser.showOpenDialog(frame); if (result == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); Then you want to check the selected item in the combo box. If it equals "binary", do your binary action, else do text action. Something like button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int result = chooser.showOpenDialog(frame); if (result == JFileChooser.APPROVE_OPTION) { String type = comboBox.getSelectedItem().toString(); File file = chooser.getSelectedFile(); if ("binary".equals(type)) { // do binary action } else { try { BufferedReader reader = new BufferedReader(new FileReader(file)); textArea.read(reader, null); } catch (Exception ex) { ex.printStackTrace(); } } } } }); See more at How to use File Choosers.
has comment: http://stackoverflow.com/comment/40435981
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25805694
accepted answer of: http://stackoverflow.com/q/25805694
type: AcceptedAnswer

http://stackoverflow.com/q/25753220
type: UnansweredQuestion
tagged with: maven
upvote count: 1
downvote count: 1
has body: I have a good project where we are currently generating reports with jasper reports files . Suddenly I am to generate these reports by the use of "Creation of a DropWizard micro-service for running reports. " I have no idea what to do or where to start with or whats my goal . I looked into the web a bit just to confused myself. Can anyone help me with the understanding what is to be done here and what will be the starting point. Your guidelines will highly be appriciated
has answer: http://stackoverflow.com/a/25923925
type: Question
tagged with: java
tagged with: mysql
answer count: 1
favorite count: 0
score: 0
tagged with: dropwizard
has title: Creation of a DropWizard micro-service for running reports.
has comment: http://stackoverflow.com/comment/40270336

http://stackoverflow.com/a/25857393
score: 10
type: AcceptedAnswer
has body: The error was actually in my implementation of Retrofit Callback. My implementation was expecting an object when it should be expecting an array in this case. Thanks everyone for the help. Before //*****MyData*****// public class MyData { private List&lt;Data&gt; dataList; public List&lt;Data&gt; getElements() { return dataList; } public class Data { @SerializedName("key1") private String key1; @SerializedName("key2") private String key2; // Getters and Setters } } //*****Callback Implementation*****// public class MyDataCallback extends Callback { public MyDataCallback(MyDataCallbackListener&lt;MyData&gt; myDataCallbackListener) { super(myDataCallbackListener); } @Override public void success(MyData data, Response response) { if (myDataCallbackListener != null) { myDataCallbackListener.onCallbackComplete(true, response, MyDataCallback.CALLBACK_SUCCESS_MESSAGE, data); } } } After //*****Data*****// public class Data { @SerializedName("key1") private String key1; @SerializedName("key2") private String key2; // Getters and Setters } //*****Callback Implementation*****// public class MyDataCallback extends Callback { public MyDataCallback(MyDataCallbackListener&lt;List&lt;Data&gt;&gt; myDataCallbackListener) { super(myDataCallbackListener); } @Override public void success(List&lt;Data&gt; data, Response response) { if (myDataCallbackListener != null) { myDataCallbackListener.onCallbackComplete(true, response, MyDataCallback.CALLBACK_SUCCESS_MESSAGE, data); } } }
accepted answer of: http://stackoverflow.com/q/25817604
upvote count: 10
type: Answer
answers question: http://stackoverflow.com/q/25817604
downvote count: 0

http://stackoverflow.com/a/25799053
has comment: http://stackoverflow.com/comment/40374008
has body: Just leaving the value empty on the RHS should be fine: password= Sample code: import java.io.*; import java.util.*; class Test{ public static void main(String [] args) throws Exception { Properties props = new Properties(); props.load(new StringReader("password=")); System.out.println(props.size()); // 1 System.out.println(props.getProperty("password").length()); // 0 } }
has comment: http://stackoverflow.com/comment/40373807
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25799030
downvote count: 0
has comment: http://stackoverflow.com/comment/40373991
answers question: http://stackoverflow.com/q/25799030
score: 32
type: Answer
upvote count: 32
has comment: http://stackoverflow.com/comment/40373982
has comment: http://stackoverflow.com/comment/40375015

http://stackoverflow.com/comment/40414144
score: 0
type: Comment
type: QuestionComment
has text: provide some code that you have been tested.
comment on: http://stackoverflow.com/q/25832324

http://stackoverflow.com/a/25784608
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25784533
has comment: http://stackoverflow.com/comment/40327098
has comment: http://stackoverflow.com/comment/40326980
has body: You can try something like this. By the way this is not a good way to do this. Scanner userReply = new Scanner(System.in); System.out.println("Do you want to play again? Answer with Y/N)"); String answer= userReply.nextLine().toLowerCase(); if("y".equals(answer)){ main(args); // recursively call }else { System.out.println("game exit"); } You can use do-while to do it in proper way. Better way public static void main(String[] args) { boolean isValid; do { isValid = true; runGame(); Scanner userReply = new Scanner(System.in); System.out.println("Do you want to play again? Answer with (Y/N)"); String answer = userReply.nextLine().toLowerCase(); if ("y".equals(answer)) { isValid =true; } else { isValid =false; System.out.println("game exit"); } } while (isValid); } public static void runGame() { // your game logic }
has comment: http://stackoverflow.com/comment/40328475
downvote count: 0
has comment: http://stackoverflow.com/comment/40326950

http://stackoverflow.com/a/25717205
answers question: http://stackoverflow.com/q/25717179
score: 0
type: AcceptedAnswer
has body: Use for loops as below: // For number 01-31 for (int i = 1; i &lt;= 31; i++) { day[i] = (i&lt;10) ? ("0"+i) : (""+i) ; } //number 2556-2467 for(int x = 2556 ; x &gt;= 2467 ; x--) { year[x] = "" + x; }
type: Answer
accepted answer of: http://stackoverflow.com/q/25717179

http://stackoverflow.com/comment/40345025
comment on: http://stackoverflow.com/q/25794417
score: 0
type: Comment
has text: A stack is a list that implements limited access to the list elements.
type: QuestionComment

http://stackoverflow.com/comment/40308503
type: Comment
comment on: http://stackoverflow.com/a/25774188
has text: Yes, jumps out of the first loop, so it just prints 1 line, instead of many. as you would want.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40367874
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25807133
has text: In my module(project) I want to use child version. Because parent POM is for the whole company I cannot modify it.
score: 0

http://stackoverflow.com/comment/40198672
score: 0
type: AnswerComment
type: Comment
has text: So how should i go about it to get what i want?
comment on: http://stackoverflow.com/a/25715013

http://stackoverflow.com/comment/40358358
has text: How are you setting up `mDataList` and `mAdapter` and how are they related?
comment on: http://stackoverflow.com/q/25801631
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40474514
has text: i have missed bean **"entityManagerFactory** in my solution.i have edited my solution
score: 1
comment on: http://stackoverflow.com/a/25821956
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40258008
type: Comment
comment on: http://stackoverflow.com/a/25737038
score: 0
type: AnswerComment
has text: Unfortunately it's not our computers. We're a commercial library that lots of companies use. And some are going toward absolutely gigantic reports so we need to do everything we can. I think creating our own StringBuilder using CharSequence may be as you said our best bet. Sometimes I miss C++...

http://stackoverflow.com/comment/41645817
type: QuestionComment
has text: I'm having the same problem. Did you manage to fix it?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25843149

http://stackoverflow.com/comment/40426424
comment on: http://stackoverflow.com/a/25838806
has text: Thanks. This helps but for some reason there still appears to be an offset on the Y axis. If I set to position the Y axis at 0 it appears about 200 pixels above 0. Do you know why that may be?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25836860
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40688690
has comment: http://stackoverflow.com/comment/40707816
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/40688729
has comment: http://stackoverflow.com/comment/40671973
has comment: http://stackoverflow.com/comment/40554097
type: Question
tagged with: android-layout
answer count: 2
has answer: http://stackoverflow.com/a/25975667
has comment: http://stackoverflow.com/comment/40590836
has comment: http://stackoverflow.com/comment/40625177
has comment: http://stackoverflow.com/comment/40693337
has comment: http://stackoverflow.com/comment/40695359
has comment: http://stackoverflow.com/comment/40518989
has comment: http://stackoverflow.com/comment/40592995
score: 4
has comment: http://stackoverflow.com/comment/40644053
has comment: http://stackoverflow.com/comment/40467684
has answer: http://stackoverflow.com/a/25995184
accepted answer: http://stackoverflow.com/a/25995184
has comment: http://stackoverflow.com/comment/40514114
tagged with: android
has title: UI flicker while pressing back in android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40549536
favorite count: 0
has body: I am creating a UI for my company which has a edit-text at top and a frame layout at bottom. this frame-layout contains a mic image and animation on pressing of which it goes through 3 main state like listening.thinking and idle state. So in short, user can provide query either by typing in edit text or by providing command by voice. My problem occurs when user click on edit-text to provide text command. When user do so the android keyboard comes up and user insert text but after entering text if user press back button the ,the whole UI comes up before going down. This all happens very quickly and to a user it gives bad impression. It feels like UI is getting stuck but this is how by default android is handling it. Is there a way by which I can stop this flickering or make this move smoothly.? Currently I am making this frame layout invisible when user start editing and visible when user has finished editing but this also does not help. I know by not providing complete code it is not a good way of asking a doubt. <?xml version="1.0" encoding="utf-8"?> <!--will dynamically add here widgets and edit text button as required> // Act as parent container for mic image and text view //contains text view which gets displayed on top of mic image <TextView/> // contains mic images // contains mic image for listening state <ImageView/> <ImageButton /> <ImageButton/> <ImageView /> //contain mic images for thinking state <ImageButton /> <ImageButton /> <ImageView /> <ImageButton />//contains mic image for idle state And in my manifest I have android:windowSoftInputMode="stateAlwaysHidden|adjustResize" and android:configChanges="keyboard|keyboardHidden|orientation|screenSize|locale" Please let me know how i can correct my UI behavior.
possible better answer: http://stackoverflow.com/a/25975667
downvote count: 1
has comment: http://stackoverflow.com/comment/40519048
has comment: http://stackoverflow.com/comment/40693736

http://stackoverflow.com/comment/40473204
type: QuestionComment
has text: Before running the job, build should be successful..My build is getting failed.
score: 0
comment on: http://stackoverflow.com/q/25863001
type: Comment

http://stackoverflow.com/comment/40287288
type: Comment
type: QuestionComment
has text: Maybe a `List` of `Dog` objects and each `Dog` object contains the dog code and a JFrame.
comment on: http://stackoverflow.com/q/25762772
score: 0

http://stackoverflow.com/q/25720553
upvote count: 1
score: 1
tagged with: java
has body: Below are my code snippet for using WritableComparator, but it does not work import org.apache.hadoop.io.WritableComparable; import org.apache.hadoop.io.WritableComparator; public class MovieComparator extends WritableComparator{ public MovieComparator(){ super(Movie.class); } @Override public int compare(WritableComparable o,WritableComparable o2){ System.out.println("in compare"); Movie m = (Movie)o; Movie m2 = (Movie)o2; System.out.println(m.compareTo(m2)); return m.movieId.compareTo(m2.movieId); } } public class Movie implements WritableComparable { Text movieId; Text movieTitle; public Movie(Text movieId, Text movieTitle) { this.movieId = movieId; this.movieTitle = movieTitle; } public Movie(){ } public String getMovieId() { return movieId.toString(); } public void setMovieId(String movieId) { this.movieId = new Text(movieId); } public String getMovieTitle() { return movieTitle.toString(); } public void setMovieTitle(String movieTitle) { this.movieTitle = new Text(movieTitle); } @Override public void readFields(DataInput in) throws IOException { //movieId = in.read; movieId.readFields(in); movieTitle.readFields(in); } @Override public void write(DataOutput out) throws IOException { //out.writeUTF(movieId); //out.writeUTF(movieTitle); movieId.write(out); movieTitle.write(out); } @Override public int compareTo(Movie o) { // System.out.println("in compareTo"); int res=movieTitle.compareTo(o.movieTitle); return res; } @Override public int hashCode(){ return movieId.hashCode(); } @Override public boolean equals(Object o){ Movie m=(Movie)o; return movieId.equals(m.movieId); } @Override public String toString(){ return movieTitle.toString(); } } In driver class I am setting the comparator by below line job.setSortComparatorClass(MovieComparator.class); Can any body tell me where I am wrong in this at it gives exception below 14/09/08 14:17:03 WARN mapred.LocalJobRunner: job_local_0001 java.io.IOException: Spill failed at org.apache.hadoop.mapred.MapTask$MapOutputBuffe…
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/25765573
downvote count: 0
answer count: 1
has title: how to work with WritableComparator Hadoop
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/25837884
type: Answer
has body: id should be null String[] id_ep = new String[id.size()]; You are getting NullPointerException on this line only thing that could lead that exception due to id. If id is null, this line looks like String[] id_ep = new String[null.size()]; Hence null pointer exception. You can either check if that is null if(id!=null) String[] id_ep = new String[null.size()]; You might want to check this line id.add(jsonobject.getString("id"));
answers question: http://stackoverflow.com/q/25837331
has comment: http://stackoverflow.com/comment/40425543
has comment: http://stackoverflow.com/comment/40430574
score: 0

http://stackoverflow.com/a/70924166
has body: there is actually a way to check public class TaskSchedulerService{ private final ThreadPoolTaskScheduler taskScheduler; //initialize it here or in constructor private Map&lt;String,ScheduledFuture&lt;?&gt;&gt; scheduleMap = new ConcurrentHashMap&lt;&gt;(); public TaskSchedulerServiceImpl() { this.schedulerName = schedulerName; taskScheduler.initialize(); } public boolean isScheduled(String taskId) { final ScheduledFuture&lt;?&gt; exits = scheduledTasks.get(taskId); return exits != null &amp;&amp; exits.isDone(); } public ScheduledFuture&lt;?&gt; schedule(String taskId, Runnable task, Date date) { ScheduledFuture&lt;?&gt; scheduled = scheduleMap.get(taskId); if (scheduled==null ) { ScheduledFuture&lt;?&gt; future = taskScheduler.schedule(task, date); scheduleMap.put(taskId, future); return future; } else { // log it is already scheduled return scheduled; } } i know it is too late but i hope others can get benefit from it The logic behind the implementation is whenever you are trying to schedule a task, you will have to add it to the map with the taskId as well, in this case it is better to find any task if exists in MAP or if needed remove it as well as checking if that task is done or not
downvote count: 0
answers question: http://stackoverflow.com/q/25737346
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/125381705
score: 2
has comment: http://stackoverflow.com/comment/125432892

http://stackoverflow.com/comment/40286154
type: AnswerComment
comment on: http://stackoverflow.com/a/25760569
type: Comment
has text: Thank you very much. My Calculator now works fine and now i will try to make it work with two or more digit numbers. And for the variable naming; i named some of them with my own language that's beacuse it may seem terrible to you:) and i'm sorry for posting it like that
score: 0

http://stackoverflow.com/comment/40446345
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25850008
has text: @mark yep that simplifies the code compareFunc = comparators.reduce((a, b ) -> 0, (a, b) -> a.thenComparing(b)); thanxs
type: QuestionComment

foreach
tags question: http://stackoverflow.com/q/25862531
tags question: http://stackoverflow.com/q/25762437
type: Tag
tags question: http://stackoverflow.com/q/25765559
tag name: foreach
tags question: http://stackoverflow.com/q/25854555

http://stackoverflow.com/comment/40345505
has text: As a matter of taste, I prefer not to introduce nullchecks where you don't really need them. But that's just personal feeling - you could argue pro and con. Regardless, I have the suspicion that this not the OP's problem.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25794673

http://stackoverflow.com/q/25815728
downvote count: 2
has title: Java program calculates incorrectly for certain data set but correctly for other data set
has body: I am writing a very simple program in which the user is trying to find out if he alters the diameter of a pancake (both new and old diameters are user inputted), given the quantity (user inputted), how many pancakes with the new diameter he can make. Now my calculation works with the test data: 10 old Diameter, 8 old Quantity, 4 new diameter. This results in 50 new pancakes which is correct, but when i enter 5 old Diameter, 10 old Quantity, 10 new diameter. This results in 1.59999 new pancakes which is incorrect, the answer should be 2.5. Here is my code, any help would be appreciated: import java.util.Scanner; public class pancakes { public static void main(String[] args) { int diameterOld = 0; // used to save diameter of original pancakes int quantityOld = 0; // used to save quantity of original pancakes int diameterNew = 0; // used to save diameter of new pancakes double quantityNew = 0; // used to save quantity of new pancakes double areaNew = 0; // used to store area of new pancakes double areaOld = 0; // used to store area of original pancakes double totalSurfaceArea = 0; // total amount of batter used Scanner input = new Scanner(System.in); // allows keyboard input System.out.println ("Mohammad's java Pancakes"); System.out.print ("Diameter of original pancakes (inches): "); // Prints statement asking for diameter of original pancakes diameterOld = input.nextInt(); // saves input into diameterOld System.out.print ("Quantity of original pancakes: "); // Prints statement asking for quantity of original pancakes quantityOld = input.nextInt(); // saves input into quantityOld System.out.print ("Diameter of new pancakes (inches): "); // Prints statement asking for diameter of new pancakes diameterNew = input.nextInt(); // saves input into diameterNew areaOld = ((diameterOld/2)*(diameterOld/2)*Math.PI); // calculates area of original pancakes totalSurfaceArea = (areaOld * quantityOld); // calculates total amount of batter needed areaNew = ((diameterNew/2)*(diameterN…
possible better answer: http://stackoverflow.com/a/25815801
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40384178
has comment: http://stackoverflow.com/comment/40384142
has answer: http://stackoverflow.com/a/25815799
has answer: http://stackoverflow.com/a/25815801
score: -1
has answer: http://stackoverflow.com/a/25815839
tagged with: eclipse
answer count: 3
favorite count: 0
tagged with: date-arithmetic
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25815799
tagged with: java

http://stackoverflow.com/q/25846857
has body: I want to create a messaging application for Android, so I've been reading up about XMPP and Asmack. Asmack sounds pretty much exactly what I want, especially after reading this other question - Android and XMPP: Currently available solutions. However, I'm fairly new to Android programming and also Github. I have found the src for Asmack at https://github.com/Flowdalic/asmack, and also downloaded the jar from http://asmack.freakempire.de/4.0.4/, which I have included in my project. However I am unsure how the folders in the github asmack folder are supposed to be used. After hours trawling google trying to find some sort of step by step guide on how to set aSmack up, and not finding anything useful, I'm losing the will to live! I'm using the following example code I found on the Smack github page, and I dont get any errors: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); XMPPTCPConnection connection = new XMPPTCPConnection("jabber.org"); try { connection.connect(); connection.login("mtucker", "password"); } catch (SmackException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XMPPException e) { // TODO Auto-generated catch block e.printStackTrace(); } Chat chat = ChatManager.getInstanceFor(connection) .createChat("jsmith@jivesoftware.com", new MessageListener() { public void processMessage(Chat chat, Message message) { System.out.println("Received message: " + message); } }); try { chat.sendMessage("Howdy!"); } catch (NotConnectedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (XMPPException e) { // TODO Auto-generated catch block e.printStackTrace(); } } However I haven't used the 'build environment' from aSmack github repository - how is this meant to be included/used? Thanks for any help!
score: 0
has comment: http://stackoverflow.com/comment/40440621
tagged with: xmpp
answer count: 1
tagged with: smack
has comment: http://stackoverflow.com/comment/40442777
tagged with: asmack
type: UnansweredQuestion
tagged with: android
linked to: http://stackoverflow.com/q/4769020
tagged with: java
has answer: http://stackoverflow.com/a/27382472
type: Question
has title: Asmack set up for Android

http://stackoverflow.com/a/51034987
has comment: http://stackoverflow.com/comment/94388011
upvote count: 0
score: -5
has body: import org.hibernate.Criteria; import org.hibernate.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Transactional public int changepassword(String password, long mobile) { // TODO Auto-generated method stub session = factory.getCurrentSession(); Query query = session.createQuery("update User u set u.password='" + password + "' where u.mobile=" + mobile); int result = query.executeUpdate(); return result; } add this code 200% it will work... might scenario is diff but write like this:)
answers question: http://stackoverflow.com/q/25821579
downvote count: 5
type: Answer

http://stackoverflow.com/comment/40465732
type: QuestionComment
has text: What part isn't working? What is actually happening?
comment on: http://stackoverflow.com/q/25860326
score: 0
type: Comment

http://stackoverflow.com/q/25789597
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40335426
has comment: http://stackoverflow.com/comment/40335742
type: Question
linked to: http://stackoverflow.com/q/22926107
score: -1
has comment: http://stackoverflow.com/comment/40336098
has answer: http://stackoverflow.com/a/25790977
answer count: 3
has answer: http://stackoverflow.com/a/25790908
has body: I need to filter a document if the caption is the same surname (i.e.,Smith Vs Smith or John Vs John etc.). I am converting entire document into a string and validating that string against a regular expression. Could any one help me to write a regular expression for the above case.
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25790858
type: UnansweredQuestion
has title: Java Regex to match repeated keywords
tagged with: regex

http://stackoverflow.com/a/25765633
upvote count: 2
has body: You don't need to use integer, just simply decrement your character. You can write this: for(int i= 0; i &lt; textToEncrypt.length (); ++i) { char c = textToEncrypt.charAt(i); c--; System.out.print(c); }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25764784
score: 2

apache-wink
tags question: http://stackoverflow.com/q/25759045
type: Tag
tag name: apache-wink

http://stackoverflow.com/a/25828915
has comment: http://stackoverflow.com/comment/40407994
has comment: http://stackoverflow.com/comment/40407932
has comment: http://stackoverflow.com/comment/40408022
has comment: http://stackoverflow.com/comment/40408079
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25828895
has body: Looking at the documentation for InetAddress, I don't see any public constructors. Instead, I see several static factory methods. You should use one of these.
type: Answer
answers question: http://stackoverflow.com/q/25828895
upvote count: 1
has comment: http://stackoverflow.com/comment/40407906
downvote count: 1
has comment: http://stackoverflow.com/comment/40408038

http://stackoverflow.com/q/25761433
tagged with: android
has comment: http://stackoverflow.com/comment/40284709
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/25761558
has body: I am trying to send the notification via service. The time of the notification is set from the database table where I have date, time etc columns. So when System.currentTimeMillis is equal to the time from database column I am trying to send the notification to the user. However my implementation doesn't work, could someone please help me? Thanks in advance Here is my Service file public class MyService extends Service { private NotificationManager notificationManager; private DBHelper dbHelper; private SQLiteDatabase db; @Override public void onCreate() { Log.i("myLOgs", "Service: onCreate()"); super.onCreate(); dbHelper = new DBHelper(this); db = dbHelper.getReadableDatabase(); notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i("myLOgs", "Service: onStartCommand()"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); Date date = new Date(); String currentDateString = dateFormat.format(date); SimpleDateFormat timeFormat = new SimpleDateFormat("HH-mm"); Date time = new Date(); String currentTimeString = timeFormat.format(time); String[] columns = {DBHelper.DATE, DBHelper.TIME, DBHelper.EVENT}; Cursor cursor = db.query(DBHelper.TABLE_NAME, columns, null, null, null, null, null); cursor.moveToFirst(); do { String dateString = cursor.getString(cursor.getColumnIndex(DBHelper.DATE)); String timeString = cursor.getString(cursor.getColumnIndex(DBHelper.TIME)); String eventString = cursor.getString(cursor.getColumnIndex(DBHelper.EVENT)); if((currentDateString.equals(dateString)) &amp;&amp; (currentTimeString.equals(timeString))) { Notification notification = new Notification(R.drawable.ic_launcher, eventString, System.currentTimeMillis()); } if(cursor.moveToLast()) { cursor.moveToFirst(); } }while(true); //return super.onStartCommand(intent, flags, startId); } @Override public IBinder onBind(Intent intent) { return null; } @Override public void…
has title: How to send Notifications via Service
answer count: 2
has answer: http://stackoverflow.com/a/25763874
accepted answer: http://stackoverflow.com/a/25763874
downvote count: 0
has comment: http://stackoverflow.com/comment/40285529
favorite count: 0
has answer: http://stackoverflow.com/a/25761558

http://stackoverflow.com/comment/40243653
type: Comment
has text: Answer has been added to the OP. A simple logic error is all!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25738743

http://stackoverflow.com/q/25771937
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40307061
has title: running multiple threads simultaneously
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40305881
type: Question
has comment: http://stackoverflow.com/comment/40304683
has comment: http://stackoverflow.com/comment/40304007
has comment: http://stackoverflow.com/comment/40303889
score: 0
has body: Help me please. I would like to run all threads from array in one time public class Main { public static void main(String[] args) { String [] folders = (new counter()).readfile(); Thread[] threads = new Thread[folders.length]; for (int i = 0; i &lt; folders.length; i++) { threads[i] = new Thread(new MyThread(folders[i])); } startThreads(threads); } private static void startThreads(Thread[] threads) { for (Thread t : threads) t.start(); } } Other with Executors,but in this case I have n threader, which wait each other. http://joxi.ru/b6AQVP3JTJBmfbW41MA String [] folders = (new counter()).readfile(); Thread[] threads = new Thread[folders.length]; int size= folders.length; for (int i = 0; i &lt; folders.length; i++) { threads[i] = new Thread(new MyThread(folders[i])); } ExecutorService executor = Executors.newFixedThreadPool(folders.length); for (int i = 0; i &lt; size; i++) { Runnable worker = new MyThread(folders[i]); executor.execute(worker); } executor.shutdown(); while (!executor.isTerminated()) { } System.out.println("Finished all threads");
has comment: http://stackoverflow.com/comment/40303731
has comment: http://stackoverflow.com/comment/40306020
has comment: http://stackoverflow.com/comment/40304022

http://stackoverflow.com/q/25868180
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40479619
tagged with: java
downvote count: 3
accepted answer: http://stackoverflow.com/a/25868360
has title: Write a class named Calculator with a method int sum(String s)
type: Question
has comment: http://stackoverflow.com/comment/40479345
has comment: http://stackoverflow.com/comment/40479135
has body: String s contains a set of integers separated by white space (blanks, tabs, or newlines). Return the sum of the integers. You can use a Scanner object to solve this problem. Create a new Scanner(s) and store it in a variable, say in. Then, use in.hasNextInt() to control a while loop. Each iteration of the while loop uses in.nextInt() to get the next integer from the String s. Accumulate this integer into a variable and return that variable when the loop exits. You may use a main method to test your method by creating an instance of the Calculator class and calling sum(…) with several combinations of values using that instance. For example, sum(“3 4 5 27 3”) is 42. I have written this so far: import java.util.Scanner; public class Calculator { public static void main(String[] args) { } public int sum(String s){ int i = 0; Scanner in = new Scanner(s); while (in.hasNextInt()) { sum = sum + in.nextInt(); } return sum; } }
has comment: http://stackoverflow.com/comment/40479360
answer count: 2
tagged with: while-loop
upvote count: 0
possible better answer: http://stackoverflow.com/a/25869022
tagged with: string
has answer: http://stackoverflow.com/a/25869022
favorite count: 0
has answer: http://stackoverflow.com/a/25868360
score: -3

http://stackoverflow.com/q/25714827
has title: Confusion upon the difference between Java Client and Java Server
downvote count: 1
upvote count: 0
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/25715042
tagged with: java
score: -1
has body: From my understanding the Java Client is what is rendered onto the browser such as the javascript, "the client side" for example what the user see's (tables, html, the sorting etc) things in the jsp. The server side is the servlet that makes the connection and call the specific class's based upon the request. I feel as though I am completely wrong as when I do research I am getting different answers. CAn I get some clarification on this please.
has comment: http://stackoverflow.com/comment/40198564
answer count: 1
tagged with: jsp
tagged with: javascript
favorite count: 0

http://stackoverflow.com/q/25739955
favorite count: 0
has answer: http://stackoverflow.com/a/25740094
has answer: http://stackoverflow.com/a/25739973
type: Question
possible better answer: http://stackoverflow.com/a/25740016
has title: How to format a date to following format day.month.year?
has answer: http://stackoverflow.com/a/25740016
tagged with: calendar
has comment: http://stackoverflow.com/comment/136905357
linked to: http://stackoverflow.com/q/41562905
score: 0
tagged with: simpledateformat
tagged with: java
has comment: http://stackoverflow.com/comment/40245565
answer count: 3
upvote count: 1
has body: I need to format a date to following format: 10.12.2014 and I am using the following code but it returns following error Messages: Unparseable date: "2014-12-10" Code SimpleDateFormat formatter = new SimpleDateFormat("dd.mm.yyyy"); Date date = formatter.parse(param.getFromDate()); String formattedDate = formatter.format(date);
accepted answer: http://stackoverflow.com/a/25739973
downvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/a/25847392
score: 8
downvote count: 0
upvote count: 8
accepted answer of: http://stackoverflow.com/q/25847300
answers question: http://stackoverflow.com/q/25847300
type: AcceptedAnswer
has body: Method calls are virtual in Java, which means that the method from an object's actual type is called, regardless of what type the reference was which you used to access the object. Direct field access on the other hand is not virtual, so which r you access will depend on the type of the reference through which you reached it.
type: Answer

http://stackoverflow.com/comment/40236823
has text: But, I think there is one issue. For example, if java.util.Date is broken due to the OS clock as I said, we get also issues when we convert joda-time to Date class. The reason is that simply the data inside util.Date is broken. So, we cannot create the correct object of util.Data class.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25734931
type: AnswerComment

http://stackoverflow.com/q/25867773
has body: I'm wondering if there is any way to interact with a plugin from an external application ? Say I have an eclipse plugin running. I want to write another standalone application which calls this plugin and gets some result from it . Is this possible ?
has comment: http://stackoverflow.com/comment/40478442
has title: Interacting with Eclipse plugin from external application
answer count: 0
has comment: http://stackoverflow.com/comment/40478660
tagged with: eclipse-plugin
type: Question
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40478596
type: UnansweredQuestion
tagged with: eclipse

http://stackoverflow.com/q/25865469
has answer: http://stackoverflow.com/a/25870848
accepted answer: http://stackoverflow.com/a/25870848
has answer: http://stackoverflow.com/a/25865558
tagged with: client-server
has comment: http://stackoverflow.com/comment/40474456
tagged with: console
has body: probably a noobish Q: So i made a very simple single-threaded server/client model. Now when i execute the program in the eclipse IDE it shows me System.out's of the server and not the ones from the client. When i press terminate, the System.out.println lines that were supposed to be generated by Client show up. I'm struggling with this for days now.. Hopefully someone can help me out. Thanks in advance! SERVER: import java.net.*; import java.io.*; public class Server { public static void main(String[] args) { new Server(); } public Server() { try { ServerSocket serverSocket = new ServerSocket(8000); //nieuw instantie van een ServerSocket System.out.println("Waiting for clients.."); Socket socket = serverSocket.accept(); // lister for socket requests while(true) { BufferedReader inputClient = new BufferedReader(new InputStreamReader(socket.getInputStream())); DataOutputStream clientOutput = new DataOutputStream(socket.getOutputStream()); String clientInput = inputClient.readLine(); System.out.println("Server: clientInput= : " + clientInput); InetAddress hostAddress = InetAddress.getByName(clientInput); String iPaddress = hostAddress.getHostAddress(); System.out.println("Server: IP = : " + iPaddress); clientOutput.writeBytes(iPaddress); clientOutput.flush(); } } catch(IOException ex) { System.err.println(ex); } } } CLIENT: import java.io.*; import java.net.*; public class Client { public static void main(String[] args) { new Client(); } public Client() { try { Socket socket = new Socket("localhost", 8000); DataOutputStream toServer = new DataOutputStream(socket.getOutputStream()); BufferedReader fromServer = new BufferedReader(new InputStreamReader(socket.getInputStream())); toServer.writeBytes("google.com" + '\n'); String ip = fromServer.readLine(); System.out.println("Client: "+ ip); } catch(IOException ex) { System.err.println(ex); } } }
answer count: 3
downvote count: 0
tagged with: client
favorite count: 0
possible better answer: http://stackoverflow.com/a/25865558
upvote count: 2
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25866513
has title: java client-server issue on client side (no System.out)
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/q/25805507
has comment: http://stackoverflow.com/comment/40364968
has comment: http://stackoverflow.com/comment/40365062
has comment: http://stackoverflow.com/comment/40365495
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40365102
tagged with: android
has comment: http://stackoverflow.com/comment/40365141
tagged with: java
has answer: http://stackoverflow.com/a/25805546
has body: my splash.java code is: package com.example.copyandroid1; import android.app.Activity; import android.os.Bundle; public class Splash extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout); } }
type: Question
tagged with: r.java-file
has comment: http://stackoverflow.com/comment/40365249
has title: Giving error at - setContentView(R.layout.splash);
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40364958

http://stackoverflow.com/a/29499445
answers question: http://stackoverflow.com/q/25835577
downvote count: 0
has body: North, is correct. South, adding b2 will overwrite b1, what you want to do is create a new container like JPanel and add b1 to b2 to that container. Then add this container to south. This new container can use GridLayout(1,2) Center, is correct. East and west, the components are 'blank' so the default size giving by layout manager is none ( painting in the container background != isNotBlank() ). You can however use circles*.setPrefferredSize(dimension) to force a size on them.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/a/25843166
score: 0
type: AcceptedAnswer
has body: You need to have the font installed on pc to be able to show it. So try sending the font to your friend alogn with your app.
type: Answer
accepted answer of: http://stackoverflow.com/q/25841371
answers question: http://stackoverflow.com/q/25841371

http://stackoverflow.com/comment/40298705
type: QuestionComment
score: 2
has text: Yes we do need to server code
comment on: http://stackoverflow.com/q/25769206
type: Comment

http://stackoverflow.com/comment/40283983
has text: but i am using windows tester for a desktop based application and not a web based application so i cannot use selenium in that case.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25759287

http://stackoverflow.com/a/25774398
has body: You should be able to achieve this by setting the checkForPrincipalChanges property on the pre-auth filter to true. From the API docs: the pre-authenticated principal will be checked on each request and compared against the name of the current Authentication object. If a change is detected, the user will be reauthenticated. You'll probably also want to set invalidateSessionOnPrincipalChange property (if you want the previous session to be forgotten).
has comment: http://stackoverflow.com/comment/40309679
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25772232
answers question: http://stackoverflow.com/q/25772232
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/q/25847849
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/25847968
tagged with: deprecated
tagged with: java
answer count: 1
tagged with: jquery
score: 0
has body: I liked the deprecation approach of jquery 1.9. first, they deprecates methods and then removed them in next version. For, backward compatibility, they provide migration plugin. Similar approach could be apply in java as well by removing deprecated methods and providing migration jar for backward compatibility. This way, use of deprecated methods in new projects will be minimized and developers don't need to check whether method in the api is deprecated or not. But, java don't follow it. So, is there any flaw in the approach?
has title: Deprecation approach of jquery could be apply in java

http://stackoverflow.com/comment/40337910
type: QuestionComment
comment on: http://stackoverflow.com/q/25788569
has text: It would not hurt to have it answered. There is not enough information on anotation based configuration so it should be recognized. Put the answer here and I will mark it as answered!
score: 0
type: Comment

http://stackoverflow.com/q/25779623
score: 11
has comment: http://stackoverflow.com/comment/112609813
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/112442206
tagged with: java
has comment: http://stackoverflow.com/comment/40318234
has title: Sending the DEFAULT placeholder via JDBC?
type: Question
answer count: 2
tagged with: sql
has answer: http://stackoverflow.com/a/25781909
has body: Is there any way, via JDBC, to send the DEFAULT placeholder explicitly, like in INSERT INTO sometables VALUES (blah, DEFAULT)? (I'm almost certain the answer is "no", but I'm looking for JDBC-expert confirmation). Say you had a PreparedStatement like: INSERT INTO mytable(a, b) VALUES (?, ?) for table: CREATE TABLE mytable ( a integer, b integer default some_function() ); and you wanted to use the database-set DEFAULT for mytable.b in some executions in a batch but not others. In regular SQL you'd write: INSERT INTO mytable(a, b) VALUES (1, 42) INSERT INTO mytable(a, b) VALUES (2, DEFAULT); ... or of course: INSERT INTO mytable(a, b) VALUES (1, 42) INSERT INTO mytable(a) VALUES (2); ... but you can't do this via JDBC. setString("DEFAULT") will of course not send the DEFAULT keyword, just the string-literal 'DEFAULT'. Is there a way to set a placeholder-parameter that means DEFAULT in any widely used drivers? I don't see a way to do it with the standard API and spec. I'm imagining something like: pstmt.setObject(2, Postgresql.DEFAULT, Types.OTHER); where Postgresql.DEFAULT is a special placeholder instance, since there doesn't seem to be a setDefault() method for PreparedStatement. Does any existing driver support this?
downvote count: 0
favorite count: 0
tagged with: jdbc
has answer: http://stackoverflow.com/a/25779732
upvote count: 11
accepted answer: http://stackoverflow.com/a/25781909
possible better answer: http://stackoverflow.com/a/25779732

http://stackoverflow.com/comment/40282685
comment on: http://stackoverflow.com/q/25760257
type: Comment
has text: You do a search of SO or Google and look for JNI/JNA related questions on the same subject
type: QuestionComment
score: 1

http://stackoverflow.com/q/25745772
has answer: http://stackoverflow.com/a/25745851
answer count: 1
favorite count: 0
tagged with: android-asynctask
tagged with: android
upvote count: 1
accepted answer: http://stackoverflow.com/a/25745851
type: AnsweredQuestion
tagged with: java
downvote count: 3
type: Question
has body: package my.home.page; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.params.HttpConnectionParams; import org.json.JSONException; import org.json.JSONObject; import android.os.AsyncTask; import android.os.Bundle; import android.app.Activity; import android.util.Log; import android.view.Menu; import android.widget.Toast; public class MainActivity extends Activity { private AsyncTask&lt;JSONObject, JSONObject, JSONObject&gt; result; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); try { JSONObject toSend = new JSONObject(); toSend.put("id", "2151"); JSONTransmitter transmitter = new JSONTransmitter(); result=transmitter.execute(new JSONObject[] {toSend}); } catch (JSONException e) { e.printStackTrace(); } } public class JSONTransmitter extends AsyncTask&lt;JSONObject, JSONObject, JSONObject&gt; { String url = "Some url"; @Override public JSONObject doInBackground(JSONObject... data) { JSONObject json = data[0]; HttpClient client = new DefaultHttpClient(); HttpConnectionParams.setConnectionTimeout(client.getParams(), 100000); JSONObject jsonResponse = null; HttpPost post = new HttpPost(url); try { StringEntity se = new StringEntity(json.toString()); post.addHeader("content-type", "application/json"); post.setEntity(se); HttpResponse response; response = client.execute(post); String resFromServer = org.apache.http.util.EntityUtils.toString(response.getEntity()); jsonResponse=new JSONObject(resFromServer); Log.i("Response from server", jsonResponse.getString("EventId")); } catch (Exception e) { e.printStackTrace();} return jsonResponse; } } } how i can return jsonResponse in class MainActivity ? i try : void and call void .get etc Pls help me !)///////////////////////////////////////////////////…
has title: Java SE android AsyncTask
score: -2

http://stackoverflow.com/a/25822983
score: 0
has comment: http://stackoverflow.com/comment/40397289
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25822883
type: Answer
has body: Use Arrays.copyOfRange to get an array without the first element (front) as follows: arr = Arrays.copyOfRange(1, arr.length);
answers question: http://stackoverflow.com/q/25822883

http://stackoverflow.com/a/25790287
has comment: http://stackoverflow.com/comment/40368635
has body: public void main does not exist in Android. It doesn't get called automatically, you must call it yourself. And you can't display web content in a TextView like that. There's a component called WebView for this job. Just remove main, replace your TextView in XML with a WebView and use this code: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.lyout.activity_main); WebView prikazTeksta = (WebView) findViewById(R.id.webView); prikazTeksta.loadUrl("http://www.pocketnow.com"); } ...
has comment: http://stackoverflow.com/comment/40361101
score: 0
has comment: http://stackoverflow.com/comment/40338319
has comment: http://stackoverflow.com/comment/40345667
answers question: http://stackoverflow.com/q/25789975
type: Answer
has comment: http://stackoverflow.com/comment/40337020

http://stackoverflow.com/q/25757183
type: UnansweredQuestion
tagged with: java
has body: Basically have a simple process that involves mapping letters and numbers 2 spaces forward so an A would encode to C , 1 to 3 and such. There is wraparound for so Z would encode to B and 0 would encode to 2. The encode works fine, but after the first cycle of the loop the decode seems to map back 4 spaces instead of 2. Here's the code, let me know what you guys think the problem is. Encode/Decode public class EncodeDecode { private String[] originalList; private String[] encodedList; private String[] decodedList; public EncodeDecode(String[] oL) { originalList = oL; encodedList = originalList; decodedList = originalList; for (int cnt = 0; cnt &lt; oL.length; cnt++) { encodedList[cnt] = originalList[cnt]; } for (int cnt = 0; cnt &lt; oL.length; cnt++) { decodedList[cnt] = originalList[cnt]; } } public String encode(String originalWord) { //Maps every character in original word to 2 positions forward w/ wrap around. String result = ""; for (int cnt = 0; cnt &lt; originalWord.length(); cnt++) { result += forwardMap(originalWord.charAt(cnt)); } encodedList[0] = result; return result; } public String decode(String codedWord) { //Maps every character back 2 spaces w/ wrap around String result = ""; for (int cnt = 0; cnt &lt; codedWord.length(); cnt++) { result += backMap(codedWord.charAt(cnt)); } decodedList[0] = result; return result; } public char forwardMap(char ch) { char result = Character.toLowerCase(ch); if (result == 'a') return 'c'; if (result == 'b') return 'd'; if (result == 'c') return 'e'; if (result == 'd') return 'f'; if (result == 'e') return 'g'; if (result == 'f') return 'h'; if (result == 'g') return 'i'; if (result == 'h') return 'j'; if (result == 'i') return 'k'; if (result == 'j') return 'l'; if (result == 'k') return 'm'; if (result == 'l') return 'n'; if (result == 'm') return 'o'; if (result == 'n') return 'p'; if (result == 'o') return 'q'; if (result == 'p') return 'r'; if (result == 'q') return 's'; if (result == 'r') return 't'; if (result ==…
type: Question
tagged with: encoding
tagged with: arrays
has answer: http://stackoverflow.com/a/25757689
has answer: http://stackoverflow.com/a/25757429
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25757704
has title: Encode/Decode Script that decodes and encoded string twice

http://stackoverflow.com/a/25731218
downvote count: 0
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25728581
upvote count: 2
has body: Well I'm using Java8 for some time, and indeed I've found that I'm using longer names more often. My take on that is a simple rule of thumb: I like short name or not. I usually go for short names like i or y if it's obvious what's happening inside of a stream. If you're processing a stream of widgets and doing a 4-6 operations, writing widget each time is annoying and lines start to look the same after couple of operations. So for stream of same things, where from context I easily know what I'm working on, I sometimes go for short variables. It's same as with the loop iterators, where everyone use i and not index. On the other hand, if Im doing a lot of processing and especially if I need to map something, I like to give descriptive names, going even to extreme like widget, filteredWidget, widgetHeight etc. As for common notation on the web, please remember that a lot of people try to promote new Java syntax. It's cool that it can be short so they tend to take it as far as possible. In Javaland we always had to write a lot, and my guess is that people overreact to the fact we can type less. Look for examples at Venkat S. talks about groovy or .js from 2 years back, he often undelrined how important it is that he does not have to type semicolon at the end of the line. That how our brain works I guess.

http://stackoverflow.com/comment/40410078
type: QuestionComment
score: 0
has text: I don't see what changes you did to get the answer
comment on: http://stackoverflow.com/q/25829683
type: Comment

http://stackoverflow.com/comment/40273731
score: 0
type: Comment
has text: @AlexD Yes, realized that after reading your answer, although it is still truncated (doesn't represent a complete JPEG).
type: QuestionComment
comment on: http://stackoverflow.com/q/25754469

programming-languages
tags question: http://stackoverflow.com/q/25784417
tags question: http://stackoverflow.com/q/25715285
tag name: programming-languages
type: Tag

http://stackoverflow.com/comment/40319690
type: Comment
has text: Ugh! Storing the target alphabet as `String a = "d"` is not going to help you, because you cannot turn a letter from your string into a variable name. You need to learn about arrays and other container classes. For the task at hand, write a function that turns a source letter into a target letter. You can make use of the fact that the 26 letters form a contiguous block in ASCII.
comment on: http://stackoverflow.com/q/25780189
score: 0
type: QuestionComment

http://stackoverflow.com/q/25837505
score: 0
answer count: 1
has body: I've a problem with the application installers generated by Netbeans. I have a Netbeans application project with one module. The Java target platform is set to 1.7. The development system is Netbeans 8.0.1 on Mac OS. I generate the installers with "Package as" =&gt; "Installers". When i try to run the installer on an Ubuntu with JRE 1.7 installed it fails with an UnsupportetClassVersionError. When I run the ZIP-packaged application it works fine. It seems that the class version of the installer is not compatible to 1.7. So, my question is: Is there any way to configure the Java version of the installer itself?
tagged with: java
type: UnansweredQuestion
has title: Netbeans Platform installer target platform
has answer: http://stackoverflow.com/a/30439139
tagged with: netbeans
tagged with: installation
type: Question

http://stackoverflow.com/comment/40205531
type: QuestionComment
comment on: http://stackoverflow.com/q/25718642
has text: Try `URLEncoder` & `URLDecoder`.
score: 0
type: Comment

http://stackoverflow.com/q/25721400
has answer: http://stackoverflow.com/a/25722983
tagged with: java
has title: Spring REST - Construct link from Entity
has comment: http://stackoverflow.com/comment/40211640
has answer: http://stackoverflow.com/a/31214065
linked to: http://stackoverflow.com/q/18404219
answer count: 3
upvote count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25722983
tagged with: spring
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25723260
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25723260
has comment: http://stackoverflow.com/comment/40211537
score: 1
linked to: http://stackoverflow.com/q/16471636
has body: I'm using Spring + JPA and i have mapped an entity as an Database View, where i got all fields. Now i want add one field to this entity and return a link image based to another field (all image are stored in resource/images) @Entity @Table(name = "Release") public class Release implements Serializable { private String user; private String userImageLink; // This is what i need to implement @XmlElement @JsonProperty public String getUser(){ return user; } public void setUser(String user) { this.user = user; } public String getUserImageLink(){ String imageUrl = /*i need to access to resource/images and create the link If i run on localhost should return: http://127.0.0.1:8080/resources/images.. In production coudl return: http://myServer.com/resources/images.. */; return imageUrl; } } } The question is: how i can create and return this url ? MORE INFO If the table have 3 entry: User1, User2, User3 In the userImageLink i should return: http://myserver.com/resources/images/User1.jpg http://myserver.com/resources/images/User2.jpg Isn't important if the image exists or not in resources/image, i just need to compose the url as additional parameter when i access to the Service that take the data from my "Release" @Entity
has comment: http://stackoverflow.com/comment/40211231
type: Question

marker
tag name: marker
tags question: http://stackoverflow.com/q/25819715
type: Tag

http://stackoverflow.com/comment/40471085
comment on: http://stackoverflow.com/q/25862498
score: 0
type: Comment
type: QuestionComment
has text: Can you show the java code?

http://stackoverflow.com/a/25743219
downvote count: 0
has comment: http://stackoverflow.com/comment/40253732
has body: You problem is the transaction demarcation. You notify your other thread before the transaction is completed. The data in a database can only be queried when the transaction creating the data is ended (with a commit) (there are some exceptions for some databases but I will not go into depth for this). To solve your problem you have to commit your transaction before querying it from another thread.
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25742997
answers question: http://stackoverflow.com/q/25742997
has comment: http://stackoverflow.com/comment/40257615
type: AcceptedAnswer

http://stackoverflow.com/q/25761622
duplicate of: http://stackoverflow.com/q/205573
tagged with: java
has comment: http://stackoverflow.com/comment/40287007
has body: I have a lot of classes that extend an abstract base class. I would like to automatically create an instance of each one and add them into an array list of base class objects, so when I need to iterate through the list I can call the same method and do something else depending on what derived class the current object is. The problem is how to instantiate everything automatically as the number of derived classes can be high, about 40-50, maybe more afterwards. Any help would be appreciated. EDIT: I added a commentary in which I explained more details about the question
has title: Automatic class instantiation
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40287082
has comment: http://stackoverflow.com/comment/40285368
upvote count: 1
linked to: http://stackoverflow.com/q/205573
has comment: http://stackoverflow.com/comment/40285867

http://stackoverflow.com/a/25848812
has comment: http://stackoverflow.com/comment/40444013
type: Answer
has body: You're working with jagged array (or array of arrays) String[][] personalInfo = new String[10][4]; so in order to itterate it you should use different lengths for dimensions (in general case the required length is personalInfo[i].length): for (int i = 0; i &lt; personalInfo.length; ++i) // &lt;- outer array for (int j = 0; j &lt; personalInfo[i].length; ++j) // &lt;- inner length depends on i if (personalInfo[i][j] == null) { personalInfo[i][j] = addedContact; break; }
answers question: http://stackoverflow.com/q/25848655
score: 0

http://stackoverflow.com/comment/107847372
type: AnswerComment
has text: Is this answer using a newer version than the 5.5 year old question? Is `sbt` still used?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/60956863

http://stackoverflow.com/q/25854032
score: 1
upvote count: 1
has title: Screen Sizes with res-long-hdpi
type: Question
accepted answer: http://stackoverflow.com/a/25854109
possible better answer: http://stackoverflow.com/a/25854331
tagged with: java
tagged with: screen-size
has answer: http://stackoverflow.com/a/25854331
answer count: 2
downvote count: 0
has body: I went through an online splash generator and got : res-long-land-xhdpi res-long-port-xhdpi res-long-land-xxhdpi res-long-port-xxhdpi res-notlong-land-xhdpi res-notlong-port-xhdpi res-notlong-land-xxhdpi res-notlong-port-xxhdpi from it. What are these used for? Why should we use them?
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/25854109
type: AnsweredQuestion

http://stackoverflow.com/comment/40334159
has text: +1 Arrays.asList is not immutable, however the number of elements cannot change.
comment on: http://stackoverflow.com/a/25787813
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25761402
tagged with: operation
has title: What is the corresponding of UML operation properties(isQuery,Sequential,guarded, and concurrent) in Java Programming Language?
upvote count: 1
favorite count: 0
type: UnansweredQuestion
has body: in the UML you can specify the properties of class operations as isQuery,Sequential,guarded, and concurrent What is the equivalent of these properties in Java?
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: uml
type: Question
tagged with: oop

http://stackoverflow.com/comment/40311749
type: QuestionComment
score: 3
comment on: http://stackoverflow.com/q/25775972
has text: Since this is a yes/no q/a I would say: Yes.
type: Comment

http://stackoverflow.com/comment/40329850
score: 0
type: AnswerComment
has text: Sorry I misunderstood. But I understand that I have to parse the lines with lineparsed = reader.readLine(), which contains the line! It's great! Thank you very much, that's what I needed.
type: Comment
comment on: http://stackoverflow.com/a/25785403

http://stackoverflow.com/comment/40371810
type: QuestionComment
has text: @NathanHughes, Sadly all I know is that it is a SQL database that I cannot manipulate directly in a meaningful way (such as create a new one or influence its structure)
comment on: http://stackoverflow.com/q/25808849
score: 0
type: Comment

http://stackoverflow.com/q/25867989
has answer: http://stackoverflow.com/a/25868064
downvote count: 1
linked to: http://stackoverflow.com/q/1262328
type: Question
has body: I am using Jconsole for monitoring a Java Application. The memory tab shows different Heap and Non Heap memories like Heap Memory Usage Non Heap Memory Usage Memory Pool "CMS Old Gen" Memory Pool "Par Eden Space" Memory Pool "Par Survivor Space" Memory Pool "Code Cache" Memory Pool "CMS Perm Gen" What is the difference between these terms. Also please provide some information regarding - how to find anomalies in the application behavior by monitoring these parameters.
has comment: http://stackoverflow.com/comment/40478870
score: 26
tagged with: jconsole
has comment: http://stackoverflow.com/comment/40478872
upvote count: 27
accepted answer: http://stackoverflow.com/a/25868171
answer count: 3
has title: What is the difference between Java Non Heap Memory and Stack Memory? Are they Same if not what is the difference between them?
tagged with: jvm
favorite count: 0
tagged with: heap-memory
has answer: http://stackoverflow.com/a/25868059
type: AnsweredQuestion
tagged with: memory-management
tagged with: java
has answer: http://stackoverflow.com/a/25868171
possible better answer: http://stackoverflow.com/a/25868064

http://stackoverflow.com/comment/40465789
comment on: http://stackoverflow.com/q/25860502
score: 3
type: Comment
type: QuestionComment
has text: Are the recursive calls terminating? You can increase thread stack space size. [See here](http://stackoverflow.com/questions/3700459/how-to-increase-the-java-stack-size) and [other related questions/answers](http://stackoverflow.com/questions/20030120/java-default-stack-size).

http://stackoverflow.com/a/25821125
has body: I'm not sure what you're asking, but it kind of sounds like you're describing Arrays.copyOf or Arrays.copyOfRange. import java.util.Arrays; public class Foo { static &lt;A&gt; A[] decreaseArray(A[] as) { return Arrays.copyOf(as, as.length - 1); } public static void main(String[] args) { System.out.println(Arrays.asList( decreaseArray(new String[] {"a", "b", "c"}))); // [a, b] System.out.println(Arrays.asList( decreaseArray(new String[] {}))); // java.lang.NegativeArraySizeException } }
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40443050
answers question: http://stackoverflow.com/q/25820897

http://stackoverflow.com/a/25792107
has comment: http://stackoverflow.com/comment/68408898
has body: Use Parcelable and not Serializable. Read this tuto This is how your class should be : import android.os.Parcel; import android.os.Parcelable; public class TabooCard implements Parcelable { public static final Parcelable.Creator&lt;TabooCard&gt; CREATOR = new Parcelable.Creator&lt;TabooCard&gt;() { @Override public TabooCard createFromParcel(Parcel source) { return new TabooCard(source); } @Override public TabooCard[] newArray(int size) { return new TabooCard[size]; } }; String mainWord, taboo1, taboo2, taboo3, taboo4, taboo5; public TabooCard() { this("Main Card", "Taboo 1", "Taboo 2", "Taboo 3", "Taboo 4", "Taboo 5"); } public TabooCard(String mainword, String taboo1, String taboo2, String taboo3, String taboo4, String taboo5) { setMainWord(mainword); setTaboo1(taboo1); setTaboo2(taboo2); setTaboo3(taboo3); setTaboo4(taboo4); setTaboo5(taboo5); } public TabooCard(Parcel in) { setMainWord(in.readString()); setTaboo1(in.readString()); setTaboo2(in.readString()); setTaboo3(in.readString()); setTaboo4(in.readString()); setTaboo5(in.readString()); } @Override public int describeContents() { return 0; } @Override public void writeToParcel(Parcel dest, int flags) { dest.writeString(mainWord); dest.writeString(taboo1); dest.writeString(taboo2); dest.writeString(taboo3); dest.writeString(taboo4); dest.writeString(taboo5); }
accepted answer of: http://stackoverflow.com/q/25791787
type: Answer
has comment: http://stackoverflow.com/comment/40361653
score: 7
answers question: http://stackoverflow.com/q/25791787
upvote count: 7
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25726896
score: 0
has comment: http://stackoverflow.com/comment/40220772
has body: You have to define the transaction-type to JTA in JavaEE environment. So change it to <persistence-unit name="com.madejekz_RestTest2_war_1.0-SNAPSHOTPU" transaction-type="JTA"> org.eclipse.persistence.jpa.PersistenceProvider Please note that RESOURCE_LOCAL should be mentioned in JavaSE environment.
answers question: http://stackoverflow.com/q/25726739
type: Answer
has comment: http://stackoverflow.com/comment/40268852
has comment: http://stackoverflow.com/comment/40299956
has comment: http://stackoverflow.com/comment/40240397

http://stackoverflow.com/comment/40258763
has text: But that still means i have to change all the implementations? At least replace implements with extends?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25747029

http://stackoverflow.com/comment/40439836
has text: Don't try to run your code if it doesn't even compile. Open the Markers or Problems view of your Eclipse IDE, and fix all the compilation errors listed there before even thinking about running your code.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25845496

http://stackoverflow.com/q/25766697
type: Question
has comment: http://stackoverflow.com/comment/40294058
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
linked to: http://stackoverflow.com/q/3829513
has answer: http://stackoverflow.com/a/25766807
type: UnansweredQuestion
has title: Why tomcat is not running in user account of window 7?
tagged with: netbeans
score: 1
tagged with: java
upvote count: 1
has body: I have installed netbean IDE8.0 and tomcat (by customize option in netbean during installation) in Administration account of window7. when i am running project in netbean it is ok . But when i am running same project in same netbean, in window user account, it is asking for tomcat user id and password, while i have not setted any user id for tomcat. can any one help me, how to resolve this problem. Thanks to all in advance.

http://stackoverflow.com/comment/130285374
score: 0
has text: @daniel-darabos Most Eclipse code is separated in non-Eclipse-specific and Eclipse-specific plugins (mostly with the extension `.ui`) for that purpose. There are even separate projects of non-Eclipse-specific vs. Eclipse-specific Eclipse projects, for instance JGit/EGit or LSP4J/LSP4E. `Platform.getBundle(x)` is Eclipse-specific. Turning an application into an Eclipse-based application should be problem either.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25722965

http://stackoverflow.com/q/25740088
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25740596
linked to: http://stackoverflow.com/q/1951558
tagged with: swingx
has answer: http://stackoverflow.com/a/25740175
has answer: http://stackoverflow.com/a/25746669
answer count: 3
has answer: http://stackoverflow.com/a/25740596
upvote count: 1
has comment: http://stackoverflow.com/comment/40245805
favorite count: 0
has body: I would like to create a close button. For this, I need a close icon, which I would like to get from the current UI style. I've found a function for this: UIManager.getIcon(key) The only problem is, that I don't know any key. I have no idea, how to get a close icon.
has title: Java swing close icon
tagged with: swing
possible better answer: http://stackoverflow.com/a/25740175
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/25760233
tagged with: hibernate-criteria
has title: Hibernate: how can I retrieve last N entries with Criteria Interface?
duplicate of: http://stackoverflow.com/q/2810693
type: Question
has answer: http://stackoverflow.com/a/25760486
tagged with: database
answer count: 2
downvote count: 0
has body: How can I retrieve last N entries from database with Hibernate Criteria Interface? Criteria crit = hiberSession.createCriteria(UserTable.class); Or even would be better to retrieve random N entries...
accepted answer: http://stackoverflow.com/a/25760486
favorite count: 0
possible better answer: http://stackoverflow.com/a/25760455
score: 2
has answer: http://stackoverflow.com/a/25760455
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2810693
upvote count: 2
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/25801706
has title: Ternary Operator help in Java
has comment: http://stackoverflow.com/comment/40358700
score: -3
upvote count: 1
has comment: http://stackoverflow.com/comment/40358654
type: Question
has comment: http://stackoverflow.com/comment/40358805
has comment: http://stackoverflow.com/comment/40358891
tagged with: java
has body: public int getCurrentRemainingCr() { return (currentEarnedCr &gt;= 120)?(REQUIRED_CR - currentEarnedCr):0; I'm trying to use ternary operators in place of if-else...basically my if-else was implying that if current credit is greater than or equal to 120, then set cred remaining to 0. This above code though still brings up issue in test method in junit.
tagged with: eclipse
has answer: http://stackoverflow.com/a/25801767
answer count: 2
downvote count: 4
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40359068
tagged with: ternary-operator
has answer: http://stackoverflow.com/a/25801746
has comment: http://stackoverflow.com/comment/40358584

http://stackoverflow.com/a/25805309
score: 1
has body: The method you're looking for is Character.digit(char ch, int radix). if (Character.digit('C',16) == -1) { System.out.println("Invalid Character"); } Character.forDigit() works the other way around, like others have already pointed out.
answers question: http://stackoverflow.com/q/25805161
accepted answer of: http://stackoverflow.com/q/25805161
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/40264020
score: 4
type: Comment
type: QuestionComment
has text: User rights. The servlet is most likely run as "tomcat" or something alike. When you "run independently" it is your user that's trying to create a file.
comment on: http://stackoverflow.com/q/25750081

http://stackoverflow.com/comment/40442492
score: 0
comment on: http://stackoverflow.com/q/25847798
type: Comment
type: QuestionComment
has text: @Paul i m using java7

http://stackoverflow.com/comment/40310369
has text: It is included in the file name extracted from the CSV.
comment on: http://stackoverflow.com/q/25775182
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25786542
has answer: http://stackoverflow.com/a/25786672
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/40330028
has comment: http://stackoverflow.com/comment/40329953
has comment: http://stackoverflow.com/comment/40330004
has comment: http://stackoverflow.com/comment/40330093
has answer: http://stackoverflow.com/a/25786861
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/25787917
has answer: http://stackoverflow.com/a/25786676
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40332621
tagged with: java
has comment: http://stackoverflow.com/comment/40332352
score: -4
has body: I changed my program a little. The new problem is that the execution doesn't stop! /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package inplacesort; import java.util.*; /** * * @author ASUS */ public class InplaceSort { static Scanner console = new Scanner(System.in); /** * @param args the command line arguments */ public static void main(String[] args) { Vector &lt;Integer&gt; intList = new Vector &lt;Integer&gt; (); //getting the numbers from the user char ans = 'y'; while (ans == 'Y' || ans == 'y') { System.out.print("Enter a Number: "); intList.addElement(console.nextInt()); System.out.print("Do You Want to Continue?(Y/N)"); ans = console.next().charAt(0); } System.out.println(intList); for (int i = 1; i &lt; intList.size(); i++) { //if (intList.elementAt(i) &lt; intList.elementAt(i-1)) //{ int j = i - 1; while (j &gt;= 0 &amp;&amp; intList.elementAt(i) &lt; intList.elementAt(j)) { j--; } if (j == -1) { j = 0; } for (int k = intList.size() - 1; k &gt;= j; k--) { intList.insertElementAt(intList.elementAt(k),k + 1); } intList.insertElementAt(intList.elementAt(i+1),j); intList.removeElementAt(i+1); //} } System.out.print(intList); } }
type: Question
accepted answer: http://stackoverflow.com/a/25787917
linked to: http://stackoverflow.com/q/3988788
has answer: http://stackoverflow.com/a/25786720
possible better answer: http://stackoverflow.com/a/25786672
has comment: http://stackoverflow.com/comment/40330119
has comment: http://stackoverflow.com/comment/40329980
has comment: http://stackoverflow.com/comment/40330722
has title: The executing doesn't stop java

http://stackoverflow.com/a/25727352
has body: You are transferring the data from "data" in public FormData(FormData oldData); in editTicket(); So whenever you edit Edit2 or Edit3 you will also change data's original values. You'll need to use clone() in your clone method, or new Object(oldObject) whenever applicable, like String s = new String(oldString); Edit: When I say "transfer" I mean you are just assigning a reference to the original value. So you are not creating a nw value in yuour public FormData(FormData oldData);
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25727209
has comment: http://stackoverflow.com/comment/40241568
downvote count: 0
type: Answer

http://stackoverflow.com/q/25739728
score: 3
downvote count: 0
tagged with: taglib
tagged with: java
tagged with: jboss
type: Question
has answer: http://stackoverflow.com/a/27285172
has title: Can tld files be accessed from WEB-INF\lib\{*.jar}\META-INF\resources\WEB-INF directory?
has comment: http://stackoverflow.com/comment/43024167
tagged with: servlet-3.0
upvote count: 3
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I have a jsp file which include a tag like: &lt;%@ taglib prefix="abc" uri="/WEB-INF/tlds/xyz.tld" %&gt; and in my app, the deploy structure is: WEB-INF |-lib |-some.jar |-META-INF |-resources |-WEB-INF |-tlds |-xyz.tld this works fine in Tomcat 7, but when I deploy my app to JBoss as 7, it can not find the tld file. so, is it an issue of JBoss(not support Servlet3.0?) or the tld files just can not accessed from META-INF\resources\WEB-INF directory in a jar?

http://stackoverflow.com/q/25716990
has title: Intellij IDEA go to previous method shortcut
has answer: http://stackoverflow.com/a/76603513
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has body: Do you know if IDEA has a shortcut which will bring me to the last method I was looking into, not necessary changing it, just looking into. I know that there is Ctrl+Alt+Left/Right but it is slightly different.
answer count: 2
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/25717049
tagged with: keyboard-shortcuts
has comment: http://stackoverflow.com/comment/40209830
favorite count: 0
type: UnansweredQuestion
score: 2

http://stackoverflow.com/comment/40349873
type: Comment
has text: Thanks for the help :D I see how the change is needed now
type: AnswerComment
comment on: http://stackoverflow.com/a/25796220
score: 0

http://stackoverflow.com/comment/40396407
has text: @Pat Are you sure it's not a classpath issue?
score: 0
comment on: http://stackoverflow.com/q/25822359
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40319616
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25780251
has text: @icza i dont think it has a parent since it is created by `new IDialog(null, "title", true);`

dayofweek
type: Tag
tags question: http://stackoverflow.com/q/25764100
tag name: dayofweek

http://stackoverflow.com/comment/40309677
comment on: http://stackoverflow.com/q/25774846
has text: Repeat after me: "I shall strive to use braces for every flow-control statement [until such a time as I am a Java Expert]."
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/comment/40320569
comment on: http://stackoverflow.com/a/25780963
has text: A reciever is an other jsp page. I read some articles about it and I think I should use liferay-ui:include, but at this time it does not display anything.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25817713
type: Question
has answer: http://stackoverflow.com/a/25817747
has answer: http://stackoverflow.com/a/25820515
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40393615
has answer: http://stackoverflow.com/a/25820651
linked to: http://stackoverflow.com/q/4665089
type: UnansweredQuestion
has body: ` class under { static int[] locations ={2,3,4};//arrays declared with values in class under } class understand { String c; public static void main(String[] args) { under d=new under(); System.out.println(under.locations[0]); understand[] u;//next array created created in the main class using //reference// u = new understand[2]; u[0]=new understand(); u[0].c="ab"; System.out.println(u[0].c); } }` I have the following questions in this code they are: 1.)The first array that I create is of integer type named locations with values inside it.Why do I have make it static in order access it in the main class? 2.)The second concern is the array created in the main class using reference will not be created if i don't name it same as a class. Every time I create using array with reference ,I have to have the same class of it. Why do I need to have a class of the same as the array ? What is the default type of the array created in the main? . The array with reference for example: understand[] array in the main ,if created out the main with references will not be accepted. Can I create a referenced array with out a class of it? 3.)Rather than creating the array using references ,I can directly give values to it then use it accordingly.Why do I need a reference to an array? Thanks a lot for having attention. Your opinion on this is very valuable to me.It means a lot when my doubts get cleared by the erudite members of Stack overflow. enter code here
has title: Why array created with values have to static to access it in the main? and what are the advantages of referenced array?
tagged with: java

http://stackoverflow.com/comment/97033870
comment on: http://stackoverflow.com/a/44142896
type: AnswerComment
score: 6
type: Comment
has text: It's actually possible to do it like this: `String.format("%02d:%02d:%02d",dur.toHoursPart(), dur.toMinutesPart(), dur.toSecondsPart());`. The part methods give you the right numbers to build a string. I think it' more readable.

http://stackoverflow.com/comment/40399232
type: QuestionComment
has text: "anonymous class are sublclass of any class" - can *any* class subclass every class ? No. "or it implement interface and instance of a class at the same time." - this part of the sentence doesn't make any sense to me. Your question is not clear!
comment on: http://stackoverflow.com/q/25823960
score: 0
type: Comment

http://stackoverflow.com/q/25865119
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40474691
answer count: 1
has answer: http://stackoverflow.com/a/25865330
favorite count: 0
type: UnansweredQuestion
has title: How do I pull value from method designated with "this."
has body: I have information like this: xxx 0 1 2 ... Name Fred0 Fred1 Fred2 Stamina 2 6 7 Intel 5 4 1 Heart 4 8 2 Speed 5 3 6 So, I was informed previously that creating a 2D ArrayList to store something like this is "archaic" and was provided with a different way to set my code up. The reason I was using ArrayList&lt;&gt; is because I want to be able to generate new racers as needed, rather than designating an array to a size. If I could just use a simple array this would have been done a week ago. Now I've been screwing with it for a week and I still don't get how it works. public class test { public String name; private int stamina; private int heart; private int intel; private int speed; public ArrayList&lt;String&gt; racers = new ArrayList&lt;String&gt;(); private void racerInfo(String name) { this.name = name; this.stamina = (int) Math.floor(Math.random()*10); this.heart = (int) Math.floor(Math.random()*10); this.intel = (int) Math.floor(Math.random()*10); this.speed = (int) Math.floor(Math.random()*10); } public void generate() { for ( int i=0; i&lt;=10; i++) { String name = "Fred" + i; System.out.println(name); racerInfo(name); racers.add(name); } } public int getStamina() { return this.stamina; } public int getHeart() { return this.heart; } public int getIntel() { return this.intel; } public int getSpeed() { return this.speed; } } public class main { public static test test = new test(); public static void main(String[] args) { test.generate(); //Put stuff here to pull stamina of Fred2 for example. } } Now, in the main class. How would I do something that should be relatively simple like pulling the Stamina value for Fred2. I've been following the exact directions I've been given by others here to write most of this code. But at this time, I'm getting to the point of just re-writing it all so that each stat (name, stamina, intel, speed, etc.) is just logged as a separate ArrayList&lt;&gt;. But I can't figure out how to make a 2D ArrayList containing the original Arr…
has comment: http://stackoverflow.com/comment/40474967
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40474406
tagged with: arrays
downvote count: 0

http://stackoverflow.com/a/25798794
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25798776
answers question: http://stackoverflow.com/q/25798776
type: Answer
upvote count: 2
downvote count: 1
has body: al.add(1, "A2"); added A2 in index 1. Remember ArrayList starts with index 0 so the output is just right. Same thing with the al.remove(2);. It removes the 3rd item which is E. Click the following links to read more about the add method and remove method.
score: 1

http://stackoverflow.com/comment/91872386
has text: Agreed, this is required if using @Modifing queries.
score: 4
type: AnswerComment
comment on: http://stackoverflow.com/a/42569935
type: Comment

executorservice
type: Tag
tags question: http://stackoverflow.com/q/25729435
tag name: executorservice
tags question: http://stackoverflow.com/q/25729764
tags question: http://stackoverflow.com/q/25863268

http://stackoverflow.com/comment/40448583
type: QuestionComment
comment on: http://stackoverflow.com/q/25842447
has text: There is no another solution?
score: 0
type: Comment

http://stackoverflow.com/a/25848624
has body: If it is not published to the usual online maven repositories, you will need to install it on your local machine first. So download the sources, go to the top level and do the usual mvn install Once you installed jahmm locally, your project can resolve it from your maven cache.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25848144
type: Answer

http://stackoverflow.com/q/25716440
tagged with: console
has answer: http://stackoverflow.com/a/25716484
accepted answer: http://stackoverflow.com/a/25716484
has answer: http://stackoverflow.com/a/25716448
has answer: http://stackoverflow.com/a/25716498
has comment: http://stackoverflow.com/comment/40201445
has body: In my console application, I give the user the option to type "exit" at any point to return to the main menu. As the user enters data, i prompt him/her through the console for various things, and collect the data using scanner. My question is how can I check to see if the user entered "exit" after each prompt (as opposed to the requested information) without having to use the same if statement after each step? As I see it, any kind of while or for loops are insufficient because they only check the condition at the beginning, when I need to check the condition between inputs, and I need each input/prompt to execute only once per iteration. The key here is that each prompt/code executed between the checks is DIFFERENT, so loops won't work. Here is some example code: String first; String second; Scanner input = new Scanner(System.in); //prompt user for input first = input.nextline(); if(first.equals("exit")){ //return to start menu input.close(); return; } //prompt user for DIFFERENT input second = input.nextline() if(second.equals("exit")){ //return to start menu input.close(); return; }
has title: How to check the same condition after each step without repeating the same code over and over in Java?
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25716448
type: Question
score: 0
answer count: 3

http://stackoverflow.com/comment/40655924
type: QuestionComment
comment on: http://stackoverflow.com/q/25860198
score: 0
has text: (continuing) I have been looking at this code. https://github.com/spring-projects/spring-security-oauth/blob/master/tests/xml/vanilla/src/main/java/demo/Application.java which still uses partial xml.
type: Comment

http://stackoverflow.com/comment/40264725
type: Comment
type: QuestionComment
has text: show the controller method signature (the one that you expect to result in a call to the DateTimeConverter).
comment on: http://stackoverflow.com/q/25747572
score: 0

http://stackoverflow.com/comment/40599362
has text: Thanks @BillFrost +1 for you :)
comment on: http://stackoverflow.com/a/25822238
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40686486
score: 0
type: AnswerComment
type: Comment
has text: Guy above me just beat me to it!
comment on: http://stackoverflow.com/a/25796227

http://stackoverflow.com/q/25758283
tagged with: sql
has title: Android Application - Connecting to Google Cloud SQL
answer count: 1
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: android
has answer: http://stackoverflow.com/a/27532329
has comment: http://stackoverflow.com/comment/40365655
tagged with: java
has body: I've spent 2 days (about 30 hours to find this answer, read all related posts on here and tried everything). I can't find any SPECIFIC answers relating to android apps and this problem. I have made an Instance of my Google Cloud SQL, connected to it using MySQL, created my database tables and updated the Cloud SQL. Built a basic app to test connectivity and insert data into one of the tables. Problem I am having is: Generating Cloud SQL specific Endpoints. I generated backend Endpoints using Eclipse. I right clicked on my AppEngine Settings: My Application ID is in there (set all permissions and enabled Google Cloud SQL) Clicked on Enable Google Cloud SQL --> Use Google Cloud SQL Instance Here is where I think the problem is: It always fails. Put my Instance Name: Soemthing:Something Put my Data BaseName: playerNames Put my Database Username as root Put my Database Password to blank Get this error: Creating SQL Model Connection to Profile (MyTestApp-AppEngine.GoogleCloudSQL.DevInstance). Details: Error creating SQL Modem Connection connection to Profile (MyTestApp-AppEngine.GoogleCloudSQL.DevInstance). (Error:null) java.lang.NullPointerException Could Not connect to Profile (MyTestApp-AppEngine.GoogleCloudSQL.DevInstance). Error creating SQL Model Connection connection to Profile (MyTestApp-AppEngine.GoogleCloudSQL.DevInstance). (Error: null) java.lang.NullPointerException OK Repeated same process but with a password I set for root: Could not connect to Profile (MyTestApp-AppEngine.GoogleCloudSQL.DevInstance). Error creating SQL Model Connection connection to Profile (MyTestApp-AppEngine.GoogleCloudSQL.DevInstance). (Error: Access denied for user 'root'@'localhost' (using password: YES)) Access denied for user 'root'@'localhost' (using password: YES) Error creating Google Cloud SQL Connection factory connection to Profile (MyTestApp-AppEngine.GoogleCloudSQL.DevInstance). (Error: Access denied for user 'root'@'localhost' (using password: YES)) Access denied for user …
type: Question
score: 0

http://stackoverflow.com/a/25792453
has body: I think your error is more related to the fact that you are using an XML namespace without declaring it. As explainted in this answer. Try to add http://www.springframework.org/schema/context/spring-context.xsd to the schemaLocation: &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.xsd"&gt;
score: 2
has comment: http://stackoverflow.com/comment/40341078
downvote count: 0
answers question: http://stackoverflow.com/q/25792321
type: Answer
has comment: http://stackoverflow.com/comment/40341167
upvote count: 2

http://stackoverflow.com/q/25867488
has comment: http://stackoverflow.com/comment/40510414
tagged with: encoding
tagged with: executable-jar
score: 0
has comment: http://stackoverflow.com/comment/40478686
answer count: 1
has body: I created a java app that send email in Hebrew. When I run it via Eclipse, everything is fine, BUT, When I run it via The exported Runnable JAR file everything is not fine anymore! When I receive the message on outlook its perfect: מק"ט: 19 התקבל ב: 2014-09-16 בשעה: 13:00:24 שם הפרוייקט: שם מזמין העבודה: BUT, When I receive the massage on Gmail, it’s all scrambled: ×ž×§"×˜: 19 ×”×ª×§×‘×œ ×‘: 2014-09-16 ×‘×©×¢×”: 13:00:24 ×©× ×”×¤×¨×•×™×™×§×˜: ×©× ×ž×–×ž×™×Ÿ ×”×¢×‘×•×“×”: I tried to play with the browsers encoding settings, but no such luck, It’s now set to Unicode-UTF 8. My project in eclipse is set to UTF-8.
has comment: http://stackoverflow.com/comment/40480624
has answer: http://stackoverflow.com/a/25888991
tagged with: right-to-left
has comment: http://stackoverflow.com/comment/40482581
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25888991
tagged with: java
has title: Runnable JAR bad Encoding in hebrew
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/40429551
score: 0
comment on: http://stackoverflow.com/q/25821886
type: Comment
type: QuestionComment
has text: garbage collector does not take literals.but take objects.

http://stackoverflow.com/q/25833088
has comment: http://stackoverflow.com/comment/40415423
score: -1
has comment: http://stackoverflow.com/comment/40415426
has answer: http://stackoverflow.com/a/25833137
upvote count: 0
has comment: http://stackoverflow.com/comment/40415498
has comment: http://stackoverflow.com/comment/40415487
has comment: http://stackoverflow.com/comment/40415683
answer count: 1
tagged with: url
favorite count: 0
has body: I am looking for html references in a HTML page I am retrieving from the server. The problem is for all the hyperlinks I am retrieving, the text that I am getting is URL encoded. Lets say, the URL is "http://abc.def.com/gh?ij=x&amp;kl=y&amp;mn=z", my program parses it as "http://abc.def.com/gh?ij=3Dx&amp;amp;kl=3Dy&amp;amp;mn=3Dz" . (look at the difference around "=" and "&amp;" in the two URL's) . Some searching on the Web tells me that the second URL is a URL encoded form of the first URL. What should I do to retrieve the actual URL as it is, and not its URL encoded version? Right now, I am replacing =3D with 3D and &amp;amp; with &amp;, but that is a very bad hack.
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25833137
tagged with: java
has comment: http://stackoverflow.com/comment/40415451
downvote count: 1
type: Question
has title: How to convert url encoded string to plain text in JAVA
has comment: http://stackoverflow.com/comment/40415554
has comment: http://stackoverflow.com/comment/40416130

http://stackoverflow.com/comment/40451900
has text: You have to define a `Main-Class:` in your MANIFEST.MF file.
comment on: http://stackoverflow.com/q/25853018
score: 1
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40441242
comment on: http://stackoverflow.com/a/25847098
type: AnswerComment
score: 0
type: Comment
has text: the data is never to be changed, so you can seperate different types of data - maybe a file for all int-values and another file for floats... but still: i think you should reduce the model, make a async task and load the data within an intro screen - another optimization would be to load only data required, so maybe just load the first model and in background loading the others...)

http://stackoverflow.com/q/25716056
answer count: 1
has body: I am attempting to maintain separate files for different types of "messages" (user messages, field labels/buttons, data values). In this attempt I am trying to get the description of different data values. For example, a UserStatus "A" might be displayed as Active or Activo. WEB-INF/locale/messages/messages WEB-INF/locale/fields/fields WEB-INF/locale/values/values ![Location of values files.][1] Here are the relevant entries in the values_en_us.properties file: user.status.A = Active user.status.I = Inactive user.status.P = Pending I would like to build an Enum for each type of value that I can get the localized value from. In the code below, I have hardcoded the values being passed to the get message to reduce the number of variables when trying to debug this. import java.util.EnumMap; import java.util.HashMap; import java.util.Locale; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public enum UserStatusEnum { A,I,P; private static HashMap<LocaleEnum, EnumMap<UserStatusEnum, String>> userStatuses = new HashMap<LocaleEnum, EnumMap<UserStatusEnum, String>>(); public static EnumMap<UserStatusEnum, String> getUserStatuses(LocaleEnum locale) { return userStatuses.get(locale); } // Pre-load the descriptive values. static { String description = null; ApplicationContext appCtx = new ClassPathXmlApplicationContext("spring-config.xml"); for (LocaleEnum locale : LocaleEnum.values()) { EnumMap<UserStatusEnum, String> localeSpecificUserStatuses = new EnumMap<UserStatusEnum, String>(UserStatusEnum.class); for (UserStatusEnum status : UserStatusEnum.values()) { //description = appCtx.getMessage("user.status."+status, null, new Locale(locale.toString())); description = appCtx.getMessage("user.status.A", null, new Locale("en_us")); if (description != null) { localeSpecificUserStatuses.put(status, description); } description=null; } userStatuses.put(locale, localeSpecificUserStatuses); } } } When this…
has answer: http://stackoverflow.com/a/25716115
tagged with: applicationcontext
has title: No message found under code 'user.status.A' for locale 'en_us'
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 0
tagged with: java
type: Question
tagged with: message

http://stackoverflow.com/q/25800720
has title: Test whether a -XX option is supported by Java
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25800863
downvote count: 0
has answer: http://stackoverflow.com/a/25800863
linked to: http://stackoverflow.com/q/7334754
has body: We're using various older versions of Java 1.6 at work which can't be updated for assorted reasons outside my control. Some support -XX:ReduceInitialCardMarks, some do not, and exit if you try to use an unsupported option. I'd like a shell script which calls java with the -XX:ReduceInitialCardMarks option if it is available, but otherwise without. Things I've tried/considering -X, this only prints out -X arguments not -XX Testing the version? How? Would need upfront knowledge of which versions support what Calling with a dummy application and testing return value, e.g. java -XX:ReduceInitialCardMarks -jar dummy.jar. No suitable classes in rt.jar with static void main() to use, so have to make my own. Best approach so far, grepping the output for Unrecognized VM option when calling with -version, note -version has to be after the argument as otherwise it doesn't test it. if java -XX:-ReduceInitialCardMarks -version 2&gt;&amp;1 | grep -q 'Unrecognized VM option'; then echo "Not supported"; else echo "Supported"; fi Is there any clean way of doing this?
favorite count: 0
has answer: http://stackoverflow.com/a/25800974
tagged with: shell
accepted answer: http://stackoverflow.com/a/25800974
upvote count: 3
type: AnsweredQuestion
score: 3
tagged with: java

http://stackoverflow.com/comment/40315666
has text: No, don't spoon feed homework questions please! Give the concepts (which I've already done) but not the direct code.
type: AnswerComment
comment on: http://stackoverflow.com/a/25778153
score: 0
type: Comment

http://stackoverflow.com/a/25860814
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25860747
answers question: http://stackoverflow.com/q/25860747
type: AcceptedAnswer
upvote count: 1
has body: If I remember right, Graphics2D#rotate(double) rotates around the top/left corner of the Graphics context (based on it's current transformation), where as Graphics2D#rotate(double, double, double) allows you to define the anchor point around which the Graphics context will be rotated. Sometimes, you just have to give it a try
type: Answer

http://stackoverflow.com/comment/40200741
score: 0
has text: Ok, and your question is...?
comment on: http://stackoverflow.com/q/25716097
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40382350
has text: I don't think Java's the right language for that. You're trying to change file names on the fly, which Java uses for a specific purpose.
comment on: http://stackoverflow.com/q/25814671
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25847917
downvote count: 0
tagged with: jsp
favorite count: 0
has title: MVCPortlet: use doView method from an other method
has comment: http://stackoverflow.com/comment/40442860
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/25850476
accepted answer: http://stackoverflow.com/a/25850476
upvote count: 1
has comment: http://stackoverflow.com/comment/40443341
type: Question
tagged with: java
tagged with: jboss
has body: I want to render the JSP after the the processAction() method has been called out of an other method. I am using Liferay 6.2 and JBoss 7.1.1. That's the method that have to call the processAction() and the doView() method: @Override public void update(Observable arg0, Object arg1) { if(actualSite.equals("/views/measurement.jsp")) { this.x = (String) arg1; try { this.processAction(aRequest, aResponse); //works this.doView(rRequest, rResponse); //doesn't work } catch (IOException e) { e.printStackTrace(); } catch (PortletException e) { e.printStackTrace(); } } } It works fine for processAction(), but for doView() I get this error: [org.apache.jasper.runtime.JspFactoryImpl] (Thread-108) Exception initializing page context: java.lang.IllegalStateException: Page needs a session and none is available at org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:148) [jbossweb-7.0.13.Final.jar:] at org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:124) [jbossweb-7.0.13.Final.jar:] at org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryImpl.java:106) [jbossweb-7.0.13.Final.jar:] at org.apache.jasper.runtime.JspFactoryImpl.getPageContext(JspFactoryImpl.java:62) [jbossweb-7.0.13.Final.jar:] at org.apache.jsp.views.measurement_jsp._jspService(measurement_jsp.java:52) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) [jbossweb-7.0.13.Final.jar:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) [jbossweb-7.0.13.Final.jar:] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jbossweb-7.0.13.Final.jar:] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [jbossweb-7.0.13.Final.jar:] at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final] at or…
tagged with: liferay
answer count: 1

http://stackoverflow.com/q/25852640
score: 0
answer count: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have to retrieve json object from json file from this url. My code is throwing java.lang.RuntimeException in doInBackground() and string to jsonObject conversion exception. Can anyone help me at this? I am new to Android programming. package course.examples.networkingearthquake; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.os.AsyncTask; import android.widget.Button; import android.view.View; import android.widget.TextView; import android.widget.EditText; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.ResponseHandler; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicResponseHandler; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import android.net.http.AndroidHttpClient; public class HttpActivity extends ActionBarActivity { TextView mTextView; EditText etInput; TextView input; String number;//edited int num;//edited @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_socket); mTextView = (TextView)findViewById(R.id.text1); input = (TextView)findViewById(R.id.input); etInput = (EditText)findViewById(R.id.etInput); input.setText("Input"); //number = etInput.getText().toS(); final Button btDisplay = (Button)findViewById(R.id.btDisplay); btDisplay.setText("DISPLAY"); btDisplay.setOnClickListener(new View.OnClickListener(){ public void onClick(View v) { new HttpGetTask().execute(); } }); } private class HttpGetTask extends AsyncTask&lt;Void, Void, String&gt;{ private static final String TAG = "HttpGetTask"; private static final String URL = "http://earthquake.usgs.gov/earthquakes/feed/geojsonp/2.5/week"; AndroidHttpClient mClient = AndroidHttpClient.newInstance(""); @Override protected String…
has comment: http://stackoverflow.com/comment/40451605
has answer: http://stackoverflow.com/a/25852836
type: AnsweredQuestion
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/25852836
has title: errors in extracting json object

http://stackoverflow.com/q/25759710
downvote count: 0
type: Question
has title: Java generics query (Upper Bounded Wildcards)
tagged with: java
has body: Consider below scenario, Class FastCar extends from Car Class: public class FastCar extends Car {} Code snippet in main method: Set&lt;? extends Car&gt; mySet6 = null; mySet6.add(new FastCar()); //&lt;-----compile error Compile Error Details: (The method add(capture#4-of ? extends Car) in the type Set&lt;capture#4-of ? extends Car&gt; is not applicable for ) I'm confused why FastCar object can't put into the "set of object extends Car", anyone can help to clarify? Thanks.
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/25759869
accepted answer: http://stackoverflow.com/a/25759869
tagged with: generics
favorite count: 0
has comment: http://stackoverflow.com/comment/40281677
possible better answer: http://stackoverflow.com/a/25759832
has answer: http://stackoverflow.com/a/25759832
score: 2
type: AnsweredQuestion

http://stackoverflow.com/q/25774785
has comment: http://stackoverflow.com/comment/40309432
has answer: http://stackoverflow.com/a/25774883
type: AnsweredQuestion
score: 2
tagged with: performance
has body: I was just wondering which of these is faster to check the int values and set the boolean to the right value? switch (type) { case INCREASING: if (currentVal &gt;= duration) { done = true; } break; case DECREASING: if (currentVal &lt;= 0) { done = true; } break; default: done = false; break; } or done = (type == INCREASING ? currentVal &gt;= duration ? true : false : false) || (type == DECREASING ? currentVal &lt;= 0 ? true : false : false); with public static final int INCREASING = 1; public static final int DECREASING = -1; private float currentVal; private float duration; //is set in the constructur private boolean done = false; They both do the same in terms of what i want to achieve with it. I just thought the switch statement might be a little faster because it doesn't check everything? I like the advantage of having it in one line though so is the difference actually worth considering?
tagged with: java
has comment: http://stackoverflow.com/comment/40309690
possible better answer: http://stackoverflow.com/a/25774820
type: Question
has answer: http://stackoverflow.com/a/25774880
has answer: http://stackoverflow.com/a/25774820
has comment: http://stackoverflow.com/comment/40310910
has comment: http://stackoverflow.com/comment/40309403
downvote count: 0
has answer: http://stackoverflow.com/a/25774894
has comment: http://stackoverflow.com/comment/40309808
linked to: http://stackoverflow.com/q/9745389
has title: Is it faster to use a switch/if or nested ternary operators?
has comment: http://stackoverflow.com/comment/40309458
has comment: http://stackoverflow.com/comment/40309775
answer count: 4
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40310023
accepted answer: http://stackoverflow.com/a/25774894

http://stackoverflow.com/a/25830589
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25829292
upvote count: 5
answers question: http://stackoverflow.com/q/25829292
type: Answer
has body: Use a java.util.concurrent.CompletableFuture (new in Java 8) to transmit a value between threads or tasks when you're not sure which one will arrive first. Here's how: CompletableFuture&lt;UUID&gt; id = new CompletableFuture&lt;&gt;(); id.complete(TaskManager.newRepeatingTask(() -&gt; { for (int i = 0; i &lt; profileButtons.length; i++) { GuiButton button = profileButtons[i]; button.move(-1, 0); } toMove--; if (toMove == 0) { TaskManager.cancelTask(id.join()); } }, 30L, 0L)); The join() method will collect and return the value supplied by the complete() method. If complete() hasn't been called yet, join() will block until it is. CompletableFuture handles all synchronization and memory visibility issues internally. As others have noted, this is a bit contrived. A more conventional approach for a repeating task to cancel itself is to have it return a boolean indicating whether it should be rescheduled or canceled. To do this, change TaskManager.newRepeatingTask() to take a Supplier&lt;Boolean&gt; instead of a Runnable.
score: 5
type: AcceptedAnswer

http://stackoverflow.com/comment/40396271
has text: Try some of these answers: http://stackoverflow.com/questions/9341644/the-project-was-not-built-since-its-build-path-is-incomplete
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25822008
type: QuestionComment

http://stackoverflow.com/comment/40423397
has text: I don't think quadratic is the best you can do.
type: AnswerComment
comment on: http://stackoverflow.com/a/25837254
score: 0
type: Comment

http://stackoverflow.com/q/25858163
favorite count: 0
has comment: http://stackoverflow.com/comment/40461607
has answer: http://stackoverflow.com/a/25858228
has comment: http://stackoverflow.com/comment/40461658
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40461639
has comment: http://stackoverflow.com/comment/40461591
score: 1
upvote count: 3
tagged with: java
downvote count: 2
has title: How to convert a do while loop to a while loop
tagged with: loops
has answer: http://stackoverflow.com/a/25858225
type: Question
tagged with: do-while
answer count: 2
has comment: http://stackoverflow.com/comment/40461614
has comment: http://stackoverflow.com/comment/40461579
tagged with: while-loop
has body: How do I convert my do-while loop to a while loop? int numAttempts = 0; do { System.out.println("Do you want to convert to Peso or Yen?"); pesoOrYen = readKeyboard.nextLine(); if(pesoOrYen.equalsIgnoreCase("Peso")||pesoOrYen.equalsIgnoreCase("Yen")) { notPesoOrYen = false; } else if (numAttempts &lt; 2) { System.out.println("Sorry, but '"+pesoOrYen+"' is not a valid currency type. Try again:"); notPesoOrYen = true; } numAttempts++; } while(notPesoOrYen==true &amp;&amp; numAttempts &lt; 3); I tried to do while(notPesoOrYen==true &amp;&amp; numAttempts &lt; 3) then the statement but it did not work. MY FULL CODE package currencyconverter; import java.util.Scanner; import java.text.NumberFormat; public class CurrencyConverter { public static void main(String[] args) { Scanner readKeyboard = new Scanner(System.in); double doubleUsersCaptial; boolean notPesoOrYen=true; String pesoOrYen; double usersConvertedCapital; boolean userInputToRunProgramAgain=true; final double US_DOLLAR_TO_PESO = 13.14; final double US_DOLLAR_TO_YEN = 106.02; do { System.out.println ("How much money in US dollars do you have?"); String usersCaptial = readKeyboard.nextLine(); doubleUsersCaptial = Double.parseDouble(usersCaptial); int numAttempts = 0; do { System.out.println ("Do you want to convert to Peso or Yen?"); pesoOrYen = readKeyboard.nextLine(); if(pesoOrYen.equalsIgnoreCase("Peso")||pesoOrYen.equalsIgnoreCase("Yen")) { notPesoOrYen = false; } else if (numAttempts &lt; 2) { System.out.println("Sorry, but '"+pesoOrYen+"' is not a valid currency type. Try again:"); notPesoOrYen = true; } numAttempts++; }while(notPesoOrYen==true &amp;&amp; numAttempts &lt; 3); if(numAttempts==3) { System.out.println("Sorry, but '"+pesoOrYen+"' is not a valid currency type."); System.out.println("You entered the wrong currency type too many times\nGood Bye"); System.exit(0); } if (pesoOrYen.equalsIgnoreCase("Peso")) { usersConvertedCapital = doubleUsersCaptial*US_DOLLAR_TO_PESO; } else { usersConvertedCapital…
has comment: http://stackoverflow.com/comment/40461653

http://stackoverflow.com/q/25747409
has body: I'm having a problem with String comparison, while some words return the correct result others simply don't.. for (int s = 0; s &lt; subjects.getLength(); s++) { Element subject = (Element) subjects.item(s); String sub = subject .getElementsByTagName("name").item(0) .getTextContent(); Log.d("Subject", getSubject() + "!A"); Log.d("Subject", sub + "!B"); Log.d("Subject", "equalsIC: " + String.valueOf(getSubject().equalsIgnoreCase(sub))); Log.d("Subject", "Contains: " + String.valueOf(getSubject().contains(sub))); Log.d("Subject", "Equals: " + String.valueOf(getSubject().equals(sub))); Log.d("Subject", "ContentEqu: " + String.valueOf(getSubject().contentEquals(sub))); Log.d("Subject", "Length A: " + String.valueOf(getSubject().length()) + "; Length B: " + String.valueOf(sub.length())); if (getSubject().equalsIgnoreCase(subject .getElementsByTagName("name").item(0) .getTextContent())) { Log.d("Subject", getSubject() + "Success !C"); The getSubject method is returning a String. While this works perfect for "BK G3": D/Subject﹕ BK G3!A D/Subject﹕ BK G3!B D/Subject﹕ equalsIC: true D/Subject﹕ Contains: true D/Subject﹕ Equals: true D/Subject﹕ ContentEqu: true D/Subject﹕ Length A: 5; Length B: 5 D/Subject﹕ BK G3Success !C It simply fails with "D G4": D/Subject﹕ D G4!A D/Subject﹕ D G4!B D/Subject﹕ equalsIC: false D/Subject﹕ Contains: false D/Subject﹕ Equals: false D/Subject﹕ ContentEqu: false D/Subject﹕ Length A: 5; Length B: 5 I tried it with sub.trim(), but nothing changed.. Thanks in advance. Edit Debugging gives me the following information: sub = (java.lang.String@83000929)"D G4" value = {char[5]@830092913560} hashCode = 0 offset = 0 count = 5 ((Activity_Add)this).subject = java.lang.String@830088265176)"D G4" value = {char[59]@830080636976} hashCode = 0 offset = 6 count = 5
type: AnsweredQuestion
tagged with: java
has title: String comparison not working correctly
has comment: http://stackoverflow.com/comment/40262802
has comment: http://stackoverflow.com/comment/40262526
type: Question
has answer: http://stackoverflow.com/a/25748517
tagged with: comparison
score: 0
has comment: http://stackoverflow.com/comment/40259826
answer count: 1
tagged with: string
tagged with: equals
has comment: http://stackoverflow.com/comment/40260270
accepted answer: http://stackoverflow.com/a/25748517

http://stackoverflow.com/comment/40217080
type: QuestionComment
type: Comment
has text: You're not doing yourself any favours trying to return the result as Object[][]. Why not List<Car> or Car[]?
score: 0
comment on: http://stackoverflow.com/q/25724765

http://stackoverflow.com/q/25857562
has answer: http://stackoverflow.com/a/25857593
tagged with: actionlistener
accepted answer: http://stackoverflow.com/a/25857589
downvote count: 0
has body: Actionlistener code Player p = new Player(); /** ** Other code here **/ private static JLabel Status; final JTextField username = new JTextField(6); loginButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { data = username.getText(); if(p.Login(data)){ Status.setText(data+" is correct"); } else { Status.setText(data+" is wrong"); } } }); Player class code public boolean login(String username){ if(username == "adam"){ return true; } else { return false; } } I am always getting that username is wrong no matter what input there is, what should I do? what am I doing wrong?
linked to: http://stackoverflow.com/q/513832
type: AnsweredQuestion
score: 1
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
type: Question
answer count: 2
upvote count: 1
tagged with: swing
has title: Using actionlistener to call a function from another class
has answer: http://stackoverflow.com/a/25857589
tagged with: oop
tagged with: java
possible better answer: http://stackoverflow.com/a/25857593

http://stackoverflow.com/a/25805398
answers question: http://stackoverflow.com/q/25805113
has body: Your configuration holds good and your observation too. It is never disabled. Some how the tabs also doesn't show up the modified files(By default). The behavior of this is sometimes misleading but to show up the modification in the file, Settings --&gt; Editor --&gt; Editor Tabs --&gt; Mark Modified tabs with asterik If this feature is enabled, we will come to know that the file is changed.
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40476925
has comment: http://stackoverflow.com/comment/40478625
upvote count: 2

http://stackoverflow.com/comment/40247389
type: Comment
type: QuestionComment
has text: That image looks really tough. Are you sure that there is any framework that can handle that?
score: 1
comment on: http://stackoverflow.com/q/25741025

http://stackoverflow.com/a/75667390
answers question: http://stackoverflow.com/q/25821579
has body: The culprit in my configuration was a DataSourceTransactionManager, when I replaced it with a JpaTransactionManager everything started to work as expected. changed @Bean(name = "db1-tm") JpaTransactionManager db1TransactionManager( @Qualifier("db1EM") EntityManagerFactory datasource) { return new JpaTransactionManager(datasource); } instead of @Bean(name = "db1-tm") @Primary DataSourceTransactionManager db1TransactionManager( @Qualifier("db1") DataSource datasource) { DataSourceTransactionManager txm = new DataSourceTransactionManager(datasource); return txm; }
score: 0
type: Answer

http://stackoverflow.com/comment/40348773
type: Comment
type: QuestionComment
has text: They're mentioning it because you can have duplicate properties. That doesn't mean you can't access them, it means it's something you have to be aware of under some (relatively rare) circumstances.
comment on: http://stackoverflow.com/q/25792420
score: 1

http://stackoverflow.com/a/25715944
answers question: http://stackoverflow.com/q/25715899
score: 0
type: Answer
has body: put an if statement inside your while loop like this if(num &lt;= 0){ System.out.println("Enter a number greater than zero"); } else{ break; }

http://stackoverflow.com/comment/40448892
type: Comment
has text: I don't think you are understanding the question. When i call locations in data outside the try catch it only brings back 0, inside the try catch during the reading of the data.txt file it works
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25843366

http://stackoverflow.com/comment/40290299
score: 0
comment on: http://stackoverflow.com/q/25758814
has text: How are you running the topology? Can you share the command which you use to start the topology?
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25760493
tagged with: cookies
score: 1
tagged with: java
has title: Why "client.getState().getCookies()" always return zero length array?
type: Question
has comment: http://stackoverflow.com/comment/40315006
tagged with: httpclient
has body: I use httpclient 3.0.1 to send a request to my php sever to get a cookie, and I get the Set-Cookie: ResponseCookie=bbb header string with postMethod.getResponseHeader("Set-Cookie") But the client.getState().getCookies() always return zero length array. I have not use any CookieSpec to match and filter the cookies. I will appreciate you if any help!
has comment: http://stackoverflow.com/comment/40314986
downvote count: 0
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: php
answer count: 0

http://stackoverflow.com/q/25736377
tagged with: methods
type: Question
accepted answer: http://stackoverflow.com/a/25736439
tagged with: variables
tagged with: class
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40239146
has body: I'm still quite the novice to Java, so please forgive the myriad of noob mistakes about to be laid before you. So I'll clarify. A variable is generated from within a method based on an array. public class Track { public final int[] classN = { 5, 1 }; public final int[] classD = { 10, 1 }; public final int[] classC = { 15, 2 }; public final int[] classB = { 20, 2 }; public final int[] classA = { 25, 3 }; public final int[] classS = { 30, 3 }; public final int[] classSS = { 50, 3 }; public final int[][] arTrackClass = { classN, classD, classC, classB, classA, classS, classSS }; public static final String[] arNameClass = { "N", "D", "C", "B", "A", "S", "SS" }; public int trackLength = 5; //I need to put it outside of the modifier to get anything else to access it. public void getRaceClass() { int tClass = (int) Math.floor(Math.random()*arTrackClass.length)); trackLength = arTrackClass[tClass][0]; //This is the important bit for elsewhere tMaxDiff = arTrackClass[tClass][1]; String nameClass = arNameClass[tClass]; System.out.println("The track will be a " + nameClass + " class race with " + trackLength + " lengths."); } } So this is what I am using to generate how long the track is. From 5 up to 50 lengths. This is no problem and works fine for me. The bit of issue comes when I try and call trackLength later to tell my for loop how many times to loop when it draws the graph. public class Graph { public drawGraph() { for ( int i=0; i&lt;=Track.trackLength; i++ ) { //Code } } } And then in my main class, no matter what I do, I cannot get trackLength in drawGraph() to equal the generated trackLength in getRaceClass(). public class Main { public static void main(String[] args) { Track track = new Track(); track.getRaceClass() Graph graphing = new Graph(); SwingUtilities.invokeLater(new Runnable() { public void run() { graphing.createAndShowGUI(); } }); } } If there needs to be any more info let me know and I'll provide as much as I can. I just really need to to call on the v…
has title: Java - How do I get a variable generated from within a method in one class to another class?
has comment: http://stackoverflow.com/comment/40239206
has comment: http://stackoverflow.com/comment/40239391
has answer: http://stackoverflow.com/a/25736439
has comment: http://stackoverflow.com/comment/40239194
has comment: http://stackoverflow.com/comment/40239292
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25773628
has answer: http://stackoverflow.com/a/25773710
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
has body: I was trying to create a program that had multiple characters with different attributes. I ran into an issue calling a method I (tried) to define in Class Character. public class CharacterAttributes { public static void main(String[] args) { Character John = new Character("John", 0); workout(5); } } class Character { private String name; private int Str; public Character(String n, int initialStr) { name = n; Str = initialStr; } public void workout(int byAmt) { Str = Str + byAmt; } } The compiler said the "workout()" method could not be resolved. Thanks! There's probably a lot of errors, honestly.
type: Question
has answer: http://stackoverflow.com/a/25773645
tagged with: java
answer count: 2
upvote count: 1
has title: Error : Cannot resolve method
accepted answer: http://stackoverflow.com/a/25773645
possible better answer: http://stackoverflow.com/a/25773710

http://stackoverflow.com/q/25765465
has title: ElasticSearch Full Text Search
upvote count: 2
type: AnsweredQuestion
score: 2
has body: I try to run full text search with regular expression on elastic search java api. My filter is like this: FilterBuilder qFilter= FilterBuilders.regexpFilter("_all", ". *"+text+". *"); But it matches with only one word not with a phrase. What I mean is, for example: if there is a string in the soruce like: "one two three four five.." and when my text string is like these: "two" , "our", "thr" ... then it works. But when my realTimeTextIn string is "two three" full text search doesn't work. I can't search one more than one words. What I'm missing here? The rest of the codes are something like this: FilterBuilder qFilter = FilterBuilders.regexpFilter("_all", ".*"+q+".*"); SearchResponse response = ClientProvider.instance().getClient().prepareSearch(index) .setTypes(type) .setSearchType(SearchType.DFS_QUERY_THEN_FETCH) .setPostFilter(qFilter) .setFrom(0).setSize(250).setExplain(true) .execute() .actionGet(); Thanks for helps.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40322002
possible better answer: http://stackoverflow.com/a/26186686
has answer: http://stackoverflow.com/a/26186686
downvote count: 0
tagged with: lucene
answer count: 3
has answer: http://stackoverflow.com/a/26278398
has answer: http://stackoverflow.com/a/57446565
tagged with: elasticsearch
tagged with: regex
favorite count: 0
accepted answer: http://stackoverflow.com/a/26278398

http://stackoverflow.com/comment/40343084
comment on: http://stackoverflow.com/a/25793191
has text: Thx for answer, one more question is there any elegant way to generate randow string using stream api ?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25844934
has body: Environment.getDataDirectory() does not point to the sdcard, however it points to somewhere in /data. You need to use Environment.getExternalStorageDirectory() instead, as it points to what the manufacturor has defined as the path for the external storage, i.e. sdcard.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25844589
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40266057
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25751073
has text: My IDE says that it is calling the `join(T...)` method, where the inferred type of `T` is `Serializable`. That is because there is no method for `join(double[], String)`. You could replace `" "` with `' '`, to use the `join(double[], char)` method.

http://stackoverflow.com/q/25864559
tagged with: java-8
type: Question
tagged with: java
score: 10
upvote count: 10
has body: I am new to java and lambda, I want to find the sum and average of values in a map of maps. My object is like Map&lt;String, Map&lt;String, Double&gt;&gt; browserData; Data is of the format &lt;Chrome, &lt;UK, 2.90&gt;&gt; &lt;Chrome, &lt;US, 5.20&gt;&gt; &lt;Chrome, &lt;EU, -0.25&gt;&gt; &lt;IE, &lt;UK, 0.1&gt;&gt; &lt;IE, &lt;US, -.20&gt;&gt; &lt;IE, &lt;EU, 0.00&gt;&gt; &lt;FF, &lt;UK, 0.90&gt;&gt; &lt;FF, &lt;US, 1.20&gt;&gt; &lt;FF, &lt;EU, 1.25&gt;&gt; The final result needs to be two maps, 1 for sum and another for average map1 = &lt;CountryName, SumValue&gt; map2 = &lt;CountryName, AverageValue&gt; So the result of the above example it would be map1 = &lt;UK, 3.9&gt; &lt;US, 6.2&gt; &lt;EU, 1&gt; map2 = &lt;UK, 1.3&gt; &lt;US, 2.07&gt; &lt;EU, 0.33&gt; How can I achieve this?
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/41084279
has answer: http://stackoverflow.com/a/25865146
tagged with: dictionary
tagged with: lambda
type: AnsweredQuestion
has title: Iterate though a Map of Maps with Lambda in Java 8?
accepted answer: http://stackoverflow.com/a/25865146

http://stackoverflow.com/q/25783416
tagged with: jboss
has body: I'm working on a simple Struts Hibernate integrated application and trying to run it on JBoss server. But when try to start the server I'm getting a error; Please check the error report, INFO [AbstractServer] Starting: JBossAS [6.0.0.Final "Neo"] INFO [ServerInfo] Java version: 1.6.0_38,Sun Microsystems Inc. INFO [ServerInfo] Java Runtime: Java(TM) SE Runtime Environment (build 1.6.0_38-b05) INFO [ServerInfo] Java VM: Java HotSpot(TM) Client VM 20.13-b02,Sun Microsystems Inc. INFO [ServerInfo] OS-System: Windows 7 6.1,x86 INFO [ServerInfo] VM arguments: -Dprogram.name=run.bat -Xms128m -Xmx512m - XX:MaxPermSize=256m -Dfile.encoding=Cp1252 INFO [JMXKernel] Legacy JMX core initialized INFO [AbstractServerConfig] JBoss Web Services - Stack CXF Server 3.4.1.GA INFO [JSFImplManagementDeployer] Initialized 3 JSF configurations: [Mojarra-1.2, MyFaces-2.0, Mojarra-2.0] ERROR [AbstractKernelController] Error installing to Instantiated: name=PostEjbJarMetadataDeployer state=Described: java.lang.NoSuchMethodError: javax.annotation.Resource.lookup()Ljava/lang/String; Please help. If any other codes required, please ask, I'll post. Thanks in advance. N.B: IDE: Eclipse Indigo Dynamic Web Module : 2.5 Java : 1.6 JBoss: 6.0 Edited: Ones after adding this -Djava.endorsed.dirs="path to my jboss6 home"/lib/endorsed to VM argument in the server configuration page, the error gone off. But still the server doesn't start up. Scheduler class: 'org.quartz.core.QuartzScheduler' - running locally. NOT STARTED. Currently in standby mode. Number of jobs executed: 0 Using thread pool 'org.quartz.simpl.SimpleThreadPool' - with 10 threads. Using job-store 'org.quartz.simpl.RAMJobStore' - which does not support persistence. and is not clustered. Any idea my friends? Please help.
tagged with: eclipse
answer count: 1
has answer: http://stackoverflow.com/a/25783761
has title: Error when starting JBoss Server
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/a/25741307
has body: Go back to the grammar and the regex will follow. list := part ( ',' part)* part := ipv4 | ipv6 | hostname Now translate that "ABNF-like" grammar to Java: private static String IPV4 = "…"; private static String IPV6 = "…"; private static String HOSTNAME = "…"; private static String PART = "(?:" + IPV4 + "|" + IPV6 + "|" + HOSTNAME + ")"; private static String LIST = "^" + PART + "(?:," + PART + ")*$"; Note: you should apply the same reasoning to your matching of IPv4, IPv6 and host names.
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25733600
has comment: http://stackoverflow.com/comment/40249834
upvote count: 2
type: Answer

http://stackoverflow.com/comment/40208839
has text: Describe the basic problem. Unmarshalling means that you want to get at the *data*; and looking at comments isn't somtehing that is done at that time. If, however, you want to transform an XML and do something with/to comment nodes (and, maybe, other nodes) an XML *transformation* (using XSLT) is definitely the better approach.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25717436

http://stackoverflow.com/q/25851296
tagged with: java
type: Question
has title: Java Interface in C++
downvote count: 0
has comment: http://stackoverflow.com/comment/40449169
has answer: http://stackoverflow.com/a/25851469
answer count: 3
has comment: http://stackoverflow.com/comment/40448629
has body: first posting so please be gentle! I have an interface that's like this public interface I_Hospital{ public void registerObserver(I_Person p); public void removeObserver(I_Person p); public void notifyObservers(); public void addWard(Ward ward); } Now, if I want to recreate this in C++, is it correct to do the following: IHospital.h Class IHospital{ public: virtual void registerObserver(IPerson p) = 0; etc... } Is this the correct implementation on an Interface in C++?? Thanks, Patrick
favorite count: 0
has answer: http://stackoverflow.com/a/25851449
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25851477
tagged with: c++
score: 2

http://stackoverflow.com/comment/40371599
has text: Regarding user2040251 comment it is not that he is admin. On Stack Overflow when user get sufficient reputation it gains some [privileges](http://stackoverflow.com/help/privileges) like [voting](http://stackoverflow.com/help/privileges/access-review-queues) if some flags (like "not an answer", or "low quality answer") are correct or not. This user voted (IMHO wrongly) that flag put on your post was correct and decided to leave one of standard (build-in in system) comments which you can see above.
comment on: http://stackoverflow.com/a/25796830
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/25741585
has body: I managed to get camel working with its CDI module, but I'm unable to register datasources in the registry. I basically have a sql route that looks like this: sql:SELECT * FROM INBOX_DFEP WHERE id &gt; :#lastID?dataSource=jdbc/DFEP my application server is glassfish 4, and I've registered a jdbc resource with that name, as I usually do with JPA. Anyway camel does not seems to be able to lookup that datasource for me. org.apache.camel.NoSuchBeanException: No bean could be found in the registry for: jdbc/DFEP of type: javax.sql.DataSource what am I doing wrong? how do I register a datasource in the camel registry using CDI?
tagged with: apache-camel
tagged with: glassfish
has comment: http://stackoverflow.com/comment/40304231
score: 0
accepted answer: http://stackoverflow.com/a/28701132
answer count: 1
tagged with: cdi
has title: camel cdi, lookup datasource provided by glassfish
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: jndi
has answer: http://stackoverflow.com/a/28701132

http://stackoverflow.com/comment/40287332
type: QuestionComment
comment on: http://stackoverflow.com/q/25762915
has text: `openFileOutput` will create file in internal storage. User can not see that storage until they have rooted phone. If you want to know location then read this http://stackoverflow.com/a/4926204/1282812
score: 0
type: Comment

http://stackoverflow.com/comment/40298429
comment on: http://stackoverflow.com/a/25761018
type: Comment
has text: You could start the compiler manually ... JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); compiler.run(null, null, null, sourceFile.getPath());
score: 1
type: AnswerComment

http://stackoverflow.com/q/25796572
has answer: http://stackoverflow.com/a/25796688
has body: I have many JLabel's and want smooth around corners on them. How can I make this? I already searched on SO but I didn't find any answer. Could someone help me with a simple and exact code for making round corners for JLabel's? Other questions are asking some extra details like border and others but I want just exact and simplest code for making round corners for JLabel's.
upvote count: 4
possible better answer: http://stackoverflow.com/a/25799019
answer count: 3
linked to: http://stackoverflow.com/q/15025092
has answer: http://stackoverflow.com/a/25799019
score: 1
tagged with: rounded-corners
duplicate of: http://stackoverflow.com/q/15025092
favorite count: 0
tagged with: jlabel
accepted answer: http://stackoverflow.com/a/25796688
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25797788
tagged with: java
downvote count: 3
tagged with: swing
type: Question
tagged with: graphics
has title: Simplest Code to round corners of JLabel in java

http://stackoverflow.com/comment/40284680
has text: Thanks everyone for your suggestions
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25742014

jetty-9
tag name: jetty-9
type: Tag
tags question: http://stackoverflow.com/q/25770789
tags question: http://stackoverflow.com/q/25797895
tags question: http://stackoverflow.com/q/25800533
tags question: http://stackoverflow.com/q/25783717

http://stackoverflow.com/q/25771332
type: Question
tagged with: vector
has title: OpenCV + Android + Vehicle number Plate Recognition
has answer: http://stackoverflow.com/a/25777627
has body: I'm developing a Android app to detect vehicle number plate. i did image processing up to findContours level of image. Now i need to convert following C++ code to Opencv Based Android java. This is original image This is after Otsu thresholding image This is my andoid+opencv code (working 100%) ImageView imgView = (ImageView) findViewById(R.id.imageView1); Bitmap bmp = BitmapFactory.decodeResource(getResources(),car); //First convert Bitmap to Mat Mat ImageMatin = new Mat ( bmp.getHeight(), bmp.getWidth(), CvType.CV_8U, new Scalar(4)); Mat ImageMatout = new Mat ( bmp.getHeight(), bmp.getWidth(), CvType.CV_8U, new Scalar(4)); Mat ImageMatBk = new Mat ( bmp.getHeight(), bmp.getWidth(), CvType.CV_8U, new Scalar(4)); Mat ImageMatTopHat = new Mat ( bmp.getHeight(), bmp.getWidth(), CvType.CV_8U, new Scalar(4)); Mat temp = new Mat ( bmp.getHeight(), bmp.getWidth(), CvType.CV_8U, new Scalar(4)); Bitmap myBitmap32 = bmp.copy(Bitmap.Config.ARGB_8888, true); Utils.bitmapToMat(myBitmap32, ImageMatin); //Converting RGB to Gray. Imgproc.cvtColor(ImageMatin, ImageMatBk, Imgproc.COLOR_RGB2GRAY,8); Imgproc.dilate(ImageMatBk, temp, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(9, 9))); Imgproc.erode(temp, ImageMatTopHat, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(9,9))); //Core.absdiff(current, previous, difference); Core.absdiff(ImageMatTopHat, ImageMatBk, ImageMatout); //Sobel operator in horizontal direction. Imgproc.Sobel(ImageMatout,ImageMatout,CvType.CV_8U,1,0,3,1,0.4,Imgproc.BORDER_DEFAULT); //Converting GaussianBlur Imgproc.GaussianBlur(ImageMatout, ImageMatout, new Size(5,5),2); Imgproc.dilate(ImageMatout, ImageMatout, Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(3,3))); Mat element = Imgproc.getStructuringElement(Imgproc.MORPH_RECT, new Size(17, 3)); Imgproc.morphologyEx(ImageMatout, ImageMatout, Imgproc.MORPH_CLOSE, element); //threshold image Imgproc.threshold(ImageMatout, ImageMatout, 0, 255, Imgproc.THRESH_OTSU+Imgproc.THRESH_B…
score: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 4
downvote count: 4
tagged with: opencv
has comment: http://stackoverflow.com/comment/40314576
tagged with: java

http://stackoverflow.com/a/31777161
answers question: http://stackoverflow.com/q/25863005
downvote count: 0
type: Answer
has body: I know probably I'm late. Although I am a beginner I would like to share the way I solve this problem. So, I had the same error, but I solved it taking these steps: Open your web browser (i.e I used Chrome) Open the main screen of apache tomcat http://localhost:{port} (by default in Eclipse, port:8080) Open the "Manager App". In my case, I needed to modify the tomcat-user.xml file which is located in the apache path installation.(So, you will have manager permits) When you open de Manager App, you will see your /RESTfulExample in a row. Check that it's running Finally, write in your web browser http://localhost:8080/RESTfulExample/rest/hello/hello%20world And you will see Jersey say : hello world I hope you can have another solution in your mind
upvote count: 1
score: 1

http://stackoverflow.com/q/25760844
has comment: http://stackoverflow.com/comment/40298431
tagged with: jpa
has comment: http://stackoverflow.com/comment/40293286
tagged with: jpql
score: 0
tagged with: eclipselink
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40298975
has body: i have an entity Recette which have a collection of an other entity Tags public class Recette private List&lt;TagRecette&gt; listeTag; ... @ManyToMany public List&lt;TagRecette&gt; getListeTag() { if (listeTag !=null) Collections.sort(listeTag); return listeTag; } @Entity public class TagRecette ... private List&lt;Recette&gt; listeRecettes; ... @ManyToMany(mappedBy = "listeTag", cascade = CascadeType.ALL) public List&lt;Recette&gt; getListeRecettes() { return listeRecettes; } in my DAO i want to select a list of "recettes" with a list of tags which contains one or many tags given in parameters SELECT r FROM Recette r inner join r.listeMembres proprietaire where proprietaire =:membre and r.categorie IN :listeCateg and r.listeTag in :listeTag it doesn't work and i have an error : java.sql.SQLSyntaxErrorException: Erreur de syntaxe : Encountered "NULL" at line 1, column 451 is my request malformed?
has title: EclipseLink select collections
tagged with: many-to-many
answer count: 0
has comment: http://stackoverflow.com/comment/40292892
tagged with: java
type: Question

http://stackoverflow.com/a/25772902
has comment: http://stackoverflow.com/comment/40306220
score: 8
type: Answer
downvote count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/40305919
has comment: http://stackoverflow.com/comment/40305799
has comment: http://stackoverflow.com/comment/40305834
has body: Answers already given are correct. However i want to point out that it's not true that the loop has no body. You have to consider it once compiled. It becomes : Initialize i at 100 Initialize j at 200 Increment i Decrement j IF NOT(I &lt; J) jump to 7 Jump to 3 Print and stuff The loop in this case is from 3 to 6, and has a body (increment i decrement j) and a condition check at point 5. To make it clearer, I will write another loop, functionally identical, but with a body : while (true) { i++; j--; if (!(i&lt;j)) break; } Now this loop has a body, but probably the compiled version of this loop and the previous one are identical. However, we could mean by "Empty body loop" a loop that has no side effects. For example, this loop : for (int i = 0; i &lt; 10000; i++); This loop is "really" empty : no matter if you execute it or not, it doesn't give or take anything from the rest of the program (if not a delay). So, we could define it "empty of any meaning" more than "empty of any body". In this case, the JIT will notice it, and wipe it out. In this sense, your loop could be : for (int i = 100, j = 200; i &lt; j; i++, j--); Here, since "i" and "j" are declared "inside" the loop (doesn't exist outside it's scope), then this loop is meaningless, and will be wiped out. Maybe this is what Herbert Shildt (that I admit I don't know) means? Also see here Java: how much time does an empty loop use? about empty loops and JIT.
has comment: http://stackoverflow.com/comment/40305722
has comment: http://stackoverflow.com/comment/40305766
answers question: http://stackoverflow.com/q/25772774

http://stackoverflow.com/comment/40452284
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25852289
type: Comment
has text: I asked how *you* define small.

http://stackoverflow.com/comment/40460653
has text: Post the **full** stack trace, please. **Edit it into the question**.
score: 4
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25857667

http://stackoverflow.com/q/25754469
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40273102
type: Question
has body: In my C# application, I am having a Bitmap encoded to a base64 string sent over from an android application, then I decode it and set it equal to a byte array. I get this exception though: "A first chance exception of type 'System.FormatException' occurred in mscorlib.dll". Android Side: byte[] iconByteArray = null; ByteArrayOutputStream baos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, baos); //Bitmap bitmap created elsewhere iconByteArray = baos.toByteArray(); encodedIcon = Base64.encodeToString(iconByteArray, Base64.DEFAULT); return encodedIcon; C# Side: byte[] arr = System.Convert.FromBase64String(encodedIcon); //this throws that exception Does anyone know of the cause? I'm guessing the format of the Base64 string in Java is not able to be decoded so simply by the C# application? It looks like I may have to do something like this and replace some characters? I tried this solution and got the same exception. The string sent through Android looks like this "/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAMCAgMCAgMDAwMEAwMEBQgFBQQEBQoHBwYIDAoMDAsK\nCwsNDhIQDQ4RDgsLEBYQERMUFRUVDA8XGBYUGBIUFRT/2wBDAQMEBAUEBQkFBQkUDQsNFBQUFBQU\nFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBT/wAARCABgAGADASIA\nAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQA\nAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3\nODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWm\np6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEA\nAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSEx\nBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElK\nU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3\nuLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD8qq2t\nG8EeIvENqbrStC1PUrYMUM1pZyyoGHUZVSM8jj3rFr9av2Ipl+Gf7PHh+xn1qfzNQL6rttY5AsYm\nCsEPzDJAHJx3roo4atiW1QjzNHBi8fhcBFSxU+VPRaN/kmfl9/wqrxp/…
tagged with: c#
answer count: 2
linked to: http://stackoverflow.com/q/13926513
downvote count: 0
has comment: http://stackoverflow.com/comment/40273031
tagged with: base64
has comment: http://stackoverflow.com/comment/40272956
has comment: http://stackoverflow.com/comment/40273013
has comment: http://stackoverflow.com/comment/40273032
has answer: http://stackoverflow.com/a/37352600
has comment: http://stackoverflow.com/comment/40273681
accepted answer: http://stackoverflow.com/a/25754723
has comment: http://stackoverflow.com/comment/40273096
tagged with: android
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/25754723
has comment: http://stackoverflow.com/comment/40273047
has comment: http://stackoverflow.com/comment/40273731
has title: Receiving a Base64 encoded string from Android into C# application
possible better answer: http://stackoverflow.com/a/37352600

http://stackoverflow.com/q/25782404
has body: I get my navigation drawer in a proper way when I first launch the app. The problem comes when I scroll down the drawer. Items beging to disappear and some of them even swap places. I've tried to find what is wrong but I can´t. Hope you could help me. I've updated my code using getItemViewType(int) and getViewTypeCount() but the problem still there when recycling the views. I leave you some piece of code here: NEW CODE public class NavDrawerListAdapter extends BaseAdapter { private static final int TYPE_ITEM = 0; private static final int TYPE_HEADER = 1; private static final int TYPE_SWITCH = 2; private static final int TYPE_MAX_COUNT = 3; private Context mContext; private ArrayList&lt;NavDrawerItem&gt; navDrawerItems; LayoutInflater inflater; public NavDrawerListAdapter(Context context, ArrayList&lt;NavDrawerItem&gt; navDrawerItems){ this.mContext = context; this.navDrawerItems = navDrawerItems; inflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); } @Override public int getCount() { return navDrawerItems.size(); } @Override public Object getItem(int position) { return navDrawerItems.get(position); } @Override public long getItemId(int position) { return position; } @Override public int getItemViewType(int position) { // TODO Auto-generated method stub //return super.getItemViewType(position); if((!navDrawerItems.get(position).getHeaderVisibility()) &amp;&amp;(!navDrawerItems.get(position).getSwitchVisibility())) return TYPE_ITEM; else if((navDrawerItems.get(position).getHeaderVisibility()) &amp;&amp;(!navDrawerItems.get(position).getSwitchVisibility())) return TYPE_HEADER; else if((!navDrawerItems.get(position).getHeaderVisibility()) &amp;&amp;(navDrawerItems.get(position).getSwitchVisibility())) return TYPE_SWITCH; else return TYPE_ITEM; } @Override public int getViewTypeCount() { // TODO Auto-generated method stub //return super.getViewTypeCount(); return TYPE_MAX_COUNT; } @Override public View getView(int position, View convert…
possible better answer: http://stackoverflow.com/a/25782597
has answer: http://stackoverflow.com/a/25874734
score: 0
answer count: 2
tagged with: android-listview
tagged with: baseadapter
has title: Navigation Drawer items disappear when recycling the views
has answer: http://stackoverflow.com/a/25782597
tagged with: android
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25874734
type: Question
tagged with: navigation-drawer

http://stackoverflow.com/q/25727871
answer count: 3
has title: Remove Enter key binding in JTable
possible better answer: http://stackoverflow.com/a/36765387
accepted answer: http://stackoverflow.com/a/25728214
has answer: http://stackoverflow.com/a/36765387
upvote count: 2
has body: What is the simplest and fastest way to remove the standard enter key bindings (pressing enter selects the next row) in a JTable? That's what I tried table.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), null); But it doesn't work. I assume that we have to do that somehow for each cell and not the table itself.
tagged with: swing
score: 2
tagged with: key-bindings
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25727964
has answer: http://stackoverflow.com/a/25728214
type: Question
linked to: http://stackoverflow.com/q/13516730
downvote count: 0
favorite count: 0
tagged with: jtable

http://stackoverflow.com/comment/40459382
comment on: http://stackoverflow.com/a/25856905
type: AnswerComment
has text: Thank you for such a quick response. I have tried your code. However, I get a bit of a weird response. I tried printing the result of "data" and it gave me "[B@723279cf" which is weird. The text file has about 40 lines of text, none of which contain those characters. I'm not really sure what is going on, perhaps I am messing things up with the slashes?
score: 0
type: Comment

http://stackoverflow.com/a/25767656
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Calendar calendar = Calendar.getInstance(Locale.ENGLISH); calendar.setTime(new Date()); calendar.add(Calendar.DATE, n); // n is the number of days upto which to be calculated Date futureDate = calendar.getTime(); List&lt;String&gt; listOfDates = returnListOfDatesBetweenTwoDates(new Date() , futureDate); where public static List&lt;String&gt; returnListOfDatesBetweenTwoDates(java.util.Date fromDate, java.util.Date toDate) { List&lt;String&gt; listOfDates = Lists.newArrayList(); Calendar startCal = Calendar.getInstance(Locale.ENGLISH); startCal.setTime(fromDate); Calendar endCal = Calendar.getInstance(Locale.ENGLISH); endCal.setTime(toDate); while (startCal.getTimeInMillis() &lt;= endCal.getTimeInMillis()){ java.util.Date date = startCal.getTime(); listOfDates.add(new SimpleDateFormat("dd-MM-yyyy" , Locale.ENGLISH).format(date).trim()); startCal.add(Calendar.DATE, 1); } return listOfDates; } Now compare this list of Dates with your Birthday list of dates and work accordingly
type: Answer
accepted answer of: http://stackoverflow.com/q/25767363
answers question: http://stackoverflow.com/q/25767363

http://stackoverflow.com/q/25746225
has answer: http://stackoverflow.com/a/25746320
tagged with: jsoup
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
accepted answer: http://stackoverflow.com/a/25746320
tagged with: parsing
has body: Hi i want to parse a text from an html document could you please give me ur lights on how to do it? and how to reach the specific text?? <?xml version="1.0" encoding="UTF-16"?> Προβολή δηλώσεων TEXT1 TEXT2 TEXT3 2013-2014 ΕΑΡ Κωδικός Τίτλος Εξάμ. ΔΜ Ώρες Τύπος Βαθμός TEXT5 TEXT6 Β 4 3 Υ **TEXT7** i want to reach to text7 i put a picture of where i want specifically to go because i messed up with the code sample: pic
has title: How to go a specific position?
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/40434327
score: 0
type: AnswerComment
type: Comment
has text: Thanks for input - how would you convert into a string with Objectmapper?
comment on: http://stackoverflow.com/a/25842721

http://stackoverflow.com/comment/40330738
type: Comment
type: QuestionComment
has text: There's a launching program `JavaApplication4`, in the linked answer also. Try to run it with _that_ and see what happens. If that works, then show _your_ code so we can see where you may be going wrong
comment on: http://stackoverflow.com/q/25786269
score: 0

http://stackoverflow.com/comment/40320531
comment on: http://stackoverflow.com/a/25779773
score: 0
type: Comment
type: AnswerComment
has text: Thank you for your reply.. can you please give me an example? Like how to modify my code?

http://stackoverflow.com/comment/40214581
type: QuestionComment
comment on: http://stackoverflow.com/q/25723669
score: 2
has text: The first creates a new hash set then throws it away immediately. The second doesn't.
type: Comment

http://stackoverflow.com/q/25729181
has answer: http://stackoverflow.com/a/25729248
has comment: http://stackoverflow.com/comment/40225255
has answer: http://stackoverflow.com/a/25729353
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: split
has body: I trying to split by newline and spaces but it doesn't work String[] parole = stringa.split("\\s\\[\\r\\n]+");
tagged with: java
has answer: http://stackoverflow.com/a/25729606
type: Question
has comment: http://stackoverflow.com/comment/40225174
answer count: 3
has title: How to split by newline and space
downvote count: 0
has comment: http://stackoverflow.com/comment/40225291
has comment: http://stackoverflow.com/comment/40225351
favorite count: 0

http://stackoverflow.com/comment/40257774
type: QuestionComment
comment on: http://stackoverflow.com/q/25746026
has text: What we want to do is to keep other coders in our team from making the mistake to only call a single implementation instead of every available implementation of that interface.
score: 0
type: Comment

http://stackoverflow.com/q/25715404
has answer: http://stackoverflow.com/a/25715424
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25715467
answer count: 2
upvote count: 0
favorite count: 0
has title: Making a vertical table using multidimensional array
tagged with: multidimensional-array
has body: I've used a multidimensional to create a table,however when I run it it seems that the table keeps going horizontally, how can I make it line up vertical when it is ran? public static void main(String args[]){ int firstarray[][]={{1,2,3,4,5} ,{6,7,8,9,10}}; 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.print(x[row][column]+"\t"); } } } }
score: -1
possible better answer: http://stackoverflow.com/a/25715424
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25715467

http://stackoverflow.com/q/25724937
has comment: http://stackoverflow.com/comment/40217214
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40217289
accepted answer: http://stackoverflow.com/a/25725067
possible better answer: http://stackoverflow.com/a/78958821
upvote count: 4
has body: Starting to think I'm using the wrong book for learning. I've copied this word-for-word from Sam's Learn Java, but the .sort(names); method is undefined for type of array. I have a feeling it's to do with the public static void main(String[] args) { call, but I don't know how to amend it. package arrays; import java.util.*; public class Arrays { public static void main(String[] args) { String names[] = { "Lauren", "Audrina", "Heidi", "Whitney", "Stephanie", "Spencer", "Lisa", "Brody", "Frankie", "Holly", "Jordan", "Brian", "Jason" }; System.out.println("The original order:"); for (int i = 0; i &lt; names.length; i++) { System.out.print(i + ": " + names[i] + " "); } Arrays.sort(names); System.out.println("\nThe new order:"); for (int i = 0; i &lt; names.length; i++) { System.out.print(i + ": " + names[i] + " "); } System.out.println(); } }
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25725067
tagged with: java
has comment: http://stackoverflow.com/comment/40217083
has title: Why won't this Java array's .sort method work?
has comment: http://stackoverflow.com/comment/40217171
type: Question
has comment: http://stackoverflow.com/comment/40217169
answer count: 2
has comment: http://stackoverflow.com/comment/40217248
has answer: http://stackoverflow.com/a/78958821
tagged with: arrays
has comment: http://stackoverflow.com/comment/40216982
score: 4

http://stackoverflow.com/a/51071889
upvote count: 1
score: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25863005
has body: If you experience this with Spring MVC then you may resolve the issue by adding produces = mime type to the @RequestMapping annotation. The result would look similar to this: ... @RequestMapping(value = "/mapping-address", produces = "text/html;charset=UTF-8") ... I had this issue when I annotated a method, which returns a String, with @ResponseBody annotation.

http://stackoverflow.com/a/25715110
has comment: http://stackoverflow.com/comment/40198996
has comment: http://stackoverflow.com/comment/40199031
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40199255
has comment: http://stackoverflow.com/comment/40198826
has comment: http://stackoverflow.com/comment/40199344
upvote count: 5
has comment: http://stackoverflow.com/comment/40198817
has comment: http://stackoverflow.com/comment/40199492
type: Answer
has comment: http://stackoverflow.com/comment/40198891
has body: Java objects are eligible for garbage collection once you no longer has a strong reference to the object. This is not dependent on if you "use" the object or not. In this example, def foo() { val tempFile = TemporaryFile(new File("/tmp/foo")) val inputStream = new FileInputStream(tempFile.file) // last use try { println(inputStream.read()) } finally { inputStream.close() } } tempFile is not eligible for garbage collection, and therefore finalization, until foo() is is no longer used. It's possible that objects that use members from tempFile may use it, and keep it ineligible longer than the last use inside foo(). In this example, def foo() { val tempFile = TemporaryFile(new File("/tmp/foo")) bar(tempFile) } def bar(tempFile: TemporaryFile) { val inputStream = new FileInputStream(tempFile.file) // last use try { println(inputStream.read()) } finally { inputStream.close() } } The result is the same. In a minor variant (Java, I don't know Scala syntax well), class Foo { List&lt;Object&gt; objects = new List&lt;Object&gt;(); void foo(Object o) { objects.add(o); } } // ... Foo f = new Foo(); f.foo(new Object()); // The object we just created is not eligible for garbage // collection until the `Foo f` is not used, because // it holds a strong reference to the object.
has comment: http://stackoverflow.com/comment/40198940
has comment: http://stackoverflow.com/comment/40199134
has comment: http://stackoverflow.com/comment/40199397
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25715018
has comment: http://stackoverflow.com/comment/40199434
answers question: http://stackoverflow.com/q/25715018
score: 5

http://stackoverflow.com/comment/40323832
has text: Reformulate your question; in general consider us dummies (I am). JFileChooser has an `showOpenDialog()` and a `showSaveDialog()` and the file can be gotten by `getSelectedFile()`. In the net are several demos.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25782707

http://stackoverflow.com/a/25798923
downvote count: 0
has comment: http://stackoverflow.com/comment/40362682
type: Answer
has body: Joomla in the latest 3.3.x you are asking about does not use MD5 anymore it uses bcrypt https://stackoverflow.com/a/21315610/6096
upvote count: 1
answers question: http://stackoverflow.com/q/25796434
score: 1
accepted answer of: http://stackoverflow.com/q/25796434
has comment: http://stackoverflow.com/comment/40395626
type: AcceptedAnswer

http://stackoverflow.com/a/48982182
has body: tl;dr ZonedDateTime.now( ZoneId.of( "America/Chicago" ) ) Details I am trying to read the system date in CST time zone By “CST”, do you mean Central Standard Time in North America, or China Standard Time? Specify a proper time zone name in the format of continent/region, such as America/Montreal, Africa/Casablanca, or Pacific/Auckland. Never use the 3-4 letter abbreviation such as EST or IST as they are not true time zones, not standardized, and not even unique as seen above with CST. ZoneId z = ZoneId.of( "America/Chicago" ) ; java.time You are using troublesome old date-time classes that are now legacy. Supplanted by the java.time classes. Get the current moment in UTC. The Instant class represents a moment on the timeline in UTC with a resolution of nanoseconds (up to nine (9) digits of a decimal fraction). Instant instant = Instant.now() ; 2018-02-26T05:45:24.213610Z Adjust into another time zone. Same moment, same point on the timeline, different wall-clock time. ZonedDateTime zdt = instant.atZone( z ) ; zdt.toString(): 2018-02-25T23:45:24.213610-06:00[America/Chicago] The above strings are in standard ISO 8601 format. The ZonedDateTime class extends that standard wisely to append the name of the zone in square brackets. If you want to generate String objects in other formats, use DateTimeFormatter. DateTimeFormatter f = DateTimeFormatter.ofPattern( "dd-MM-uuuu HH:mm:ss" ) ; String output = zdt.format( f ) ; About java.time The java.time framework is built into Java 8 and later. These classes supplant the troublesome old legacy date-time classes such as java.util.Date, Calendar, &amp; SimpleDateFormat. The Joda-Time project, now in maintenance mode, advises migration to the java.time classes. To learn more, see the Oracle Tutorial. And search Stack Overflow for many examples and explanations. Specification is JSR 310. Using a JDBC driver compliant with JDBC 4.2 or later, you may exchange java.time objects directly with your database. No need for strings nor jav…
downvote count: 0
answers question: http://stackoverflow.com/q/25767825
type: Answer
score: 7
upvote count: 7

http://stackoverflow.com/comment/40323904
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25782961
has text: What you send is not an xslx file. You send a csv with tab as delimiter.
type: Comment

http://stackoverflow.com/comment/40357924
comment on: http://stackoverflow.com/a/25800560
type: AnswerComment
score: 0
has text: Tks @shazin!! This sounds a good idea. As you taught, like implementation of verification code, image retrieval methods need write this image stream into response, right? This solution may cause performance issue since every time image retrieval, it will be read in memory and written in response, instead if we directly access image with URL by Web Server's static access way, it will be fairy efficient, right? But anyway, if there is the best solution I'd like to take your advice. Thanks so much.
type: Comment

http://stackoverflow.com/q/25775510
has comment: http://stackoverflow.com/comment/40310937
has comment: http://stackoverflow.com/comment/40310979
favorite count: 0
has answer: http://stackoverflow.com/a/25775575
has comment: http://stackoverflow.com/comment/40310950
has comment: http://stackoverflow.com/comment/40311169
accepted answer: http://stackoverflow.com/a/25775575
has title: How to import image into JPanel
upvote count: 2
has comment: http://stackoverflow.com/comment/40310922
tagged with: swing
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
has body: I am working on an assignment (GASP) and having issues with my image displaying. I am not looking for someone to complete my assignment for me but I desperately need some help figuring out why my code is not working properly. I have reviewed my Java Programming book as well as searched for the answers online to no avail so if someone could lead me in the right direction I would greatly appreciate it!! Here is my displayImage code: import java.awt.Graphics; import java.awt.Image; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JPanel; public class DisplayImage extends JFrame { public void DislayImage(){ add (new ImagePanel()); } public static void main(String[] args) { JFrame frame = new DisplayImage (); frame.setTitle("Go Bearcats!"); frame.setSize(300, 300); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); Assignment02 a = new Assignment02(); frame.add(a); } } class ImagePanel extends JPanel { public final static String LOC = "C:\\UCincinnatiLogo.jpg"; private ImageIcon imageIcon = new ImageIcon (LOC); private Image image = imageIcon.getImage(); @Override /**Draw image on the panel*/ protected void paintComponent(Graphics g){ super.paintComponent(g); if (image !=null) g.drawImage(image, 200, 200, getWidth(), getHeight(), this); } }
tagged with: image
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/40312037
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/40333678
score: 0
comment on: http://stackoverflow.com/q/25762446
type: Comment
type: QuestionComment
has text: If this method is what you aim to test, simply ignore the annotations. Those are there for frameworks that need them. Your unit-test on the other hand, does not need them ...

http://stackoverflow.com/a/27120376
has comment: http://stackoverflow.com/comment/42768583
upvote count: 1
has body: I faced the same problem and used jquery notification plugin as a workaround you can also use "onShow" in the plugin callback to play a sound or whatever to make sure that the user is notified
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25825117
type: Answer

http://stackoverflow.com/a/25798808
accepted answer of: http://stackoverflow.com/q/25797753
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25797753
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40376377
has body: After. You call it when the changes have finished happening and not before hand. I'm guessing you are using a custom adapter. So ideally, the setItems() method should be invoking notifyDataSetChanged() itself instead of having to rely on it happening externally.
score: 1
has comment: http://stackoverflow.com/comment/40367551

http://stackoverflow.com/comment/40265869
comment on: http://stackoverflow.com/q/25751106
type: Comment
type: QuestionComment
has text: Remove that semicolon after the `if` condition.
score: 1

http://stackoverflow.com/q/25780301
has answer: http://stackoverflow.com/a/25808727
upvote count: 1
tagged with: filereader
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40320918
tagged with: inputstream
type: Question
accepted answer: http://stackoverflow.com/a/25808727
answer count: 1
downvote count: 0
has title: Retrieve pdf file stream from server
favorite count: 0
has body: By following this link PLUNKER . I want to show pdf file in new window, but I want to read the pdf file from server My service code @RequestMapping(value = "/retrievePDFFile", method = RequestMethod.GET) public @ResponseBody InputStream retrievePDFFile() throws FileNotFoundException { InputStream inputStream = new FileInputStream("/resources/AngularJS 2013.pdf"); return inputStream; } My angular controller $http({ method : "GET", url : "/service/retrievePDFFile" }).success(function(data) { console.log(data); }).error(function(data, status) { console.log(data); }); I got the pdf input stream from server like this.. How to read this, and open as a PDF file in new tab or window.. Thanks
tagged with: http://stackoverflow.com/tag/pdf
has comment: http://stackoverflow.com/comment/40319536
score: 1
tagged with: angularjs

http://stackoverflow.com/q/25785303
accepted answer: http://stackoverflow.com/a/25786369
upvote count: 1
has title: how to find tomcat server system information using java code?
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/40327960
has comment: http://stackoverflow.com/comment/40328133
has comment: http://stackoverflow.com/comment/40328017
has comment: http://stackoverflow.com/comment/40328331
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/25786369
has body: i am developing web application and i host it in tomcat server. my requirement is client system wants to know the ip address of the system where the tomcat server located in a network.Before make any request to the server using java.or any possible to set default ip address for the tomcat server.and how can i use the default ip address to make a request if system ip and tomcat ip are different.
has comment: http://stackoverflow.com/comment/40328184
has comment: http://stackoverflow.com/comment/40327927
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/25873390
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40489890
has comment: http://stackoverflow.com/comment/40489370
upvote count: 2
type: Answer
has body: You can use "client properties" from JComponent. Each Jcomponent contains a Map to put properties inside. You can use a constant String like "associatedPanel" for the key, and the JPanel for the value. The code could be something like this: JPanel panel1 = new JPanel(); JLabel label1 = new JLabel(); label1.putClientProperty("associatedPanel", panel1); Now in the mouse listener use getClientProperty("associatedPanel") to obtain the associated panel to set the background.
answers question: http://stackoverflow.com/q/25872055

http://stackoverflow.com/q/25716179
tagged with: string
score: 0
tagged with: random
answer count: 3
has comment: http://stackoverflow.com/comment/40201318
linked to: http://stackoverflow.com/q/4897410
has body: I've made a random wrestling match generator that I've adapted from a random phrase generator from a textbook. I'd like to know how to make it so the same name isn't done twice on the same run. Can't have The Crusher vs. The Crusher, right? public class matchOMatic { public static void main (String [] args) { String [] wordListOne = {"The Crusher", "The Main Man", "The Macho-man, Randy Savage", "The Nature Boy, Rick Flare", "Batista", "Hollywood Hulk Hogan", "Vader", "The Undertaker", "Stone Cold Steve Austin" }; String [] wordListThree = {"The Crusher", "The Main Man", "The Macho-man, Randy Savage", "The Nature Boy, Rick Flare", "Batista", "Hollywood Hulk Hogan", "Vader", "The Undertaker", "Stone Cold Steve Austin"}; int oneLength = wordListOne.length; int threeLength = wordListThree.length; int rand1 = (int) (Math.random() * oneLength); int rand3 = (int) (Math.random() * threeLength); String phrase = wordListOne[rand1] + " and in the opposite corner is his opponent, " + wordListThree[rand3]; System.out.print("In this corner we have " + phrase); System.out.println("!"); } }
accepted answer: http://stackoverflow.com/a/25716233
has title: How do I keep my random match generator from repeating?
has answer: http://stackoverflow.com/a/25716801
possible better answer: http://stackoverflow.com/a/25716801
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/4897410
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25716233
has answer: http://stackoverflow.com/a/25716330

http://stackoverflow.com/comment/40469424
has text: I voted +1 because other people may search for this special problem and you solution for it. But I don't accept the answer because I want to know how can I get all the matches (zero, one or more) for a arbitary group with an asterisk `(xyz)*`
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25858393

http://stackoverflow.com/a/25776171
answers question: http://stackoverflow.com/q/25776067
score: 0
type: Answer
has body: public static Quadratic sum(Quadratic q1, Quadratic q2){ return new Quadratic( q1.a+q2.a , q1.b+q2.b , q1.c+q2.c ); }

http://stackoverflow.com/comment/40475817
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25866142
has text: No, the `CloseShieldInputStream` never closes the original stream. It only removes its wrapped stream reference and therefore hides the original stream after the `CloseShieldInputStream` was closed. It does however never delegate the closing.

http://stackoverflow.com/comment/40239265
comment on: http://stackoverflow.com/a/25736396
has text: Ok, I see what your saying. Thank you for your help. This was a huge help.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/78558622
score: 0
type: Answer
has body: MediaFormat mediaFormat = MediaFormat.createVideoFormat("video/avc", 320, 240); input buffer size = width * height * 3 / 2 The buffer size is determined by the width and height of the input
answers question: http://stackoverflow.com/q/25739773

http://stackoverflow.com/q/25834251
has comment: http://stackoverflow.com/comment/40417513
has comment: http://stackoverflow.com/comment/40417566
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/40417550
type: Question
tagged with: if-statement
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25834706
has comment: http://stackoverflow.com/comment/40418120
has comment: http://stackoverflow.com/comment/40418250
has comment: http://stackoverflow.com/comment/40418335
favorite count: 0
has body: String option = (String) JOptionPane.showInputDialog(frame, "A wooden crate appears! It looks ready to kick your butt!", "Battle!", JOptionPane.QUESTION_MESSAGE, null, attacks, attacks[0]); if (option.equals("slash")) { damage = (int)(Math.random()*(stick.getMax()-stick.getMin()) + stick.getMin()); } else if (option.equals("magic")) { if (playerMana &gt;= 25) { damage = (int) intellect*((stick.getMax()-stick.getMin())/2) + (int)Math.round(Math.pow(playerLevel, 1.20)); playerMana -= 25; } else { damage = 0; } } else if (option.equals("run")) { out.println("fail! you run from the fight!"); } else if (option.equals("healing") &amp;&amp; healPots &gt;= 1) { playerHp+= (playerHp*0.15); } else { out.println("you have no potions! Get some in town to heal your hp!"); } Stick is just a weapon object I made with min max damage values. Player hp and mana are both 100. healPots is 0. I am trying to make a rpg style fighting system where the player picks options and takes turns. However, the loop automatically skips to the final else regardless of what is chosen.
has title: Fixing if else if statements for java game
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/40417985

http://stackoverflow.com/comment/40315765
type: QuestionComment
has text: you have plenty of run() method in your question, which though you should not, do you mean you see "Kotan Finished. and Bisis Finished" out put again and again? or something else? I still advice that you put your console output in your question. You it just print once, use volatile of your runSignal .
score: 0
comment on: http://stackoverflow.com/q/25778159
type: Comment

http://stackoverflow.com/comment/40263221
score: 0
has text: Are the names optional as well? If so try a map else just make the values nullable.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25749606

http://stackoverflow.com/comment/40332588
comment on: http://stackoverflow.com/a/25787334
has text: just a dirty suggestion, reinstall tomcat again. Somehow it doesn't install correctly.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40199664
type: AnswerComment
comment on: http://stackoverflow.com/a/25715296
score: 0
type: Comment
has text: @BitNinja what method? `move()` _exists_ in `Animal` class, even if it's not implemented there. And when you fill the list, you do it with concrete subclasses that _do_ implement it, so it can be called. Why don't you try it? it'll be much, much better if you construct an actual example and see how things work.

http://stackoverflow.com/comment/40386183
type: QuestionComment
has text: I'll need to zip the file and send it to my Professor, so won't that break the path if I did the hardcoded path?
comment on: http://stackoverflow.com/q/25816655
score: 0
type: Comment

http://stackoverflow.com/comment/40465921
comment on: http://stackoverflow.com/a/25860533
score: 0
type: AnswerComment
has text: @RobbyCornelissen - k let me try this
type: Comment

http://stackoverflow.com/comment/40236572
has text: I did, stackoverflow auto-converted it to a comment because it was short :) Looks like he got what he needed, which is what matters.
score: 0
comment on: http://stackoverflow.com/q/25732534
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25853393
has answer: http://stackoverflow.com/a/39569252
tagged with: string
has comment: http://stackoverflow.com/comment/40453162
has title: split a string in java into equal length substrings while maintaining word boundaries
has comment: http://stackoverflow.com/comment/40453313
favorite count: 0
has comment: http://stackoverflow.com/comment/40453258
has comment: http://stackoverflow.com/comment/40453101
has comment: http://stackoverflow.com/comment/40452811
accepted answer: http://stackoverflow.com/a/25854068
upvote count: 11
has comment: http://stackoverflow.com/comment/40452627
type: AnsweredQuestion
downvote count: 1
type: Question
tagged with: java
score: 10
has comment: http://stackoverflow.com/comment/40453308
has answer: http://stackoverflow.com/a/25854068
answer count: 2
has body: How to split a string into equal parts of maximum character length while maintaining word boundaries? Say, for example, if I want to split a string "hello world" into equal substrings of maximum 7 characters it should return me "hello " and "world" But my current implementation returns "hello w" and "orld " I am using the following code taken from Split string to equal length substrings in Java to split the input string into equal parts public static List&lt;String&gt; splitEqually(String text, int size) { // Give the list the right capacity to start with. You could use an array // instead if you wanted. List&lt;String&gt; ret = new ArrayList&lt;String&gt;((text.length() + size - 1) / size); for (int start = 0; start &lt; text.length(); start += size) { ret.add(text.substring(start, Math.min(text.length(), start + size))); } return ret; } Will it be possible to maintain word boundaries while splitting the string into substring? To be more specific I need the string splitting algorithm to take into account the word boundary provided by spaces and not solely rely on character length while splitting the string although that also needs to be taken into account but more like a max range of characters rather than a hardcoded length of characters.
linked to: http://stackoverflow.com/q/3760152
has comment: http://stackoverflow.com/comment/40453168
possible better answer: http://stackoverflow.com/a/39569252

http://stackoverflow.com/comment/40329659
score: 3
type: Comment
type: QuestionComment
has text: Are you sure the file is being deleted in the first place? By default applets don't have access to the local file system.
comment on: http://stackoverflow.com/q/25786334

http://stackoverflow.com/a/25718517
upvote count: 1
answers question: http://stackoverflow.com/q/25718315
has comment: http://stackoverflow.com/comment/40206973
has body: You will have to create an AsyncTask first. public class ProcessTask extends AsyncTask&lt;Void, Integer, String&gt;{ String s1, s2, s3, s4; public ProcessTask(String str1, String str2, String str3, String str4) { // TODO Auto-generated constructor stub s1 = str1; s2 = str2; s3 = str3; s4 = str4; } @Override protected void onPreExecute() { // TODO Auto-generated method stub //do something with strings super.onPreExecute(); } @Override protected String doInBackground(Void... params) { // TODO Auto-generated method stub //your code of parsing return null; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); } } Call it as: ProcessTask p = new ProcessTask(s1, s2, s3, s4); p.execute(); Hope this helps. To return a List&lt;ReceiveFields&gt;, change: public class ProcessTask extends AsyncTask&lt;Void, Integer, String&gt; to public class ProcessTask extends AsyncTask&lt;Void, Integer, List&lt;ReceiveFields&gt;&gt; You would need to remove existing overriden method which returns String and override the proper method doInBackground, which returns List.
accepted answer of: http://stackoverflow.com/q/25718315
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40206889
type: Answer
has comment: http://stackoverflow.com/comment/40205975
score: 1

http://stackoverflow.com/q/25740832
has answer: http://stackoverflow.com/a/25745778
accepted answer: http://stackoverflow.com/a/25745778
type: AnsweredQuestion
has title: Remotely access an EJB across a network or networks from client
tagged with: java
type: Question
tagged with: jakarta-ee
tagged with: ejb
has comment: http://stackoverflow.com/comment/40333798
has comment: http://stackoverflow.com/comment/40322187
tagged with: glassfish
score: 0
has body: Assuming a CLI or Swing interface client, how is a remote Bean accessed through Glassfish? By obtaining a reference to the BeanManager? sample code: Hashtable contextArgs = new Hashtable(); // First you must specify the context factory. // This is how you choose between jboss implementation // vs. an implementation from Sun or other vendors. contextArgs.put( Context.INITIAL_CONTEXT_FACTORY, "com.jndiprovider.TheirContextFactory" ); // The next argument is the URL specifying where the data store is: contextArgs.put( Context.PROVIDER_URL, "jndiprovider-database" ); // (You may also have to provide security credentials) // Next you create the initial context Context myCurrentContext = new InitialContext(contextArgs); http://en.wikipedia.org/wiki/Java_Naming_and_Directory_Interface#Basic_lookup So, for a CLI app to access a running glassfish app server, it would use something along the lines of: Context context = null; try { context = new InitialContext(); hello = (Hello) context.lookup("java:global/SalutationApp/SalutationApp-ejb/Hello"); hello.myRemoteMethod(); } catch (Exception e) { e.printStackTrace(); } only with a specified URL to connect to a specific glassfish instance? How is a connection established?
has comment: http://stackoverflow.com/comment/40328273
answer count: 1
has comment: http://stackoverflow.com/comment/40322117
linked to: http://stackoverflow.com/q/25700311
tagged with: cdi

http://stackoverflow.com/q/25726444
has comment: http://stackoverflow.com/comment/40221771
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25726838
accepted answer: http://stackoverflow.com/a/25726838
has title: Inject two different instances of the same type with @Autowired
upvote count: 2
tagged with: spring
tagged with: autowired
answer count: 1
tagged with: java
linked to: http://stackoverflow.com/q/14388480
has comment: http://stackoverflow.com/comment/40220023
score: 2
type: AnsweredQuestion
has body: I have the following class: @Component public class SearchComponent { } And it is injected to two fields in other class: @Autowired private SearchComponent errorSearch; @Autowired private SearchComponent successSearch; The default behavior is to inject the same instance to both fields, and this is happening, but what I want is that errorSearch and successSeach be different instances. It is possible to do this? How can it be done?

http://stackoverflow.com/comment/40584960
comment on: http://stackoverflow.com/a/25904288
has text: I am able to upload small sized files with the same url and ur code too, but the problem exists with uploading large files. I have edited just the url part in the comment, actual url is appended by a /servlet name.
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25759161
has answer: http://stackoverflow.com/a/26337702
tagged with: java
has title: connect to the xampp localhost database with the real device
score: 0
has answer: http://stackoverflow.com/a/25759466
tagged with: javascript
possible better answer: http://stackoverflow.com/a/25759329
has comment: http://stackoverflow.com/comment/40280753
has body: I can connect to the xampp localhost database with andoird emulator,but when I try it with the real device,it is not connecting.Is there any way to connect my android device to the localhost xampp database .Thanks in advance.
tagged with: android
answer count: 4
has answer: http://stackoverflow.com/a/25759329
has comment: http://stackoverflow.com/comment/40280692
linked to: http://stackoverflow.com/q/5806220
has answer: http://stackoverflow.com/a/25759285
accepted answer: http://stackoverflow.com/a/25759285
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40280912

http://stackoverflow.com/q/25825611
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25834001
tagged with: jgit
downvote count: 0
has body: I am working on a project which involves cloning a git repository to a local directory. I read through the tutorial and my code looks like this: /* * Clones a github project to the designated directory and checks it out. (Both prefix and postfix) * &lt;p&gt; * @param buildPath - String, the path where the directories will be created and the projects built. * @param bugID - String, the bug's id. * @param projectURL - String, the github URL used to clone the project. */ public void DownloadAndSetup(String buildPath, String bugID, String projectURL, String prefixHash, String postfixHash) throws InvalidRemoteException, TransportException, GitAPIException { String generalPath = buildPath+File.separator+bugID; String prefixPath = generalPath+File.separator+"prefix"; String postfixPath = generalPath+File.separator+"postfix"; // Cloning &amp; checking out to prefix Git gitPrefix = Git.cloneRepository().setURI(projectURL).setDirectory(new File(prefixPath)).call(); gitPrefix.checkout().setCreateBranch(true).setName("new-branch").setStartPoint(prefixHash).call(); // Cloning &amp; checking out to postfix Git gitPostfix = Git.cloneRepository().setURI(projectURL).setDirectory(new File(postfixPath)).call(); gitPostfix.checkout().setCreateBranch(true).setName("new-branch").setStartPoint(postfixHash).call(); } But when I run: public static void main(String[] args) throws InvalidRemoteException, TransportException, GitAPIException { GitDownloader gd = new GitDownloader(); String buildPath = "C:\\Users\\dario_000\\Dropbox\\SheffInternship\\wsp\\AutoEv\\src\\tests"; gd.DownloadAndSetup(buildPath, "download", "https://github.com/jhy/jsoup.git", "1e9ae842ca94f326215358917c620ac407323c81", "04e256ce9571e4239403b657126ce8eb30ad6776"); } I get the following error: Exception in thread "main" java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException at org.eclipse.jgit.transport.Transport.&lt;clinit&gt;(Transport.java:114) at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:120) a…
answer count: 1
score: 1
favorite count: 0
type: UnansweredQuestion
has title: Cloning a repository to a local directory with JGit
upvote count: 1
tagged with: git

http://stackoverflow.com/comment/40249424
comment on: http://stackoverflow.com/a/25741112
type: Comment
has text: i should put the if else inside the reading content of the server method right? and on the client (sender) i should flush every one single file also... am i right @EJP? Please check the updated code above.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/51432104
type: Comment
score: 2
has text: @ErickG.Hagstrom: That's only true if it's a persistent stream.
type: AnswerComment
comment on: http://stackoverflow.com/a/25827986

http://stackoverflow.com/comment/40379195
has text: To display any numeric value, you need to convert it to a `String`, whether you are doing so implicitly or explicitly. With `Integer.toString(int, int)`, you are explicitly choosing how you want your `int` to be represented as a `String`.
type: Comment
comment on: http://stackoverflow.com/a/25812653
score: 0
type: AnswerComment

database
tags question: http://stackoverflow.com/q/25820652
tags question: http://stackoverflow.com/q/25842052
tags question: http://stackoverflow.com/q/25822996
tags question: http://stackoverflow.com/q/25784051
tags question: http://stackoverflow.com/q/25727516
tags question: http://stackoverflow.com/q/25848652
tags question: http://stackoverflow.com/q/25862871
tags question: http://stackoverflow.com/q/25821413
tags question: http://stackoverflow.com/q/25745532
tags question: http://stackoverflow.com/q/25770768
type: Tag
tags question: http://stackoverflow.com/q/25736574
tags question: http://stackoverflow.com/q/25832501
tags question: http://stackoverflow.com/q/25845849
tags question: http://stackoverflow.com/q/25829164
tags question: http://stackoverflow.com/q/25760233
tags question: http://stackoverflow.com/q/25811407
tags question: http://stackoverflow.com/q/25716485
tags question: http://stackoverflow.com/q/25813993
tag name: database
tags question: http://stackoverflow.com/q/25757021
tags question: http://stackoverflow.com/q/25798699
tags question: http://stackoverflow.com/q/25845366
tags question: http://stackoverflow.com/q/25796865
tags question: http://stackoverflow.com/q/25777994
tags question: http://stackoverflow.com/q/25862498
tags question: http://stackoverflow.com/q/25785687
tags question: http://stackoverflow.com/q/25834145
tags question: http://stackoverflow.com/q/25781603
tags question: http://stackoverflow.com/q/25811182
tags question: http://stackoverflow.com/q/25862979
tags question: http://stackoverflow.com/q/25745790
tags question: http://stackoverflow.com/q/25768537
tags question: http://stackoverflow.com/q/25856082
tags question: http://stackoverflow.com/q/25729513
tags question: http://stackoverflow.com/q/25800357
tags question: http://stackoverflow.com/q/25871629
tags question: http://stackoverflow.com/q/25860589

http://stackoverflow.com/q/25780026
downvote count: 0
has body: I am trying to implement authentication on Spring web service by referring the following link: http://docs.spring.io/spring-ws/site/reference/html/security.html Following is the configuration I have added: While deploying the war file on server, I get following error: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0' defined in ServletContext resource [/WEB-INF/xws-spring-ws-servlet.xml]: Cannot resolve reference to bean 'wsServerSecurityInterceptor' while setting bean property 'interceptors' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wsServerSecurityInterceptor' defined in ServletContext resource [/WEB-INF/xws-spring-ws-servlet.xml]: Cannot resolve reference to bean 'springSecurityHandler' while setting bean property 'callbackHandlers' with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityHandler' defined in ServletContext resource [/WEB-INF/xws-spring-ws-servlet.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/security/authentication/AuthenticationManager at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:353) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:154) at org.springframewo…
tagged with: spring-security
possible better answer: http://stackoverflow.com/a/25780177
has answer: http://stackoverflow.com/a/25780177
favorite count: 0
has answer: http://stackoverflow.com/a/25787208
has title: java.lang.NoClassDefFoundError: org/springframework/security/authentication/AuthenticationManager
score: 6
tagged with: spring
upvote count: 6
type: AnsweredQuestion
tagged with: spring-ws
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25787208
answer count: 2

http://stackoverflow.com/q/25740468
score: 2
downvote count: 0
has body: I am using java to write to a text file when a button is pressed. I am writing to the file using: FileWriter write = null; try { write = new FileWriter(fileLocation, false); PrintWriter print = new PrintWriter(write); print.printf("%s" + "%n", text); print.close(); } catch (IOException ex) { Logger.getLogger(DataEntry.class.getName()).log(Level.SEVERE, null, ex); } finally { try { write.close(); } catch (IOException ex) { Logger.getLogger(DataEntry.class.getName()).log(Level.SEVERE, null, ex); } } Once it has been written to, I open the text file using: Desktop.getDesktop().open(new File(fileLocation)); This is fine if the text file is closed when the button is pressed. However, if the file is open, then the text file is changed, but the changes aren't shown when java 'opens' the file. Instead, it brings the already open text file to the front but does not update the contents. Is there a way to show the new information?
favorite count: 0
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40246749
answer count: 2
has answer: http://stackoverflow.com/a/25743483
has comment: http://stackoverflow.com/comment/40251679
tagged with: java
tagged with: file
has answer: http://stackoverflow.com/a/25743529
has title: Java: Opening a file that is already open but has been updated
has comment: http://stackoverflow.com/comment/40251166
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40251095

http://stackoverflow.com/comment/40398201
type: Comment
has text: Thank you for you reply. I need to first closed the print dialogue box that automatically popped up with window B. Since selenium driver can't handle these pop ups that's why I had to use JavaScript injection. After that I have to close window B. That can be handle by using driver.close(). I will try that what you have suggested. If you get any other workaround with this code or java script code . please let me know. And also I don't need to close window A when I finally switched to A. I just need to close print dialogue and then window B.
comment on: http://stackoverflow.com/a/25807783
type: AnswerComment
score: 0

http://stackoverflow.com/a/58375773
downvote count: 0
answers question: http://stackoverflow.com/q/25738569
score: 10
has body: It is simple @Column(name = "json_input", columnDefinition = "json") private String field; and in mysql database your column 'json_input' json type
upvote count: 10
type: Answer

http://stackoverflow.com/q/25720135
linked to: http://stackoverflow.com/q/7066405
has comment: http://stackoverflow.com/comment/40219414
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40220143
has body: I usually try to design my classes as immutable classes, so I have a lot of advantages in terms of coding stress. But working with Spring, I sometimes notice that the framework "discourages" this kind of design in most cases, in favour of classic JavaBeans design: default constructor + getters/setters. I really don't like JavaBean designed objects because of their insane mutability. So I'm wondering if I'm missing something... I try to keep my classes design as elegant and reusable as possible, but a framework requires to change this design or allow it in a difficult way... What's wrong with this?
tagged with: spring
has comment: http://stackoverflow.com/comment/40208909
tagged with: spring-mvc
has comment: http://stackoverflow.com/comment/40208727
has comment: http://stackoverflow.com/comment/40218859
has answer: http://stackoverflow.com/a/25723527
has title: Immutable objects and Spring/Spring MVC: the right choice?
tagged with: java
score: 17
has comment: http://stackoverflow.com/comment/40209658
has comment: http://stackoverflow.com/comment/40208619
type: Question
has comment: http://stackoverflow.com/comment/40219654
upvote count: 17
has comment: http://stackoverflow.com/comment/40219991
favorite count: 0
has comment: http://stackoverflow.com/comment/40210977
answer count: 3
has answer: http://stackoverflow.com/a/25720269
has comment: http://stackoverflow.com/comment/40208885
has answer: http://stackoverflow.com/a/46588468

http://stackoverflow.com/comment/40459487
has text: I posted my answer lemme know how much it helped you
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25856945

count
tags question: http://stackoverflow.com/q/25769358
tag name: count
type: Tag

http://stackoverflow.com/q/25862099
has body: I develop with eclipse, Java for Android. I just installed SVN subclipse for the company. I made the repository in a cloud (maybe it is a mistake, I can change it) and we all work every one in his computer and then commit the code to the repository. The repository is always the latest code of all the developers. I don't find a way how to compile the repository and build an APK file. How can I do it?
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: svn
tagged with: java
tagged with: eclipse
has title: How to compile the svn repository?
downvote count: 0
answer count: 1
favorite count: 0
tagged with: apk
has answer: http://stackoverflow.com/a/25862199

http://stackoverflow.com/comment/40387592
has text: Bacuse I want to add a check in case it is 2 not hardcode 2
comment on: http://stackoverflow.com/q/25817269
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40274891
comment on: http://stackoverflow.com/a/25739336
type: AnswerComment
score: 0
type: Comment
has text: Thank you, I was able to fix this by releasing some locks that some program had on the folders.

http://stackoverflow.com/a/25824792
upvote count: 6
downvote count: 1
answers question: http://stackoverflow.com/q/25824764
score: 5
has comment: http://stackoverflow.com/comment/40400259
has body: Instead of if (x == BigInteger.ZERO || x == BigInteger.ONE) { return x; You should use :- if (x.equals(BigInteger.ZERO) || x.equals(BigInteger.ONE)){ return x; Also, you should change the Integer first to BigInteger, and then compare, as mentioned by Joe in his answer: Integer a=3; if(BigInteger.valueOf(a).compareTo(BigInteger.TEN)&lt;0){ // your code... } else{ // your rest code, and so on. }
type: Answer

http://stackoverflow.com/q/25720727
tagged with: file
accepted answer: http://stackoverflow.com/a/25720834
type: Question
upvote count: 6
has answer: http://stackoverflow.com/a/25720834
has body: Why does FileReader and FileWriter use an INT variable to read and write from ? When reading a text file,should this variable not be of type String or char ? Why is it INT?
has title: Why does FileReader and FileWriter use an INT variable to read and write from?
has comment: http://stackoverflow.com/comment/40209317
answer count: 1
favorite count: 0
score: 6
tagged with: filereader
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/q/25760971
has answer: http://stackoverflow.com/a/25761247
tagged with: reference
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/40480
accepted answer: http://stackoverflow.com/a/25761236
type: Question
has comment: http://stackoverflow.com/comment/40283875
tagged with: pointers
has answer: http://stackoverflow.com/a/25761015
score: 0
tagged with: nullpointerexception
answer count: 3
has title: Kind of pointer in Java
has body: I am trying to do the following: import java.util.ArrayList; public class One { private ArrayList&lt;Integer&gt; list; public One() { addString(list); sysoutList(list); } public void sysoutList(ArrayList&lt;Integer&gt; list2) { for (int i = 0; i &lt; list2.size(); i++) { System.out.println(list2.get(i)); } } private void addString(ArrayList&lt;Integer&gt; list2) { list2 = new ArrayList&lt;&gt;(); list2.add(1); list2.add(2); list2.add(3); list2.add(4); } } The problem is, that sysoutList() throws a NullPointerException because list2 is null. It seems, that the initialization of list in addString() has no effects, because the class variable can't be referenced. In C++ I would solve this problem with pointers, but how can I do that in Java?
linked to: http://stackoverflow.com/q/1068760
has answer: http://stackoverflow.com/a/25761236
possible better answer: http://stackoverflow.com/a/25761247
duplicate of: http://stackoverflow.com/q/1068760

http://stackoverflow.com/comment/40313308
comment on: http://stackoverflow.com/q/25776804
has text: Including a small demonstration case, instead of merely explaining it, would be good.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25816570
has comment: http://stackoverflow.com/comment/40385975
type: Question
has answer: http://stackoverflow.com/a/25816758
has comment: http://stackoverflow.com/comment/40385997
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40385950
score: -2
has comment: http://stackoverflow.com/comment/40385983
has comment: http://stackoverflow.com/comment/40386116
downvote count: 2
answer count: 3
has comment: http://stackoverflow.com/comment/40385959
has comment: http://stackoverflow.com/comment/40385954
favorite count: 0
has answer: http://stackoverflow.com/a/25816699
type: UnansweredQuestion
has body: I have a school assignment and for the life of me I cannot figure out why my else statement is not printing out the line I need it to. If user inputs anything other than 1, 2, 3, 4, or 5, I need it to print invalid entry. Here is what I have so far: /** *Proj2.java *This project will be able to ask the user which category they fall in to and then ask how many tickets they want and if they want parking added. It will then calculate the total cost for all tickets, with discounts and parking. */ import java.util.Scanner; import java.text.DecimalFormat; public class Proj2 { public static void main(String[] args) { { Scanner s = new Scanner (System.in); final double general = 80; final double parking = 25; final double alumniDiscount = .1; final double facultyDiscount = .15; final double militaryDiscount = .2; final double studentDiscount = .5; //This declares all the constants for this program int numberOfTickets = 0; int selection = 0; double ticketsPrice = 0; double finalCost = 0; //declares the variables DecimalFormat df = new DecimalFormat("0.00"); System.out.println("\n**Welcome to the KSU Homecoming ticketing app for Fall 2014**"); System.out.println("\t -----Show your Purple Pride!-----\n\n\n"); //this displays the header for the customer System.out.println("Please select from the following categories:\n\n" + "1) Student\n" + "2) Alumni\n" + "3) Faculty &amp; Staff\n" + "4) Military\n" + "5) General Public\n"); //this list out all the options the customer can choose from System.out.print("Selection: "); selection = Integer.parseInt (s.nextLine()); System.out.print("\nPlease enter the number of tickets you would like to purchase: "); numberOfTickets = Integer.parseInt(s.nextLine()); System.out.print("\nWould you like to purchase a parking pass for the game?\n" + "Select Y or N: "); char parkingChoice= (s.nextLine()).charAt(0); //questions for the user to input their answer if (selection == 1) { ticketsPrice = ((general - (general * studentDiscount)) * numberOfTick…
has comment: http://stackoverflow.com/comment/40386144
upvote count: 0
has title: If else statements (beginner)
tagged with: java
has answer: http://stackoverflow.com/a/25816640

http://stackoverflow.com/a/25757200
has body: With the REST API, this is trivially simple... you "pause" by just not sending any more parts, and you "resume" by sending the next part. The "low level API" maps closely to the REST interface, so the functionality should be the same. S3, internally, has no concept of "pausing" a multipart upload. It's just waiting -- indefinitely -- for you to upload more parts and complete the request, or to abort the request. It will store the parts you've sent (with charges for storage) until the entire operation is completed or aborted... and it will literally wait for months (I've seen it... and presumably, it will wait forever) for you to "resume." But there are no low-level calls for pause/resume -- you just do it. The catch is, you have to hold on, locally, to the etags for each part, and you have to send them along with the request to complete the multipart upload. If you never complete or abort a multipart operation, the parts you did send are stored by S3, waiting for your next move. http://docs.aws.amazon.com/AmazonS3/latest/dev/llJavaUploadFile.html
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25756687
type: Answer
downvote count: 0

http://stackoverflow.com/q/25851442
score: 2
has body: Can I open several Mongo connections simultaneously from the same thread, or is it preferable to open just one connection and use it for all my calls?
downvote count: 0
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25851509
upvote count: 2
answer count: 2
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25851548
has title: Can I have multiple simultaneous connections open?
tagged with: mongodb

http://stackoverflow.com/q/25826217
type: AnsweredQuestion
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/25826723
has title: Find and Replace in String ArrayList
has body: public static int preaparePatternForJFugue(ArrayList &lt;String&gt; arrLst) { String contents; for(int loopIndex2=0;loopIndex2&lt;arrLst.size();loopIndex2++) { contents=arrLst.get(loopIndex2); contents=contents.replaceAll(",", "Q"); arrLst.set(loopIndex2, contents); } } Is there any possibility of optimizing the above code? Code is basically for finding and replacing string within the ArrayList of strings. Do we have any provsion to find and replace within ArrayList directly without getting the strings first and then replacing? Of cource, we can combine last 3 lines together as below. But this will only save number of code lines I guess. arrLst.set(loopIndex2, arrLst.get(loopIndex2).replaceAll(",", "Q"));
has answer: http://stackoverflow.com/a/25826289
type: Question
has comment: http://stackoverflow.com/comment/40403392
answer count: 2
has comment: http://stackoverflow.com/comment/40403008
accepted answer: http://stackoverflow.com/a/25826289
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40403189
upvote count: 1
has answer: http://stackoverflow.com/a/25826723
has comment: http://stackoverflow.com/comment/40402952

http://stackoverflow.com/a/25788091
has body: For anyone reading - following this I was able to get this working with Michael Kay's help - my solution is the following: Source source = new StreamSource(new StringReader(myXMLparam)); DocumentInfo docInfo = context.getConfiguration().buildDocument(source); return docInfo;
answers question: http://stackoverflow.com/q/25776647
upvote count: 3
type: Answer
downvote count: 0
score: 3

http://stackoverflow.com/comment/40453258
type: QuestionComment
has text: see my above comment... the max character length is 4000 characters and is meant for normal human pronounceable words not scientific words like those which are 189,819 charcaters long http://en.wikipedia.org/wiki/Longest_word_in_English
score: 0
comment on: http://stackoverflow.com/q/25853393
type: Comment

http://stackoverflow.com/comment/40262486
comment on: http://stackoverflow.com/q/25745790
type: QuestionComment
type: Comment
score: 2
has text: Adding to @PaulD.Waite - look at Muut's post too: https://muut.com/blog/technology/redis-as-primary-datastore-wtf.html

http://stackoverflow.com/q/25847903
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25847987
tagged with: android
type: AnsweredQuestion
has title: SimpleDateFormat parse and format on same date string gives different results
tagged with: java
has body: I've got a simple task, that is, to convert a date that's in this format: "2014-06-13" to this format: "January 6, 2013" I've declared two SimpleDateFormat objects for this: private SimpleDateFormat mInputFormat = new SimpleDateFormat("yyyy-MM-DD", Locale.ENGLISH); private SimpleDateFormat mOutputFormat = new SimpleDateFormat("MMMM d, yyyy", Locale.ENGLISH); So I write the code to do so: Log.v(TAG, "orig: " + releaseDate); try { Date date = mInputFormat.parse(releaseDate); // create a date object using the first pattern Log.v(TAG, "parsed:" + mInputFormat.format(date)); String newDate = mOutputFormat.format(date); // format the date object into the new format Log.v(TAG, newDate); aq.id(R.id.text_2).text(newDate); // sets the date } catch (ParseException e) { e.printStackTrace(); } The thing is, the dates are completely off. Here's what's printed on the logs: 09-15 20:07:49.035: V/TwoLinerListItemView(26700): orig: 2014-06-13 09-15 20:07:49.035: V/TwoLinerListItemView(26700): parsed:2014-01-13 09-15 20:07:49.035: V/TwoLinerListItemView(26700): January 13, 2014 I am so baffled as to why these results are so different. First of all, the original string, 2014-06-13 was parsed into a date object using the input format. Then, I formatted that resulting string using the exact same inputdate format, and then and there the date was changed. It's like you parsed the string "1" then it became the integer 2, then when you made the integer back to a string it became 3. Whut.
type: Question
has answer: http://stackoverflow.com/a/25847987
tagged with: simpledateformat

http://stackoverflow.com/comment/40267383
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25751795
has text: please post the server code too !

http://stackoverflow.com/a/25789670
has body: I managed to save an .eps file. I only needed to add a file path in constructor and it worked. PostscriptTerminal eps = new PostscriptTerminal("output.eps"); PlotStyle myPlotStyle = new PlotStyle(); myPlotStyle.setStyle(Style.POINTS); myPlotStyle.setPointType(7); // 7 - circle myPlotStyle.setLineType(3); // blue color JavaPlot p = new JavaPlot(); p.setPersist(false); p.setTerminal(eps); p.getAxis("x").setLabel("X axis", "Arial", 15); p.getAxis("y").setLabel("Y axis","Arial", 15); p.setKey(JavaPlot.Key.TOP_RIGHT); double[][] front = this.writeObjectivesToMatrix(); DataSetPlot s = new DataSetPlot(front); s.setPlotStyle(myPlotStyle); s.setTitle(""); p.addPlot(s); p.plot();
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25782756
type: Answer
answers question: http://stackoverflow.com/q/25782756
score: 1

http://stackoverflow.com/q/25721558
has comment: http://stackoverflow.com/comment/40210942
favorite count: 0
has comment: http://stackoverflow.com/comment/40211077
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25721812
has title: Not able to create oneToMany relationship in Hibernate
tagged with: spring
has body: I am new to Hibernate and I am trying to understand the oneToMany concept. I have created two entities which are Person and Book. A person can borrow many books and a book can only have one person borrowing it. So I have made the following classes Person.java import java.util.Date; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hibernate.annotations.GenericGenerator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Entity @Table(name="PERSON") public class Person { private static final Logger _logger = LoggerFactory.getLogger(Person.class); @Id @GenericGenerator(name="adder", strategy="increment") @GeneratedValue(generator="adder") @Column(name="PID") private Long id; @Column(name="FIRSTNAME") private String firstName; @Column(name="LASTNAME") private String lastName; @Column(name="BIRTHDATE") @Temporal(TemporalType.DATE) private Date birthDate; //add genre and books @OneToMany(orphanRemoval=true, mappedBy="person", cascade=CascadeType.ALL,targetEntity=Book.class) private Set&lt;Book&gt; listOfBooks = new HashSet&lt;Book&gt;(); public Set&lt;Book&gt; getListOfBooks() { return listOfBooks; } public void setListOfBooks(Set&lt;Book&gt; listOfBooks) { this.listOfBooks = listOfBooks; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public Date getBirthDate() { return birthDate; } public void setBirthDate(Date birthDate) { this.bir…
has comment: http://stackoverflow.com/comment/40211017
tagged with: java
tagged with: hibernate
downvote count: 1
type: Question
upvote count: 0
answer count: 1
score: -1

http://stackoverflow.com/q/25785594
has title: Sorting 2D String Array by date and number in JAVA?
score: 0
answer count: 2
has body: I have a String[][] array with following data. I want to sort this array according to the integer value in column data[][1], according to the date in column data[][2]. Output should be 2D String array. String[][] data = { {"text", "5", "Fri, 04 Feb 2011 13:17:31 GMT"}, {"text", "5", "Fri, 04 Feb 2011 14:24:47 GMT"}, {"text", "8", "Fri, 05 Sep 2014 20:43:57 GMT"}, {"text", "4", "Fri, 08 Nov 2013 16:35:34 GMT"}, {"text", "4", "Fri, 15 Aug 2014 10:00:16 GMT"}, {"text", "4", "Fri, 16 May 2014 15:03:08 GMT"}, {"text", "6", "Fri, 31 Jan 2014 13:12:06 GMT"}, {"text", "4", "Mon, 04 Aug 2014 09:14:36 GMT"}, {"text", "4", "Mon, 08 Sep 2014 03:55:54 GMT"}, {"text", "1", "Mon, 08 Sep 2014 12:53:09 GMT"} };
has comment: http://stackoverflow.com/comment/40328352
has comment: http://stackoverflow.com/comment/40328391
accepted answer: http://stackoverflow.com/a/25788684
possible better answer: http://stackoverflow.com/a/25785640
has answer: http://stackoverflow.com/a/25785640
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25788684

http://stackoverflow.com/comment/40452264
score: 0
comment on: http://stackoverflow.com/a/25852710
type: AnswerComment
type: Comment
has text: Not able to picture it. Probably, by creating a new array?

http://stackoverflow.com/q/25868495
score: 0
has answer: http://stackoverflow.com/a/25870538
has body: I am trying to install JNetPcap and followed the instructions given at here. At step 12, I am unable to run the ant command and i see the error Error: JAVA_HOME is not defined correctly. We cannot execute /usr/lib/jvm/java-6-sun/bin/java As I am able to run Java classes from eclipse or from command line I don't think if it's a problem with JAVA_HOME. echo $PATH shows /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/lib/jvm/java-6-sun/bin Kindly let me know if am missing something here. thanks in advance
type: AnsweredQuestion
tagged with: jnetpcap
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25870538
answer count: 1
has title: jnetpcap library unable to build on ubuntu 12.04
tagged with: ubuntu

http://stackoverflow.com/q/25847343
tagged with: java
has answer: http://stackoverflow.com/a/38127700
has comment: http://stackoverflow.com/comment/40441342
type: Question
tagged with: cucumber
score: 5
answer count: 7
favorite count: 0
has answer: http://stackoverflow.com/a/56215935
tagged with: cucumber-jvm
possible better answer: http://stackoverflow.com/a/38575305
tagged with: exception
has answer: http://stackoverflow.com/a/47895115
has title: Cant run feature in Cucumber
has answer: http://stackoverflow.com/a/38575305
has body: Im having issues running a feature in Cucumber, the feature is very basic as it's from a tutorial. It is not defined and is as follows: Feature: Proof that my concept works Scenario: My first test Given this is my first step When this is my second step Then this is my final step My Cucumber runner class is as follows: package cucumber; import org.junit.runner.RunWith; import cucumber.api.junit.Cucumber; @RunWith(Cucumber.class) @Cucumber.Options( format = {"pretty", "json:target/"}, features = {"src/cucumber/"} ) public class CucumberRunner { } Also the external .jar files that I have in the project are as follows: The exception that I'm getting is: Exception in thread "main" cucumber.runtime.CucumberException: Failed to instantiate public cucumber.runtime.java.JavaBackend(cucumber.runtime.io.ResourceLoader) with [cucumber.runtime.io.MultiLoader@75d837b6] I've tried to look around online for the solution to this problem but have not had any luck. I've also discussed with the OP of the tutorial and I'm still awaiting feedback but it has been a while.
has answer: http://stackoverflow.com/a/60641054
upvote count: 5
downvote count: 0
accepted answer: http://stackoverflow.com/a/28387412
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/56218434
has answer: http://stackoverflow.com/a/28387412

http://stackoverflow.com/q/25869388
tagged with: hql
type: Question
has answer: http://stackoverflow.com/a/25878919
has comment: http://stackoverflow.com/comment/42845509
has comment: http://stackoverflow.com/comment/40481512
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25869476
has body: I have following hql query, from Channe where ip='1.11.6.0'; But in the db the IP is saving as 1.11.6.0:8080 . So I need to modify the query in a way that, split the ip with a delimiter ':' and take the firstcome value. I do not wish to modify the search with value 1.11.6.0:8080.
has answer: http://stackoverflow.com/a/25869712
has title: String split function with hql
type: UnansweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/40194471
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25712896
score: 1
has text: Although you've written `Sub2.instantiate();`, Java is actually calling `Sub1.instantiate();` The call to `instantiate()` has no concept of _caller_ or _calling class_.

http://stackoverflow.com/comment/40205424
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25718379
has text: Thanks. But why when I change the all values `HashMap` into AllItem and do the search I got nothing?
score: 0

http://stackoverflow.com/q/25852152
tagged with: rest
has answer: http://stackoverflow.com/a/78654309
answer count: 5
upvote count: 29
has body: Below is a stacktrace I get when my rest service tries to fetch a large data set (database and tomcat are on my local machine, so everything is local). It works on smaller ones, but in some cases user wants a lot of data. I checked similar problems posted here, but there seems to be none like mine. My questions are 1. Why does it fail to display a response? 2. Is response size limited somehow on tomcat? Maybe there is a timeout or something like that? 3. Maybe it is Jackson that fails to do its job. If it is Jackson - can it be caused by annotations like @JsonBackReference and @JsonManagedReference? 4. What can I do to fix it? ClientAbortException: java.io.IOException: An established connection was aborted by the software in your host machine at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:413) at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:480) at org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:366) at org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:438) at org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:426) at org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:91) at com.fasterxml.jackson.core.json.UTF8JsonGenerator._flushBuffer(UTF8JsonGenerator.java:1862) at com.fasterxml.jackson.core.json.UTF8JsonGenerator._writeBytes(UTF8JsonGenerator.java:1132) at com.fasterxml.jackson.core.json.UTF8JsonGenerator._writeFieldName(UTF8JsonGenerator.java:270) at com.fasterxml.jackson.core.json.UTF8JsonGenerator.writeFieldName(UTF8JsonGenerator.java:249) at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:539) at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:644) at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:152) at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serializeContents(CollectionSerializer.ja…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40482138
has answer: http://stackoverflow.com/a/77478673
has answer: http://stackoverflow.com/a/25872295
score: 29
type: Question
has answer: http://stackoverflow.com/a/71039896
tagged with: java
tagged with: servlets
possible better answer: http://stackoverflow.com/a/58516839
accepted answer: http://stackoverflow.com/a/25872295
has answer: http://stackoverflow.com/a/58516839
downvote count: 0
tagged with: jackson
tagged with: tomcat
favorite count: 0
has title: An established connection was aborted by the software in your host machine tomcat jackson

http://stackoverflow.com/comment/40223553
comment on: http://stackoverflow.com/q/25728280
score: 0
type: Comment
type: QuestionComment
has text: If you read a file instead a folder, you could use `BufferedInputStream` and `BufferedOutputStream` to multiple destinations

http://stackoverflow.com/a/25758005
upvote count: 0
answers question: http://stackoverflow.com/q/25757918
score: -1
downvote count: 1
type: Answer
has body: To me it looks like the outer loop while(A) would either be done not at all or forever since it appears the A never changes inside of it.

http://stackoverflow.com/q/25715018
linked to: http://stackoverflow.com/q/6366211
has title: What guarantees does Java/Scala make about garbage collection?
type: Question
tagged with: java
score: 4
upvote count: 4
has answer: http://stackoverflow.com/a/25715110
answer count: 2
has comment: http://stackoverflow.com/comment/40198863
downvote count: 0
favorite count: 0
has body: The Play framework has play.api.libs.Files.TemporaryFile that holds a reference to a File, and deletes it in the TemporaryFile#finalize(). case class TemporaryFile(file: File) { def clean(): Boolean = { file.delete() } def moveTo(to: File, replace: Boolean = false) { Files.moveFile(file, to, replace = replace) } override def finalize { clean() } } I know that there are some issues with this, for example, you could fill up the entire disk without the JVM feeling the need to GC. But here I ask about the "correctness" of a program, i.e. a program with no limit on disk space. def foo() { val tempFile = TemporaryFile(new File("/tmp/foo")) val inputStream = new FileInputStream(tempFile.file) // last use try { println(inputStream.read()) } finally { inputStream.close() } } Could /foo/bar be deleted before I've read from the file? I don't use tempFile after // last use, so could it be finalized immediately after that? Or what if it is passed as an argument to a function? def foo() { val tempFile = TemporaryFile(new File("/tmp/foo")) bar(tempFile) } def bar(tempFile: TemporaryFile) { val inputStream = new FileInputStream(tempFile.file) // last use try { println(inputStream.read()) } finally { inputStream.close() } } If in the example above, tempFile may be removed before I am done using it, what is the correct use of TemporaryFile so that this does not happen?
linked to: http://stackoverflow.com/q/9809074
accepted answer: http://stackoverflow.com/a/25715110
possible better answer: http://stackoverflow.com/a/25715057
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25715057
has comment: http://stackoverflow.com/comment/44249170
tagged with: playframework-2.3
tagged with: scala
has comment: http://stackoverflow.com/comment/40198759
tagged with: garbage-collection

http://stackoverflow.com/q/25736302
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40239074
type: Question
tagged with: dropbox
answer count: 1
has body: I just try to extract content from dropbox files without download files from dropbox.please give any idea for how to extract content from dropbox files without download that.I used dropbox-core-sdk api.
has answer: http://stackoverflow.com/a/25736423
type: UnansweredQuestion
has title: how to extract only content from dropbox without downloading files from dropbox

http://stackoverflow.com/comment/40220665
comment on: http://stackoverflow.com/q/25726829
score: 0
type: Comment
has text: how do you know the OS killed your service?
type: QuestionComment

http://stackoverflow.com/comment/40236245
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25734828
has text: when removed the result is still the same, an array with zeros at the end
score: 0

http://stackoverflow.com/a/25725179
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40218100
upvote count: 5
has body: The problem you have is that whereas a mouse click is a compound event, a touch on the screen is not. So there's no way that it can go down at the first event and up again at the second. But what you can do, when you receive a touch event, is change the visual state of the button so it looks depressed (using setPressed(true)), then set a timer for 100ms or so, and set the state back to normal when the timer expires (using setPressed(false)). Careful with the timer expiration: you need the setPressed(false) to happen on the UI thread. So you'll need to use SwingUtilities.invokeLater() as a wrapper round the second call to setPressed. Or, alternatively, use a javax.swing.Timer as the means of queueing the second call; it takes a delay and an Action, and the Action gets performed on the UI thread.
type: Answer
has comment: http://stackoverflow.com/comment/40218214
downvote count: 0
score: 5
accepted answer of: http://stackoverflow.com/q/25725014
answers question: http://stackoverflow.com/q/25725014

http://stackoverflow.com/q/25841575
type: Question
has comment: http://stackoverflow.com/comment/40431484
score: 0
tagged with: file-io
answer count: 1
tagged with: string
has answer: http://stackoverflow.com/a/25841708
accepted answer: http://stackoverflow.com/a/25841708
has title: How to write a specific data in file in JAVA
type: AnsweredQuestion
has body: I am trying to read a file then to write specific data from that file. The data i am trying to write only points and split all other data,ie: 224.99267,147.13839 and -0.318,1.03 -0.347,1.621 -1.458,2.069 -0.616,0.249 -1.188,0.442 -1.808,0.677 -1.297,0.49 -2.719,0.723 -4.1,0.738 l 0,0 How to extract the specific data using BufferedReader and BufferedWriter classes . The file is SVG format : &lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt; &lt;svg&gt; &lt;g inkscape:groupmode="layer" id="layer1" inkscape:label="Layer" sodipodi:insensitive="true"&gt; &lt;path inkscape:connector-curvature="0" style="fill:#000000" d="m 185.81799,189.19002 c -0.318,1.03 -0.347,1.621 -1.458,2.069 -0.616,0.249 -1.188,0.442 -1.808,0.677 -1.297,0.49 -2.719,0.723 -4.1,0.738 l 0,0 z" id="path1" /&gt; &lt;/g&gt; &lt;g id="layer2" inkscape:label="m t" transform="translate(-63.291749,38.902944)" style="opacity:1"&gt; &lt;path inkscape:connector-curvature="0" style="fill:#00aaff;fill-opacity:1;stroke:none" d="m 224.99267,147.13839 c 0.058,-2.71786 -4.53925,-2.92466 -6.34648,-2.40667 -1.89481,0.52556 -2.64752,1.47594 -3.33393,3.65252 -0.19989,0.60287 -0.23084,1.0276 0.49629,0.59313 z" id="path2"/&gt; &lt;/g&gt; &lt;/svg&gt; The code i tried : BufferedReader bufferedReader = null; BufferedWriter bufferedWriter = null; public void RWFile(){ try { bufferedReader = new BufferedReader(new FileReader("Out\\read.svg")); bufferedWriter = new BufferedWriter(new FileWriter("Out\\write.svg")); String verify; Sting strSplite; while ((verify = bufferedReader.readLine()) != null) { //strSplite=verify.split(verify); bufferedWriter.write(strSplit); bufferedWriter.newLine(); } bufferedReader.close(); bufferedWriter.close(); System.out.println("Copying has done"); }catch(FileNotFoundException e) { System.out.println(e); }catch(IOException e) { System.out.println(e); } }
tagged with: java

database-migration
tags question: http://stackoverflow.com/q/25806087
tag name: database-migration
type: Tag

http://stackoverflow.com/comment/40315914
score: 0
comment on: http://stackoverflow.com/q/25778159
type: QuestionComment
type: Comment
has text: yes they prints the same. i call it by run() method but when i tried the start() method, it works just the same.

http://stackoverflow.com/a/25863681
upvote count: 0
has body: If you want to do something repeatedly, you should do it in sepparate thread. See this example: int initialDelay = 30000; // start after 30 seconds int period = 5000; // repeat every 5 seconds Timer timer = new Timer(); TimerTask task = new TimerTask() { public void run() { // job code here } }; timer.scheduleAtFixedRate(task, initialDelay, period); Source
answers question: http://stackoverflow.com/q/25863575
downvote count: 2
score: -2
type: Answer

http://stackoverflow.com/a/25771934
has comment: http://stackoverflow.com/comment/40827989
answers question: http://stackoverflow.com/q/25771677
score: 0
has body: Ok let me see if I understand, you have the MainActivity and 2 fragments A and B. When someting in your MainActivity fires the transaction, you want to hide fragment B, and show fragment A. But also, transfer some info that lives in fragment B to fragment A, am I right? Then, I understood you already have the info in MainActivity that you transfered from B using an interface (which is the correct way to do it). Now you can't pass that info to fragment A. Before commit the transaction, you had to instantiate the fragment A, so after commit you can just call a public method in A to send your info, right? If that's not working it's because may be you're trying to send it before it exists on screen. Anyway, try to share some code, to figure out what happens.
accepted answer of: http://stackoverflow.com/q/25771677
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40299125
has text: Thank you for your answer and you are correct. I've added `String h = new StringBuilder(g).append(a).toString();` after compilation and decompilation it looked like `String str6 = str5 + paramString1;`
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25769023

http://stackoverflow.com/comment/40319074
comment on: http://stackoverflow.com/a/25779894
has text: ok I got an option to create environment variables in installer. but that did not create any variable, I have checked. any idea?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40430231
has text: `a1` shouldn't have a `k()` method, at compile time it's type is `A` correct? Also `x` from the `C` class is probably overriding the `x` from both `A` and `B`.
score: 0
comment on: http://stackoverflow.com/q/25840826
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25716498
downvote count: 0
answers question: http://stackoverflow.com/q/25716440
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/40201733
score: 2
has body: If I understand you correctly, I recommend a do-while loop. It will first take text the first time, perform an action, and if it is exit it will break the loop, otherwise it will repeat. do{ text = input.nextLine(); //whatever code you want here to perform with input }while(!(text.equals("exit"));

http://stackoverflow.com/comment/40353218
comment on: http://stackoverflow.com/q/25798566
score: 0
has text: No, no exceptions. I am reading my log to get the Serial Number of a revoked certificate and to get the response `Was not revoked`, which is caused by the returned null. Unless I am not catching some and they go unnoticed.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/76813025
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/44909164
has text: I didn't hear that. And I should know, I am a PDFBox committer.

http://stackoverflow.com/a/25804229
answers question: http://stackoverflow.com/q/25803521
has body: I'd use a Set to discard duplicates and make it a TreeSet so it does all of the sorting itself. public static Integer[] kSmallest(Integer[] a, int k) { // Use a TreeSet to keep tbhe smallest. TreeSet&lt;Integer&gt; kSmallest = new TreeSet&lt;Integer&gt;(); // Fold all the array into the set. for (Integer x : a) { // Add it in. kSmallest.add(x); // Trim to k. if (kSmallest.size() &gt; k) { Iterator&lt;Integer&gt; last = kSmallest.descendingIterator(); // Select the biggest. last.next(); // Remove it. last.remove(); } } // Make my result. return kSmallest.toArray(new Integer[0]); }
score: 0
type: Answer

http://stackoverflow.com/q/25792962
has answer: http://stackoverflow.com/a/25792998
tagged with: user-interface
favorite count: 0
has body: I have JFrame with different components like buttons and labels. I want my labels to auto adjust its height when screen resolution changes. I mostly work with NetBeans GUI components (drag and drop). When the height resolution increases then every component height increases like this Is there any way of doing so with some kind of layout etc or I have to manually get screen resolution and then repaint each component? I am not a really manually coding for each component because mostly I just drag and drop in NetBeans.
has title: Auto adjust component size in java
score: 2
type: AnsweredQuestion
tagged with: netbeans
accepted answer: http://stackoverflow.com/a/25792998
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/25794105
tagged with: swing
has answer: http://stackoverflow.com/a/25794105
downvote count: 1
type: Question
answer count: 2

http://stackoverflow.com/comment/40239121
type: Comment
type: QuestionComment
has text: @MrunalGosar I'm not sure what you are asking. To reproduce exactly you would need the device and access to code which isn't available for release yet. I can certainly include more if people feel it is relevant or necessary but so far it has not been indicated.
score: 0
comment on: http://stackoverflow.com/q/25712912

http://stackoverflow.com/comment/40467434
has text: I am reading 3 words at a time and put(ing) the value in map as follows: This is line| is line one| line one This| one This is| This is line
comment on: http://stackoverflow.com/q/25861296
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25838213
has body: &lt;bean&gt; declaration &lt;property&gt; elements work on setters not fields. The &lt;property&gt; names you've declared are actually for properties that DriverManagerDataSource inherited from AbstractDriverBasedDataSource, its direct parent class.
answers question: http://stackoverflow.com/q/25837944
type: Answer
score: 0

http://stackoverflow.com/q/25748719
score: 1
favorite count: 0
has answer: http://stackoverflow.com/a/61287453
has body: Using Spring Integration and I have a json string (see below) and the following code: public SomethingBean convert(Message&lt;?&gt; inMessage) {...} Json string { "addressIdentification": { "identifierType": "nemtom", "addressIdentifier": "eztse" }, "postcode": "BH1EH", "country": "5" } I'd like to use the following method signature: public SomethingBean convert(Message&lt;Map&lt;String, ?&gt;&gt; inMessage) {...} Is it possible to convert the json string to Map automatically? Thanks, V.
has answer: http://stackoverflow.com/a/25748882
upvote count: 1
has title: spring messaging converting json string to map
tagged with: spring
type: AnsweredQuestion
tagged with: spring-integration
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/25748829
accepted answer: http://stackoverflow.com/a/25748882
type: Question
has answer: http://stackoverflow.com/a/25748829
answer count: 3
downvote count: 0

http://stackoverflow.com/q/25808115
tagged with: google-contacts-api
score: 2
tagged with: guava
linked to: http://stackoverflow.com/q/16475015
tagged with: java
has answer: http://stackoverflow.com/a/25809612
type: Question
has comment: http://stackoverflow.com/comment/40369836
answer count: 2
tagged with: gdata
has answer: http://stackoverflow.com/a/25832577
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/3937195
upvote count: 2
type: UnansweredQuestion
has title: Google Contacts - java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.of([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet;
has comment: http://stackoverflow.com/comment/40369513
has body: POM.xml : <?xml version="1.0"?> 4.0.0 **** **** 1.0 com.web web war web http://maven.apache.org <dependencies> dependency> com.google.code.gson gson 2.2.2 DB Connection Pooling --> commons-dbcp commons-dbcp 1.4 mysql mysql-connector-java ${mysql.connector.version} org.springframework spring-webmvc ${spring.version} org.springframework spring-tx ${spring.version} org.springframework spring-jdbc ${spring.version} org.springframework spring-orm ${spring.version} javax.validation validation-api 1.1.0.Final org.hibernate hibernate-validator 5.1.0.Final org.slf4j slf4j-api org.apache.tiles tiles-extras ${tiles-version} org.codehaus.jackson jackson-mapper-asl ${jackson.version} cglib cglib 2.2.2 javax.servlet javax.servlet-api 3.0.1 compile jstl jstl 1.2 org.slf4j slf4j-log4j12 1.5.6 log4j log4j 1.2.17 junit junit 4.7 test org.springframework spring-test ${spring.version} test common my-common 1.0 service my-service 1.0 dao my-dao 1.0 model my-model 1.0 org.apache.velocity velocity 1.6.2 commons-fileupload commons-fileupload ${commons-fileupload} commons-io commons-io ${commons-io} net.tanesha.recaptcha4j recaptcha4j ${recapchta.version} com.google.gdata core 1.47.1 org.openengsb.wrapped com.google.gdata-contacts 1.41.5.w1 <dependencies> And I am getting an exception when I am trying following piece of code : private ContactsService authenticateId(String userid, String password) { ContactsService contactService = null; try { contactService = new ContactsService("exampleCo-exampleApp-1"); contactService.setUserCredentials(userid, password); } catch (Exception e) { System.out.println(e); } return contactService; } exception : java.lang.NoSuchMethodError: com.google.common.collect.ImmutableSet.of([Ljava/lang/Object;)Lcom/google/common/collect/ImmutableSet; at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableTypes(AltFormat.java:399) at com.google.gdata.wireformats.AltFormat$Builder.setAcceptableXmlTypes(AltFormat.java:387) at com.google.gdata.wireformats.AltFormat.…

http://stackoverflow.com/comment/40434670
type: Comment
has text: And FileNotFoundException occures only when i run the jar file.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25842817

http://stackoverflow.com/comment/40474298
type: AnswerComment
has text: @0xbe5077ed: yes, you can do it this way.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25859673

http://stackoverflow.com/q/25741012
score: 0
tagged with: java
has title: How reuse class parameter in case classes?
type: Question
tagged with: sbt
tagged with: intellij-idea
answer count: 3
has body: I have one entity class like that: case class Entity(id: Integer, name: String) And class command code: trait GeneralCommand { val id: Option[Integer] } sealed abstract class EntityCommands(id: Option[Integer]) extends DomainCommand { def this(id: Integer) = this(Option(id)) } case class UpdateEntity(entity: Entity, id: Integer = entity.id) extends EntityCommands(id) In Intellij Idea this code is not highlighted. But sbt clean compile complains that: not found: value entity case class UpdateEntity(entity: Entity, id: Integer = entity.id) extends EntityCommands(id) ^ Is it possible to reuse parameter in case class in scala?
has answer: http://stackoverflow.com/a/25742294
tagged with: scala
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25741070
has answer: http://stackoverflow.com/a/25741134
tagged with: case-class

http://stackoverflow.com/a/25750382
has body: You should use for(i = 0; i &lt; 100; i++) instead of for(i = 0; i &gt; 100; i++) else it would end as soon as it starts since you are checking i &gt; 100
answers question: http://stackoverflow.com/q/25750327
type: Answer
upvote count: 1
downvote count: 1
score: 0

http://stackoverflow.com/a/25857907
has body: Since you are using the file name without a path, the file you creates ends in the CWD. That is the Current working directory the process inherits from the OS. That is is you execute your jar file from the Desktop directory any files that use relative paths will end in the Desktop or any of it sub directories. To control the absolute location of the file you must use absolute paths. An absolute path always starts with a slash '/'. Absolute path: /etc/config.properties Relative path: sub_dir/config.properties The simplest way is to hard code some path into the file path string. output = new FileOutputStream("/etc/config.properties"); You can of course setup the path in a property which you can pass using the command line instead of hard coding it. The you concat the path name and the file name together. String path = "/etc"; String full_path = "/etc" + "/" + "config.properties"; output = new FileOutputStream(full_path); Please note that windows paths in java use a forward slash instead of back slash. Check this for more details file path Windows format to java format
answers question: http://stackoverflow.com/q/25856919
type: Answer
score: 0

http://stackoverflow.com/a/25850909
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25826837
type: Answer
accepted answer of: http://stackoverflow.com/q/25826837
score: 0
has body: A working solution to working with a free-flight camera with eye, center, up vectors was posted here: Free Flight Camera - strange rotation around X-axis

jdbc
tags question: http://stackoverflow.com/q/25754432
tags question: http://stackoverflow.com/q/25751434
tags question: http://stackoverflow.com/q/25853666
tags question: http://stackoverflow.com/q/25812633
tags question: http://stackoverflow.com/q/25729686
tags question: http://stackoverflow.com/q/25732088
tags question: http://stackoverflow.com/q/25852915
tags question: http://stackoverflow.com/q/25856532
tags question: http://stackoverflow.com/q/25821420
tags question: http://stackoverflow.com/q/25754488
tags question: http://stackoverflow.com/q/25869252
tags question: http://stackoverflow.com/q/25848652
tags question: http://stackoverflow.com/q/25847779
tags question: http://stackoverflow.com/q/25718590
tags question: http://stackoverflow.com/q/25745532
tags question: http://stackoverflow.com/q/25749978
tags question: http://stackoverflow.com/q/25861862
tags question: http://stackoverflow.com/q/25796392
tags question: http://stackoverflow.com/q/25845643
tags question: http://stackoverflow.com/q/25769765
tags question: http://stackoverflow.com/q/25855529
type: Tag
tags question: http://stackoverflow.com/q/25736574
tags question: http://stackoverflow.com/q/25822359
tags question: http://stackoverflow.com/q/25771925
tags question: http://stackoverflow.com/q/25767784
tags question: http://stackoverflow.com/q/25864054
tags question: http://stackoverflow.com/q/25722939
tags question: http://stackoverflow.com/q/25745693
tags question: http://stackoverflow.com/q/25832218
tags question: http://stackoverflow.com/q/25721664
tags question: http://stackoverflow.com/q/25738472
tags question: http://stackoverflow.com/q/25842172
tags question: http://stackoverflow.com/q/25779593
tags question: http://stackoverflow.com/q/25758436
tags question: http://stackoverflow.com/q/25771738
tags question: http://stackoverflow.com/q/25814849
tags question: http://stackoverflow.com/q/25763535
tags question: http://stackoverflow.com/q/25850569
tags question: http://stackoverflow.com/q/25803018
tags question: http://stackoverflow.com/q/25789117
tags question: http://stackoverflow.com/q/25824148
tags question: http://stackoverflow.com/q/25814556
tags question: http://stackoverflow.com/q/25857568
tags question: http://stackoverflow.com/q/25735470
tags question: http://stackoverflow.com/q/25793256
tags question: http://stackoverflow.com/q/25871629
tags question: http://stackoverflow.com/q/25764379
tags question: http://stackoverflow.com/q/25727099
tags question: http://stackoverflow.com/q/25722611
tags question: http://stackoverflow.com/q/25785687
tags question: http://stackoverflow.com/q/25859509
tags question: http://stackoverflow.com/q/25779623
tags question: http://stackoverflow.com/q/25808849
tag name: jdbc
tags question: http://stackoverflow.com/q/25770690
tags question: http://stackoverflow.com/q/25743090
tags question: http://stackoverflow.com/q/25785956
tags question: http://stackoverflow.com/q/25721818
tags question: http://stackoverflow.com/q/25715586
tags question: http://stackoverflow.com/q/25753542
tags question: http://stackoverflow.com/q/25730278
tags question: http://stackoverflow.com/q/25733258
tags question: http://stackoverflow.com/q/25819496

http://stackoverflow.com/q/25862093
has comment: http://stackoverflow.com/comment/40475069
type: Question
has comment: http://stackoverflow.com/comment/40468784
possible better answer: http://stackoverflow.com/a/25866060
has title: Why I can not open android manifest class in eclipse?
has comment: http://stackoverflow.com/comment/40468968
has answer: http://stackoverflow.com/a/25866060
answer count: 2
has comment: http://stackoverflow.com/comment/40477082
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40475372
has comment: http://stackoverflow.com/comment/40468936
tagged with: android
has comment: http://stackoverflow.com/comment/40468879
has answer: http://stackoverflow.com/a/25873342
type: AnsweredQuestion
has body: In eclipse, if you press CTRL and click the method name, you can open declaration or implementation of this method. I want to use this idea to navigate to a class in android manifest.xml. All other Activity or Service work just fine, but only Receiver does not. see code below <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> I checked if the path was right, the class exists in that path, so why can't I click to open that class? Anyone can help?
score: 3
has comment: http://stackoverflow.com/comment/40475355
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25873342
has comment: http://stackoverflow.com/comment/40468661
tagged with: eclipse

http://stackoverflow.com/q/25747769
has comment: http://stackoverflow.com/comment/40259652
has comment: http://stackoverflow.com/comment/40260775
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40260018
score: -1
type: Question
has comment: http://stackoverflow.com/comment/40259845
tagged with: casting
has comment: http://stackoverflow.com/comment/40260412
has answer: http://stackoverflow.com/a/25748768
tagged with: arrays
has comment: http://stackoverflow.com/comment/40260961
has title: type casting a String to Object[][]
accepted answer: http://stackoverflow.com/a/25748768
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/40259744
has comment: http://stackoverflow.com/comment/40259714
favorite count: 0
has comment: http://stackoverflow.com/comment/40259964
has body: I would like to convert below String to simple two dimensional array (Object[][]). String personArray ="{{Melroy,25,India},{Jack,26,USA}}"; // nothing but a simple string with appearance of a 2D array Can this be done in the first place? If so what is the simplest way? Any help any inputs will be greatly appreciated.
downvote count: 2
has comment: http://stackoverflow.com/comment/40259849
upvote count: 1
has comment: http://stackoverflow.com/comment/40259688

http://stackoverflow.com/comment/47011156
score: 0
type: Comment
type: QuestionComment
has text: When I use this mapping configuration, Hibernate always gets an error of "Repeated column in mapping for entity", however I'm using the updatable/insertable as you did. Shouldn't that be enough?
comment on: http://stackoverflow.com/q/25774309

http://stackoverflow.com/comment/40642981
comment on: http://stackoverflow.com/a/25748254
has text: May I ask question about threading and JaveEnv in android jni : http://stackoverflow.com/questions/25958854/android-jni-crash-in-global-and-local-ref-variables
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/103698275
comment on: http://stackoverflow.com/q/25813357
type: Comment
type: QuestionComment
has text: I had the same problem and adding jaxen as a maven dependency solved my problem
score: 0

http://stackoverflow.com/q/25763121
has comment: http://stackoverflow.com/comment/40287622
answer count: 0
has comment: http://stackoverflow.com/comment/40287489
tagged with: java
type: Question
score: 0
has title: Screenshot is saving to SD card but is just black pixels
has comment: http://stackoverflow.com/comment/40287703
has comment: http://stackoverflow.com/comment/40287538
has body: I am trying to grab a screenshot and save to the SD card. The file is created and is about15kb but is just a rectangle of black. Any idea where I am going wrong? The following code is called inside my surfaceview class. w &amp; h were previously saved. String mPath = Environment.getExternalStorageDirectory().toString() + "/" + "test.jpg"; this.setDrawingCacheEnabled(true); Bitmap bitmap = Bitmap.createBitmap(w,h, Config.RGB_565); Canvas canvas = new Canvas(bitmap); this.draw(canvas); OutputStream fout = null; File imageFile; imageFile = new File(mPath); try { fout = new FileOutputStream(imageFile); bitmap.compress(Bitmap.CompressFormat.JPEG, 0, fout); fout.flush(); fout.close(); }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40287667
tagged with: android
has comment: http://stackoverflow.com/comment/40288387

http://stackoverflow.com/a/26446566
answers question: http://stackoverflow.com/q/25719667
type: Answer
has body: I was able to get a reference to ServiceLocator by registering a ContainerLifecycleListener. In the onStartup(Container container) method, call container.getApplicationHandler().getServiceLocator(). This example stores the reference as a member variable of ResourceConfig which you can use elsewhere via an accessor. class MyResourceConfig extends ResourceConfig { // won't be initialized until onStartup() ServiceLocator serviceLocator; public MyResourceConfig() { register(new ContainerLifecycleListener() { public void onStartup(Container container) { // access the ServiceLocator here serviceLocator = container.getApplicationHandler().getServiceLocator(); // ... do what you need with ServiceLocator ... MyService service = serviceLocator.createAndInitialize(MyService.class); } public void onReload(Container container) {/*...*/} public void onShutdown(Container container) {/*...*/} }); } public ServiceLocator getServiceLocator() { return serviceLocator; } } then elsewhere: MyService service = myResourceConfig.getServiceLocator().createAndInitialize(MyService.class);
score: 16
accepted answer of: http://stackoverflow.com/q/25719667
upvote count: 16
has comment: http://stackoverflow.com/comment/92943335
has comment: http://stackoverflow.com/comment/92912207
has comment: http://stackoverflow.com/comment/83336478
has comment: http://stackoverflow.com/comment/56051309
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/61909545
has comment: http://stackoverflow.com/comment/92913167

http://stackoverflow.com/a/25803654
has comment: http://stackoverflow.com/comment/40369463
has comment: http://stackoverflow.com/comment/40370041
has body: You can get controller instance from FXMLLoader. Refactor your code like so: @Override public void start(Stage stage) throws Exception { FXMLLoader loader = new FXMLLoader(getClass().getResource("FXMLDocument.fxml")); // Use loader instance Parent root = loader.load(); FXMLDocumentController controller = loader.getController(); // Now you have controller refference here //add your listener, feel free to use your controller inside listener implementation }
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25802926
answers question: http://stackoverflow.com/q/25802926
score: 1
has comment: http://stackoverflow.com/comment/40370210
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40370147
has comment: http://stackoverflow.com/comment/40370268

http://stackoverflow.com/comment/40364452
score: 0
comment on: http://stackoverflow.com/q/25805113
type: Comment
type: QuestionComment
has text: Can confirm this on Windows too (should be equal on all OS due to Java). As it says "Save all files and settings", this might be wanted behavior.

http://stackoverflow.com/q/25822359
favorite count: 0
linked to: http://stackoverflow.com/q/5484227
tagged with: singleton
has comment: http://stackoverflow.com/comment/41041272
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40396230
has comment: http://stackoverflow.com/comment/40396311
has body: I am trying to implement a ConnectionFactory using Enum Singleton and hitting a strange problem with loading the DB driver (Class.forName). Now, I know, Singleton is a controversial pattern and not everybody likes it, and yeah, I am not a big fan too. But this is for illustration purpose only. Here is my main code: public class HelloWorld { public static void main(String[] args) { ConnectionFactory.getConnection(); } } And the ConnectionFactory: public enum ConnectionFactory { INSTANCE; // Database details private static final String JDBC_DRIVER_PARAM="org.h2.Driver"; private static final String DB_URL_PARAM="jdbc:h2:file:./h2database/homedb"; private static final String DB_USER_PARAM="admin"; private static final String DB_PASS_PARAM="pass"; private ConnectionFactory() { try { Class.forName(JDBC_DRIVER_PARAM); System.out.println("Driver Loaded!"); } catch (ClassNotFoundException e) { System.out.println(e); } } private Connection createConnection() { Connection conn = null; try{ conn = DriverManager.getConnection(DB_URL_PARAM, DB_USER_PARAM, DB_PASS_PARAM); }catch (Exception e) { System.out.println(e); } return conn; } //public method to obtain connection public static Connection getConnection() { return INSTANCE.createConnection(); } } And here is the output: java.lang.ClassNotFoundException: org.h2.Driver Though, below works fine - so it is definitely not a classpath issue. I am running both approaches from Eclipse and it is the same maven project, so no issue with dependencies. public class HelloWorld { public static void main(String[] a) throws Exception { Class.forName("org.h2.Driver"); Connection conn = DriverManager.getConnection("jdbc:h2:file:./h2database/homedb", "admin", "pass"); System.out.println("Connected"); conn.close(); } } And here is the output: Connected The only real difference I can see between the 2 approaches is the use of Enum Singleton. So my question: Is there something specific going on when I use Class.forName() from Enum Constructor? I t…
has comment: http://stackoverflow.com/comment/40396703
has comment: http://stackoverflow.com/comment/40396063
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/40396294
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40396602
tagged with: java
has comment: http://stackoverflow.com/comment/40397032
type: Question
tagged with: enums
has comment: http://stackoverflow.com/comment/40396377
has comment: http://stackoverflow.com/comment/40396190
has comment: http://stackoverflow.com/comment/40397075
has comment: http://stackoverflow.com/comment/40396407
has comment: http://stackoverflow.com/comment/40396497
has title: Class.forName in Enum Singleton constructor
upvote count: 1
has comment: http://stackoverflow.com/comment/40396507
has comment: http://stackoverflow.com/comment/40397205

http://stackoverflow.com/a/25779262
has body: I think you are missing something in your app. The page you are referring is just a guide to help understand how the framework works. For complete simple examples, please refer to: https://github.com/javalite/activeweb-bootstrap - this is a simple app with Bootstrap and no database support https://github.com/javalite/activeweb-lessc - simple app without database, but with Less instead of CSS https://github.com/javalite/activeweb-simple - simple ActiveWeb + ActiveJDBC webapp (CRUD) Here is the Getting Started page: http://javalite.io/getting_started_activeweb hope it helps
has comment: http://stackoverflow.com/comment/40329029
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25776191
has comment: http://stackoverflow.com/comment/40356633

identifier
tag name: identifier
type: Tag
tags question: http://stackoverflow.com/q/25731767

http://stackoverflow.com/comment/40282398
type: AnswerComment
type: Comment
has text: I'm sorry sir. i'm develop you update code to http://paste.debian.net/120158/ . but thats wrong and return `NullPointerException`.
comment on: http://stackoverflow.com/a/25759586
score: 0

contextmenu
tags question: http://stackoverflow.com/q/25813170
tag name: contextmenu
tags question: http://stackoverflow.com/q/25731356
type: Tag

http://stackoverflow.com/comment/40438336
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25844873
has text: But yes, you got it.

http://stackoverflow.com/q/25768865
has answer: http://stackoverflow.com/a/25768949
accepted answer: http://stackoverflow.com/a/25768955
favorite count: 0
possible better answer: http://stackoverflow.com/a/25768949
type: AnsweredQuestion
has title: Differences in Queue methods
tagged with: java
has body: Why Queue have two different methods each for retrieving element and for removing element? Retrieving methods: element() and Element peak() Removing methods: Element poll() and Element remove() What is difference between them (except return-type differences in first case)?
tagged with: methods
has answer: http://stackoverflow.com/a/25768955
downvote count: 1
tagged with: queue
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/40298094
score: -1
tagged with: data-structures
tagged with: fifo

http://stackoverflow.com/comment/40261320
comment on: http://stackoverflow.com/q/25747736
score: 0
type: Comment
type: QuestionComment
has text: Just call it, what's the question?

http://stackoverflow.com/q/25815829
tagged with: content-negotiation
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
tagged with: jersey
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25821381
favorite count: 0
accepted answer: http://stackoverflow.com/a/25821381
tagged with: jax-rs
has body: I'd like to allow clients to select an error response format using HTTP content negotiation. E.g. given an endpoint @Produces("application/json") class MyService { @GET public String getSomething() { if (currentTimeMilis() % 2 == 0) throw new MyException(); return "{ hello:\"world\" }"; } and exception mapper: class MyExceptionMapper implements ExceptionMapper&lt;MyException&gt; { @Override public Response toResponse(MyException ex) { return status(BAD_REQUEST) .entity(new MyDto(randomUUID(), ex.getMessage())) .build(); } } and having two body writers, MyBodyWriter and standard JacksonJsonProvider. I'd like to invoke one of the writers depending on the contents of Accept header, e.g. Accept: application/json -> invokes JacksonJsonProvider Accept: application/vnd-mycompany-error, application/json -> invokes MyBodyWriter I had tried different approaches but all of them fail because the matched HttpRule implies an application/json content type. The only workaround I've found is to inject the request headers into ExceptionMapper and set the content type explicitly there -- but I don't like it.
has title: Jersey - content negotiation for error handling
upvote count: 3

http://stackoverflow.com/a/25716125
has body: You are looping around the accept() call, accepting new connections, but your actual I/O code only reads one message per connection. You need an inner loop around the readUTF() calls, handling the entire connection until EOFException is thrown. Normally all the I/O for a connection is handled in a separate thread.
answers question: http://stackoverflow.com/q/25716065
type: AcceptedAnswer
upvote count: 1
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25716065

http://stackoverflow.com/q/25718229
type: Question
upvote count: 33
score: 33
answer count: 3
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/53423045
possible better answer: http://stackoverflow.com/a/25718464
favorite count: 0
accepted answer: http://stackoverflow.com/a/25718313
tagged with: many-to-one
has title: Can a @ManyToOne JPA relation be null?
tagged with: hibernate-mapping
has answer: http://stackoverflow.com/a/25718464
has body: I have a table that has foreign key of another table (many to one relationship) but i want it to be nullable. Something like this: public class SubType() { @Id @GeneratedValue(generator = "system-uuid") @GenericGenerator(name = "system-uuid", strategy = "uuid") private String id; } public class TopUp { @Column(nullable = true) @ManyToOne(optional = false, fetch = FetchType.LAZY) private SubType subType; } But @Column(nullable = true) throws the NullPointerException and says subtype can not be null. Is there any way to get the ManyToOne accept null?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25718313
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/44850090
has body: in this case I would use the @JsonSerialize annotation: import com.fasterxml.jackson.databind.annotation.JsonSerialize; @JsonSerialize public class Foo { public Foo() {} } Note you will need add this dependency, for maven: com.fasterxml.jackson.core jackson-databind ${jackson.version}
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25720509
downvote count: 0
type: Answer

http://stackoverflow.com/a/25734219
score: 1
answers question: http://stackoverflow.com/q/25734200
upvote count: 1
has body: Given the input {'H','e','l','l','o'} your output should be {'o','l','l','e','H'}
type: Answer
downvote count: 0

http://stackoverflow.com/a/25862459
score: 4
has comment: http://stackoverflow.com/comment/40658779
has comment: http://stackoverflow.com/comment/40489763
type: Answer
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25851853
has body: You need to understand what what swapping the buffers means. It means that you tell OpenGL that you are done with sending all "rendering commands" and that it may now send the finished rendered image to the screen to display it. What does that imply? It implies that your graphics card has finished rendering everything! Most GL calls will immediately return without blocking. That means that your CPU and keep working and the GPU will work in parallel, processing its queue of received rendering commands from the CPU. Now in case your CPU is able to finish much faster than your GPU, swapping the buffers means that the GPU has to finish processing the whole queue before it can actually swap the buffers and return. In total that means that the problem is not the actual eglSwapBuffers that takes so much time, but just that your GPU cannot keep up with the CPU. It means that your scene is just too complex for example, that you have too many state changes, like texture bindings, shader switches or things like that. So by profiling the CPU side, you won't really find the real problem. But I can't really tell you where the problem is. Since you are using libGDX, GLProfiler might help you here. PS: A sudden change in the FPS might also be cause due to your device switching to energy saving mode.

http://stackoverflow.com/a/25783759
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40477271
has body: That's great that your problem is solved but it would be great if you try to use some built in functions(like String.split()) and libraries in your code as it can reduce a lot of processing and make your code more robust and independent of String length and other parameters. Your code could be optimized to this level... class wordSep{ public static void main(String args[]){ String line = "The world is full of strangers"; String[] word = line.split(" "); for(String str: word){ System.out.println(str); } } } output - The world is full of strangers Now you can also use String Tokenizer But it is not recommended any more... Read this -> to completely understand how to split Strings in Java on some character, or using some Regex and other parameters
answers question: http://stackoverflow.com/q/25778086
has comment: http://stackoverflow.com/comment/40428724
upvote count: 1

http://stackoverflow.com/comment/40260627
score: 0
type: AnswerComment
has text: As long as you have thought it through... :)
comment on: http://stackoverflow.com/a/25746793
type: Comment

http://stackoverflow.com/comment/40417136
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25834078
has text: He's asking why it _isn't_ executed.

http://stackoverflow.com/comment/40271925
has text: I need the easiest solution.
comment on: http://stackoverflow.com/a/25754041
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40254800
has text: Thanks. I will check and let you know.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25717892
score: 0

http://stackoverflow.com/q/25861296
answer count: 1
tagged with: string
has comment: http://stackoverflow.com/comment/40467580
has comment: http://stackoverflow.com/comment/40467455
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40467497
has answer: http://stackoverflow.com/a/25861383
has comment: http://stackoverflow.com/comment/40467274
tagged with: java
has comment: http://stackoverflow.com/comment/40467680
has comment: http://stackoverflow.com/comment/40467192
has body: I am entering values to Bidimap. In each loop I am put(ing) values into the Bidimap and I am also printing the size of the Bidimap. It is always 1. I have also checked value of map through debbugger and it shows only one value which is the present value being put in the most recent iteration in the map. What is going wrong here? How am I suppose to save key-value in the Bidimap. Please find below the complete code. public static void main(String args[]) { //Read file BufferedReader br = null; int wordCount=0; String wordArray[] = null; BidiMap&lt;String, Integer&gt; map = new DualHashBidiMap&lt;String, Integer&gt;(); try { String sCurrentLine; br = new BufferedReader(new InputStreamReader(new FileInputStream("C:\\IASTATE\\test.txt"), StandardCharsets.UTF_16)); while ((sCurrentLine = br.readLine()) != null) { System.out.println(sCurrentLine); wordArray = sCurrentLine.split("\\s+"); wordCount += wordArray.length; } //Read word 1,word 2,word 3 int count; String key; for(int i=0;i&lt;wordArray.length;i++) { key=wordArray[i]+wordArray[i+1]+wordArray[i+2]; //Compare Hashmap if the String {'word 1','word 2','word 3'} //exists if(map.containsKey(key)) { //If exists increment counter count=(Integer) map.get(key); count++; map.put(key, count); } else { //If doesnot exist push String {'word 1','word 2','word 3'} //in the Hashmap and initialize counter to 1 map.put(key, 1); } key=null; System.out.println("Size of Map"+map.size()); } } catch (IOException e) { e.printStackTrace(); } } test.txt content is This is line one This is line two This is line three This is line four
has title: Bidimap size always 1
type: Question
has comment: http://stackoverflow.com/comment/40467414
has comment: http://stackoverflow.com/comment/40467434
score: 0
has comment: http://stackoverflow.com/comment/40467827

http://stackoverflow.com/comment/40292623
has text: I am using an interface and have concrete classes that implement that interface. Is there any way to make the interface public but keep the classes private/protected, while maintaining the ability of the class to be called from other packages?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25763151

http://stackoverflow.com/comment/40315356
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25777771
has text: Sorry, I edited the first paragraph to hopefully make it clearer. Essentially, the visit class needs to be passed a reference to the Doctor and Patient classes [my constructor is public Visit (Doctor doc, Patient pat, String thetimeDate)] And I need to be able to use the original methods (like a getName method) from the Doctor or Patient class within my Visit class to return to my main program information like the name. I hope that's clearer. I appreciate your help too :)

http://stackoverflow.com/comment/40423565
has text: Of course there is but it depends on the priority queue implementation.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25837345

http://stackoverflow.com/comment/40410286
type: QuestionComment
has text: "But, I actually don't want to use `Random`". Then write your own random generator. According to the [documentation](http://docs.oracle.com/javase/7/docs/api/java/lang/Math.html#random()) related to `random()`: *When this method is first called, it creates a single new pseudorandom-number generator, exactly as if by the expression `new java.util.Random()` This new pseudorandom-number generator is used thereafter for all calls to this method and is used nowhere else.*
comment on: http://stackoverflow.com/q/25830103
score: 0
type: Comment

http://stackoverflow.com/comment/40475701
type: QuestionComment
comment on: http://stackoverflow.com/q/25863001
has text: Oh okay. Your question description does not say that your build is failing. I dont see a reason for getting NPE during build.
score: 0
type: Comment

http://stackoverflow.com/comment/40268852
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25726896
has text: The version of EclipseLink JPA is 2.5.1

http://stackoverflow.com/a/25790502
has body: 1) In a switch case, a jump table maps a position in the code segment to a particular case. For instance, considering this snippet: int a; // a is manipulated here switch (a) { case 1: // address 0 // ... break; case 2: // address 1 // ... break; case 3: // address 2 // ... break; default: // other cases // ... break; } There would be a jump table mapping a=1 to the effective code address marked by address 0, a=2 to address 1, and so on. This can become more apparent when observing the resulting bytecode. With this approach, the number of conditional jumps in the bytecode becomes much smaller than in the case of if-else statements. 2) It's true that if-else statements can test of unequality, but achieving the same behavior of a switch-case statement involves chaining if-else statements. Here is an equivalent version of the above in terms of behavior. if (a==1) { // ... } else if (a==2) { // ... } else if (a==3) { // ... } else { // for any other cases } It could be a matter of personal opinion at some point, but a switch-case statement is more readable in this particular case. But naturally, if-else statements are still indispensable, and you are expected to use the right tool for the job. If-else is more versatile than switch-case, but the latter may produce nicer code in some places. Hopefully, this answers the 3rd and 4th part of your question.
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25790180

http://stackoverflow.com/comment/40307290
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25773195
has text: Well it similar and also asked my me but this question is better as Ive nailed it down to a self-contained example, importantly shouldn't be marked as a duplicate because neither question has an answer.
score: 0

http://stackoverflow.com/a/76351135
type: Answer
answers question: http://stackoverflow.com/q/25859921
has body: With RestHighLevelClient (that uses lowLevelClient()) `Request request = new Request("POST", "yourURL"); request.setJsonEntity(yourJsonDSL); try { Response response = restHighLevelClient.getLowLevelClient().performRequest(request); String jsonResponse = EntityUtils.toString(response.getEntity()); JSONObject jsonTransactionObject = new JSONObject(jsonResponse); } catch (IOException ex) { //error; }`
score: 0
has comment: http://stackoverflow.com/comment/134636095

http://stackoverflow.com/a/25721086
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/25720998
type: AcceptedAnswer
downvote count: 0
has body: You have to make loop iterate backward. using -- and you don't need to go from 0 to length but from length to 1. It's main logic of manual reverse function. try this : public static String reverseWords(String str) { StringBuilder sb = new StringBuilder(str.length() + 1); String[] words = str.split(" "); for (int i = words.length - 1; i &gt;= 0; i--) { sb.append(words[i]).append(' '); } sb.setLength(sb.length() - 1); // Strip trailing space return sb.toString(); }
type: Answer
answers question: http://stackoverflow.com/q/25720998

http://stackoverflow.com/q/25716711
tagged with: encryption
has answer: http://stackoverflow.com/a/25733670
has title: How to encrypt different parts of datastore with single key?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25733670
tagged with: java
type: Question
score: 0
has body: I'd like the encrypt information stored in the datastore in Google App Engine. I would like to do this with a key hardcoded into the program and not checked into source control, such that someone who compromises the datastore couldn't read its contents. My issue is as follows. I need to be able to encrypt and decrypt a bunch of Strings (serialized objects turned into hex) using the same key, in an arbitrary order. This means that stream ciphers are out of the question, for key-reuse reasons. Which libraries, algorithms, or techniques will allow me to encrypt pieces of information independent of each other without weakness caused from using the same key?
answer count: 1
tagged with: google-app-engine

http://stackoverflow.com/comment/40298993
has text: Gave it a try but it's still loading links in the webview.
comment on: http://stackoverflow.com/q/25769253
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/40206130
type: Comment
type: QuestionComment
has text: Seriously, combobox is not the right choice for this...
score: 0
comment on: http://stackoverflow.com/q/25718804

http://stackoverflow.com/comment/84398001
has text: The best answer to this question is here: [How can bcrypt have built-in salts?](https://stackoverflow.com/questions/6832445/how-can-bcrypt-have-built-in-salts)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25844419
score: 1

http://stackoverflow.com/comment/40422614
comment on: http://stackoverflow.com/q/25836613
has text: "without the app crashing" - what is the crash you're experiencing?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25734971
has body: You can't start a variable (or any other identifier) name with a number. From the tutorials Variable names are case-sensitive. A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "_".
score: 5
upvote count: 5
answers question: http://stackoverflow.com/q/25734960
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43394243
score: 0
type: Comment
has text: How does EmployeeDetailsResultMap resultmap results into creation of object of class EmployeeDetails? THere is no mapping specified to class EmployeeDetails.
type: AnswerComment
comment on: http://stackoverflow.com/a/27466802

bytecode-manipulation
type: Tag
tags question: http://stackoverflow.com/q/25738551
tag name: bytecode-manipulation

http://stackoverflow.com/q/25853830
has answer: http://stackoverflow.com/a/25853904
has answer: http://stackoverflow.com/a/25853865
has answer: http://stackoverflow.com/a/25853874
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40453392
downvote count: 0
score: 1
duplicate of: http://stackoverflow.com/q/218744
tagged with: effective-java
type: Question
has body: I am creating a very simple class called Catalog. It will be an immutable class and have an id and name field. Out of habit, since I am not going to explicitly document this thing for extensibility, I put the final modifier on the class. However I'm wondering that since this is such a simple value class, would it hurt to leave the final modifier off in case someone in the future decides they could use it?
possible better answer: http://stackoverflow.com/a/25853865
tagged with: java
has title: Keeping a value class non-final for possible future extensibility
has comment: http://stackoverflow.com/comment/40453653
linked to: http://stackoverflow.com/q/218744
answer count: 3
has comment: http://stackoverflow.com/comment/40453365
upvote count: 1
accepted answer: http://stackoverflow.com/a/25853874
favorite count: 0

http://stackoverflow.com/comment/40275810
type: QuestionComment
score: 1
has text: In this context, you MUST display the window, you have no choice. Create a small window, move it somewhere off screen, make it visible. You might even be able to make it invisible as well, so long as you don't dispose of it
comment on: http://stackoverflow.com/q/25756172
type: Comment

http://stackoverflow.com/a/25780121
answers question: http://stackoverflow.com/q/25772317
type: AcceptedAnswer
downvote count: 0
has body: Open the properties dialog of the module with the xml layer that needs to be visible. Select API Versioning and under Public packages select the package that contains the xml file. Click OK.
type: Answer
accepted answer of: http://stackoverflow.com/q/25772317
score: 1
upvote count: 1

http://stackoverflow.com/comment/40307665
comment on: http://stackoverflow.com/q/25773721
score: 1
type: Comment
type: QuestionComment
has text: @ElliottFrisch Same thing for `System.out.println(0.1 + 0.1 + 0.1);` but that does not change the fact that 0.100000 == 0.1

http://stackoverflow.com/a/25870773
answers question: http://stackoverflow.com/q/25870328
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25870328
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/40484498
score: 2
has comment: http://stackoverflow.com/comment/78569973
downvote count: 0
has body: Use a Calendar object like in your example, which provides the add method. String dateAsString = "16/09/2014"; DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); Calendar c = Calendar.getInstance(); c.setTime(formatter.parse(dateAsString)); c.add(Calendar.DAY_OF_MONTH, 1); System.out.println("After one day: " + formatter.format(c.getTimeInMillis())); c.add(Calendar.DAY_OF_MONTH, -1); c.add(Calendar.WEEK_OF_YEAR, 1); System.out.println("After one week: " + formatter.format(c.getTimeInMillis())); c.add(Calendar.WEEK_OF_YEAR, -1); c.add(Calendar.MONTH, 1); System.out.println("After one month: " + formatter.format(c.getTimeInMillis())); c.add(Calendar.MONTH, -1); c.add(Calendar.YEAR, 1); System.out.println("After one year: " + formatter.format(c.getTimeInMillis())); c.add(Calendar.YEAR, -1); Output: After one day: 17/09/2014 After one week: 23/09/2014 After one month: 16/10/2014 After one year: 16/09/2015
has comment: http://stackoverflow.com/comment/40484280

http://stackoverflow.com/comment/40213931
score: 0
comment on: http://stackoverflow.com/q/25723331
type: Comment
has text: use onuserinteraction() method
type: QuestionComment

ruby-on-rails-4
type: Tag
tags question: http://stackoverflow.com/q/25773676
tag name: ruby-on-rails-4

http://stackoverflow.com/a/25787236
downvote count: 0
answers question: http://stackoverflow.com/q/25787182
type: Answer
accepted answer of: http://stackoverflow.com/q/25787182
upvote count: 10
has body: Is there any way i can achieve this? Yes there is a method. You are looking for transient. Like this private transient x; To add to it all of object's variables which you have created get converted into a persistent state. So when you declare those variables as transient then it will not be persisted. That is the main purpose of the transient keyword. From the Java docs: Variables may be marked transient to indicate that they are not part of the persistent state of an object. Example from source: package javabeat.samples; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; class NameStore implements Serializable{ private String firstName; private transient String middleName; private String lastName; public NameStore (String fName, String mName, String lName){ this.firstName = fName; this.middleName = mName; this.lastName = lName; } public String toString(){ StringBuffer sb = new StringBuffer(40); sb.append("First Name : "); sb.append(this.firstName); sb.append("Middle Name : "); sb.append(this.middleName); sb.append("Last Name : "); sb.append(this.lastName); return sb.toString(); } } public class TransientExample{ public static void main(String args[]) throws Exception { NameStore nameStore = new NameStore("Steve", "Middle","Jobs"); ObjectOutputStream o = new ObjectOutputStream (new FileOutputStream("nameStore")); // writing to object o.writeObject(nameStore); o.close(); // reading from object ObjectInputStream in =new ObjectInputStream( new FileInputStream("nameStore")); NameStore nameStore1 = (NameStore)in.readObject(); System.out.println(nameStore1); } } // output will be : First Name : Steve Middle Name : null Last Name : Jobs
score: 10
type: AcceptedAnswer

http://stackoverflow.com/q/25832144
has comment: http://stackoverflow.com/comment/40414270
type: UnansweredQuestion
tagged with: maven
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40414003
has comment: http://stackoverflow.com/comment/40414189
has title: Error creating bean Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
downvote count: 0
has body: I have a java application (maven project) that has a parent root. the application have a dependencies in other projects under root and when this application initialize the context an error is thrown: [LogFactory from sun.misc.Launcher$AppClassLoader@131165903] Created object org.apache.logging.log4j.jcl.LogFactoryImpl@173728231 to manage classloader sun.misc.Launcher$AppClassLoader@131165903 Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'retriableOperationExecutor' defined in file [C:\evergreen\lt-pcqc\app\Backend\Common\lab-common\target\classes\Spring\qcext-pclab-retriable-operation-executor-context.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities) at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:250) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1051) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:955) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:490) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFact…
favorite count: 0

http://stackoverflow.com/a/36765387
answers question: http://stackoverflow.com/q/25727871
upvote count: 2
type: Answer
score: 2
has body: This seems to be the most convenient way: table.registerKeyboardAction( null, KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); To assign an action replace null with ActionListener call or with e -&gt; someMethod() for JDK 1.8
downvote count: 0

http://stackoverflow.com/comment/40298541
has text: Hi can you provide any source code or examples for your answer
comment on: http://stackoverflow.com/a/25768450
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40248929
score: 0
type: AnswerComment
has text: if ServiceTest2 doesn't work on its own then changing ServiceTest1 Wont fix the problem. You need to post more of ServiceTest2 plus the spring xml file
type: Comment
comment on: http://stackoverflow.com/a/25741192

http://stackoverflow.com/a/25850884
type: Answer
accepted answer of: http://stackoverflow.com/q/25794158
answers question: http://stackoverflow.com/q/25794158
has body: I had to setup the mail resource in Weblogic, also the configuration file had to change to reflect the new JNDI resource for mail sessions in the Weblogic server too. From mailSession.JndiName=java:comp/env/mail/xxxx To mailSession.JndiName=mail/xxxx Thanks, Tom
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25779900
has comment: http://stackoverflow.com/comment/40373238
upvote count: 3
answer count: 3
accepted answer: http://stackoverflow.com/a/25810405
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25810405
tagged with: maven
possible better answer: http://stackoverflow.com/a/25780427
has comment: http://stackoverflow.com/comment/40323395
has answer: http://stackoverflow.com/a/25780427
score: 2
has title: How to include source file(.java file) parallel to .class file in the generated jar using maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25781136
tagged with: java
has comment: http://stackoverflow.com/comment/40318519
has body: I wanted to create my jars with wars with that should include source file(.java file) parallel to .class file in the generated jar using maven. (I know there are some plugins available to generate a separate xyy-sources.jar file. But I dont want to create a seperate source jar. I need a single jar file with both .class and .java file exists parallel)
type: Question
tagged with: jar
tagged with: class

apache-camel
tags question: http://stackoverflow.com/q/25763655
tags question: http://stackoverflow.com/q/25805029
tags question: http://stackoverflow.com/q/25741585
tags question: http://stackoverflow.com/q/25729030
tags question: http://stackoverflow.com/q/25721985
tag name: apache-camel
tags question: http://stackoverflow.com/q/25784983
tags question: http://stackoverflow.com/q/25745022
tags question: http://stackoverflow.com/q/25773602
tags question: http://stackoverflow.com/q/25851033
tags question: http://stackoverflow.com/q/25727629
tags question: http://stackoverflow.com/q/25782897
tags question: http://stackoverflow.com/q/25767741
type: Tag
tags question: http://stackoverflow.com/q/25865426

http://stackoverflow.com/q/25833233
type: UnansweredQuestion
has title: Why is this generic method signature invalid?
tagged with: java
has body: static void stuff(Thing thing, Iterable&lt;T extends Something&gt; stuff){ ... } This doesn't compile, Eclipse puts a red line under extends. However if I change T to ?, it works. Why?
type: Question
score: 0
answer count: 1
tagged with: generics
has answer: http://stackoverflow.com/a/25833241

http://stackoverflow.com/a/25764501
has body: works according to what you want, but not ethical import java.io.*; import java.util.*; class Add { public static void main(String args[]) throws Exception { boolean loop=true;int pos=0;int num=0,sum=0; while(loop) try { String yn; do {sum=0;num=0; Scanner s=new Scanner(System.in); System.out.println("Enter how many numbers to add: "); num=Integer.parseInt(s.next()); int a; for(int i=1;i&lt;=num;i++) { System.out.println("Enter number["+i+"]: "); a=Integer.parseInt(s.next()); sum=sum+a;pos=i; } System.out.println("The Sum is:"+sum); System.out.println("Do you want to continue?(Y/N):"); yn=s.next(); } while(yn.equals("y")||yn.equals("Y")); } catch(Exception e) { Scanner s=new Scanner(System.in); int a=0; for(int i=pos+1;i&lt;=num;i++) { System.out.println("Enter number["+i+"]: "); a=Integer.parseInt(s.next()); sum=sum+a;} System.out.println("The Sum is:"+sum); } } }
type: Answer
answers question: http://stackoverflow.com/q/25762222
score: 0

http://stackoverflow.com/q/25810671
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/25816238
has comment: http://stackoverflow.com/comment/40375548
has comment: http://stackoverflow.com/comment/40374138
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/40374126
tagged with: generics
favorite count: 0
upvote count: 2
has title: Arrays of unknown type
has comment: http://stackoverflow.com/comment/40374275
has answer: http://stackoverflow.com/a/25816238
has comment: http://stackoverflow.com/comment/40375775
has answer: http://stackoverflow.com/a/25811610
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40374042
has comment: http://stackoverflow.com/comment/40374194
tagged with: java
has body: Why is the expression ?[] illegal? I don't understand why it is any more suspect than T[]. I get that there are problems with generic array creation, so I see why things like new T[] and new ?[3] are disallowed, but I don't see what's wrong with ?[]. It would be nice, for example, to be able to have a method signature like void method(?[] arr). What's wrong with this? Also, what is the preferred way to write a method taking an array of unknown type? Should you use public void method(Object[] arr) in preference to public &lt;T&gt; void method(T[] arr) or is this an exception to the usual rule that you should avoid type parameters in method signatures if the type parameter appears only once?
has comment: http://stackoverflow.com/comment/40376522
has comment: http://stackoverflow.com/comment/40374529
has comment: http://stackoverflow.com/comment/40374192
possible better answer: http://stackoverflow.com/a/25811610

http://stackoverflow.com/a/49161539
score: 3
has comment: http://stackoverflow.com/comment/95686820
downvote count: 0
answers question: http://stackoverflow.com/q/25773422
type: Answer
upvote count: 3
has body: Here is another solution using Java 8 Streams: int trailingZeros = String.valueOf(number).chars() .reduce(0, (count, ch) -&gt; (ch == '0') ? count + 1 : 0); This transforms the number to an IntStream. This stream is then reduced using a lambda which resets a counter each time a non-zero char comes up.

http://stackoverflow.com/comment/40354218
comment on: http://stackoverflow.com/a/25799250
type: AnswerComment
type: Comment
has text: and if it is initialized to "False" (as it will need to be initialized), then you do not need the last `else`
score: 1

http://stackoverflow.com/q/25737641
possible better answer: http://stackoverflow.com/a/25737670
tagged with: dictionary
has answer: http://stackoverflow.com/a/25737670
has title: How to overwrite the hashcode method that returns a unique hashcode value with its unique entity ID in my defined Java object?
type: AnsweredQuestion
score: 3
tagged with: hashcode
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25737674
tagged with: hashmap
has answer: http://stackoverflow.com/a/25737712
answer count: 3
tagged with: compare
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25737674
has body: I faced a case of using a complex Map which uses my defined Java object as its key, to do this the class of this object need to implement interface Comparable and overwrite Object's hashcode and equals methods, and I want to use unique ID of object of this class as it hashcode, but the unique ID is Long type and the type of value hashcode returns is Integer, this may suffer from data corruption and inconsistency if ID of object increased to a very large one. Is there any way to convert a unique long-type ID to a hashcode that can also be used to identify between objects?

http://stackoverflow.com/a/25832670
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40414750
score: 1
has body: I've made a library once a day in java then when shifting to Android I had to use the built-in HTTP of it, at the end I made 2 libraries one for java and another one for Android the main difference was the imports
downvote count: 0
answers question: http://stackoverflow.com/q/25832614

amazon-vpc
type: Tag
tag name: amazon-vpc
tags question: http://stackoverflow.com/q/25754530

http://stackoverflow.com/comment/40312630
score: 1
comment on: http://stackoverflow.com/q/25776412
type: Comment
type: QuestionComment
has text: Yes, sorry. First post on this forum. It is indeed Java. Ill edit that in to my body.

http://stackoverflow.com/q/25766262
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25771632
has title: How can I map from to sources to the same object in ModelMapper
type: Question
accepted answer: http://stackoverflow.com/a/25771632
downvote count: 0
answer count: 1
favorite count: 0
tagged with: modelmapper
has body: How can I express the following in ModelMapper: To fill a field in the target, I want to use property A of the source if it is non-null, otherwise use the property B. Example (Code below if you don't like technical descriptions): Let's say I want from a source class SourceBigThing to a target class Target using ModelMapper. The SourceBigThing has two properties, one called red and one called green. These two properties are of different types RedSmallThing and GreenSmallThing. Both of these things have a property called name. A SourceBigThing can either have a red or a green, but not both (the other is null). I want to map the names of the Small Things to a property of the target-class. Example-Code: class SourceBigThing { private final SourceSmallThingGreen green; private final SourceSmallThingRed red; } class SourceSmallThingGreen { private final String name; } class SourceSmallThingRed { private final String name; } class Target { private TargetColorThing thing; } class TargetColorThing { // This property should either be "green.name" or "red.name" depending // on if red or green are !=null private String name; } I tried to play around with the conditionals, but you cannot have two mappings to the same target because ModelMapper throws an exception for duplicate mappings: when(Conditions.isNotNull()).map(source.getGreen()).setThing(null); when(Conditions.isNotNull()).map(source.getRed()).setThing(null); You can find a failing TestNG-Unit-Test at this gist.
upvote count: 2
score: 2

http://stackoverflow.com/a/25777517
score: 0
has body: Put a try catch inside the while loop: /* * @Author: Louis Krueger * @Desc: Homework assignment #2 exception handling * @Version: 1.1 */ package paymentApplication; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.util.ArrayList; import java.util.InputMismatchException; import java.util.Scanner; public class MainHandle { public static ArrayList&lt;String&gt; saPaymentList = new ArrayList&lt;String&gt;(); public static void main(String[] args) { boolean bSkipTrans = false; String sFileName = ""; String sPaymentInfo = ""; String[] saPaymentInfo = null; Scanner keyBoard = new Scanner(System.in); ArrayList&lt;Payment&gt; alPayments = new ArrayList&lt;Payment&gt;(); try{ System.out.println("Enter the file name to be read: "); sFileName = keyBoard.nextLine(); Scanner inputStream = new Scanner(new FileInputStream("details.txt")); System.out.println("Test1"); //loop to Create arraylist of PaymentInfo objects while(inputStream.hasNextLine()) { try{ bSkipTrans = false; Payment Payment = new Payment(); sPaymentInfo = inputStream.nextLine(); saPaymentInfo = sPaymentInfo.split(";"); if(saPaymentInfo.length == 1){ bSkipTrans = true; throw new InvalidTransactionException(); }else{ if(saPaymentInfo.length &gt; 1){ if (isInteger(saPaymentInfo[1]) == true){ Payment.setiTransValue(Integer.parseInt(saPaymentInfo[1])); }else{ //throw exception bSkipTrans = true; throw new InvalidTransactionException("Error#1"); } } if(saPaymentInfo.length &gt; 4){ Payment.setsCreditNumber(saPaymentInfo[4]); } if(saPaymentInfo.length &gt; 3){ Payment.setsDate(saPaymentInfo[3]); } if(saPaymentInfo.length &gt; 2){ Payment.setsName(saPaymentInfo[2]); } if(saPaymentInfo.length &gt; 0){ if(saPaymentInfo[0] != "Cash"|saPaymentInfo[0] != "Credit"){ //throws exception Payment.setsTransType(saPaymentInfo[0]); }else{ bSkipTrans = true; throw new InvalidTransactionException("Error#2"); } } } if(bSkipTrans == true){ //throw exception bSkipTrans = true; throw new InvalidTransactionExc…
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25777474
answers question: http://stackoverflow.com/q/25777474

http://stackoverflow.com/comment/40359403
type: QuestionComment
has text: yes i am invalidating session and cookie during logoff, on two urls are different and they have different filters
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25795294

http://stackoverflow.com/a/25800700
has body: The issue was with the date.The message "Message does not conform to 554 standards was because of date. Adding message.setSentDate(new Date()); fixed the issue. this SMTP: Error 554, message is not RFC compliant helped.
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25741886
answers question: http://stackoverflow.com/q/25741886
type: AcceptedAnswer

http://stackoverflow.com/comment/40388562
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25817947
has text: Have you tried to invoke invalidate() on your edittex just after change the content?

http://stackoverflow.com/comment/40434095
has text: So I need to think more for method names, rather than the business logic :D
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25842976

http://stackoverflow.com/a/25870389
answers question: http://stackoverflow.com/q/25869837
upvote count: 5
has comment: http://stackoverflow.com/comment/40486611
has comment: http://stackoverflow.com/comment/40484923
downvote count: 0
has comment: http://stackoverflow.com/comment/40484769
has body: There's a way but it violates what all the other answers point out and, therefore, should be avoided. What you're trying to do can be accomplished via reflection: static void degitir(String s){ try{ java.lang.reflect.Field field = String.class.getDeclaredField("value"); field.setAccessible(true); char[] value = (char[])field.get(s); value[0] = 'J'; value[1] = 'a'; value[2] = 'v'; value[3] = 'a'; value[4] = '!'; }catch(Exception e){ // Add message. } } public static void main(String[] args){ String X = "ahmet"; System.out.println("X = " + X); degitir(X); System.out.println("X = " + X); }
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/40486218
has comment: http://stackoverflow.com/comment/40487454

http://stackoverflow.com/a/59772254
answers question: http://stackoverflow.com/q/25753966
type: Answer
downvote count: 1
has body: In my case, I'd had several jdk's installed as shown when running the command: /usr/libexec/java_home -V and the installer was complaining about the Java JDK 11 not having what it needed. Since I'd backed off using 11 in favor of 8 I was okay removing this JDK from my system using the command: cd /Library/Java/JavaVirtualMachines sudo rm -fr jdk-11.0.1.jdk this made my jdk1.8.0_221.jdk the most current jdk and the installer worked fine. You could probably mv the jdk-11.0.1.jdk to another location to get Eclipse installed using a different jdk version and then move it back.
upvote count: 0
score: -1

http://stackoverflow.com/q/25716065
has title: socket programming code not running forever
score: -4
downvote count: 4
type: AnsweredQuestion
upvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/25716080
type: Question
answer count: 2
has body: I have a 2 nodes that should always communicate with each other, but they don't seem to talk for more than 1 interaction. After successfully sending and receiving 1 message, they stop. My code looks like this: The initiator: try { Socket client = new Socket(ip, port); OutputStream toNode = client.getOutputStream(); DataOutputStream out = new DataOutputStream(toNode); out.writeUTF("Start:Message"); System.out.println("Sent data"); InputStream fromNode = client.getInputStream(); DataInputStream in = new DataInputStream(fromNode); if(in.readUTF().equals("Return Message")) { System.out.println("Received data"); out.writeUTF("Main:Message"); System.out.println("Sent data again"); } else System.out.println("Error"); client.close(); } catch (UnknownHostException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } The responder: while(true) { Socket server; try { server = s.accept(); DataInputStream in = new DataInputStream(server.getInputStream()); String msg = in.readUTF(); String[] broken_msg = msg.split(":"); if(broken_msg.length &gt; 0) System.out.println("Looping"); String ret; if (broken[0].equalsIgnoreCase("Start")) { ret = "Return Message"; DataOutputStream out = new DataOutputStream(server.getOutputStream()); out.writeUTF(ret); } else if (broken[0].equalsIgnoreCase("Main")) { //Do Useful work } } catch (IOException e) { e.printStackTrace(); } } My output looks like this: Looping and: Sent data Received data Sent data again
has answer: http://stackoverflow.com/a/25716125
accepted answer: http://stackoverflow.com/a/25716125
has answer: http://stackoverflow.com/a/25716080
favorite count: 0

http://stackoverflow.com/comment/40323935
score: 0
type: Comment
has text: Another problem with your method: you have to pass `2` as the first parameter when first calling the method, instead of `3`.
comment on: http://stackoverflow.com/a/25782880
type: AnswerComment

http://stackoverflow.com/q/25836936
has comment: http://stackoverflow.com/comment/40530344
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40424539
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40530590
type: Question
has comment: http://stackoverflow.com/comment/40530054
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/40424546
has body: I'm trying to create a java window which displays a PHP login file using JEditorPane and JFrame. Actually displaying the PHP file part works out, however when I try to submit the user info and login in, which should redirect the user to another PHP file I get the following error: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.text.html.FormView.submitData(Unknown Source) at javax.swing.text.html.FormView.actionPerformed(Unknown Source) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4…
has title: PHP & JEditorPane: java.lang.NullPointerException
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/40529916
tagged with: jeditorpane

http://stackoverflow.com/q/25769080
type: Question
answer count: 2
tagged with: android
has answer: http://stackoverflow.com/a/25769665
has comment: http://stackoverflow.com/comment/40298623
has body: Now I am going on with app theme transparency that is i have one class. I have two button options if user click one button it should load app theme and for other one transparency should load. So i decided to show transparency theme progrmatically for that set parent layout id in class and tried to set the theme there but i can't able to set. Reffered many set but no use if some have idea about this please help me friends.
type: UnansweredQuestion
score: 0
tagged with: android-manifest
has answer: http://stackoverflow.com/a/25769774
linked to: http://stackoverflow.com/q/4663752
tagged with: java
has title: How to set App Theme programatically in Android?

http://stackoverflow.com/comment/40461115
has text: `execute` shouldn't be `synchronized` as well for the same reason.
comment on: http://stackoverflow.com/q/25857594
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40283663
score: 0
comment on: http://stackoverflow.com/a/25760746
type: Comment
type: AnswerComment
has text: @KickButtowski We should be lifting people, helping the grow, finding new and better ways to confuse themselves. Besides, centralising the logic and reducing duplication is a core OO principle, what a better time to introduce it ;)

http://stackoverflow.com/a/25749634
upvote count: 1
has comment: http://stackoverflow.com/comment/40263084
answers question: http://stackoverflow.com/q/25749592
has body: You may try like this: "test string".replaceAll(" ","\\\\ ");
has comment: http://stackoverflow.com/comment/40263125
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/comment/40307915
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25774060
has text: You can't use the same variable for both loops. Create a new one each time for your second loop.

http://stackoverflow.com/a/25743238
type: Answer
score: 8
upvote count: 9
answers question: http://stackoverflow.com/q/25742913
type: AcceptedAnswer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25742913
has body: Setting Tomcat to listen to port 80 is WRONG , for development the 8080 is a good port to use. For production use, just set up an apache that shall forward your requests to your tomcat. Here is a how to.

http://stackoverflow.com/comment/40418668
score: 2
has text: change `freq[c]++;` to `freq[i]++;`
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25834882

http://stackoverflow.com/comment/40278781
type: QuestionComment
has text: Why do u have && index == 1?
comment on: http://stackoverflow.com/q/25758085
score: 2
type: Comment

http://stackoverflow.com/comment/105960244
score: 2
comment on: http://stackoverflow.com/a/28358590
type: AnswerComment
has text: This should be accepted as answer when when you are playing with native queries, you will need to do `entityManager.joinTransaction();`
type: Comment

http://stackoverflow.com/q/25817980
score: -1
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/25818378
has comment: http://stackoverflow.com/comment/40389325
answer count: 3
has answer: http://stackoverflow.com/a/25818225
upvote count: 0
linked to: http://stackoverflow.com/q/25811373
favorite count: 0
has title: Backtracking and finding all subsets of array that equal some value k
has body: I asked question earlier and i thought i understood it when i went to my terminal to code i am once again completely lost. My problem is i have some array say [1,2,3,4] and i need to find all possible combos that will equal a destination value 5. I understand there is a backtracking approach to this. i am not able to get it as online a lot of solution approaches are going over my head i just need a simple explanation or a step by step trace of a very small array to visualize what's going on. I have spent the last 12 hours in the library and i feel really depressed now since i am not able to understand it, i would also appreciate a simple approach. Also i am not familiar with many languages other than C or java.
has comment: http://stackoverflow.com/comment/40389583
tagged with: backtracking
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25818225
has comment: http://stackoverflow.com/comment/40388879
has answer: http://stackoverflow.com/a/25819084
accepted answer: http://stackoverflow.com/a/25819084
downvote count: 1
has comment: http://stackoverflow.com/comment/40388855
type: Question
tagged with: recursion
tagged with: algorithm
linked to: http://stackoverflow.com/q/10667187
has comment: http://stackoverflow.com/comment/40389999
has comment: http://stackoverflow.com/comment/40388782

http://stackoverflow.com/comment/40290363
has text: Can you add code that is causing this issue?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25764778
score: 0

http://stackoverflow.com/a/25800609
type: AcceptedAnswer
downvote count: 0
has body: You can use this: Set&lt;Integer&gt; keys = feature_vector.keySet(); for(Integer key : keys) { Double value = feature_vector.get(key); //do what ever you want with the key and value in here... }
answers question: http://stackoverflow.com/q/25800555
score: 1
accepted answer of: http://stackoverflow.com/q/25800555
type: Answer
upvote count: 1

http://stackoverflow.com/a/25807377
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: The settings are releated to the -source and -target flags for the javac compiler which enables backwards compatibility (for an explanation, see for example this SO question and answer). This is mostly a technical option and not a feature, i.e. these settings in Eclipse were never intended to free you of the burden of knowing what is and is not available in an old JRE. But Eclipse does provide you the option to make it so and even shows you a warning message at the bottom of the Java Compiler options screen on how to make it so (and yes, that does involve downloading and installing the old (target) version of the JRE - there is no way around that).
answers question: http://stackoverflow.com/q/25803174
accepted answer of: http://stackoverflow.com/q/25803174
type: AcceptedAnswer

http://stackoverflow.com/q/25819571
tagged with: listener
downvote count: 0
answer count: 0
duplicate of: http://stackoverflow.com/q/1299837
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40391572
tagged with: swing
has title: swing Jbutton listener not working
tagged with: jbutton
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40391429
has comment: http://stackoverflow.com/comment/40410591
has comment: http://stackoverflow.com/comment/40391689
linked to: http://stackoverflow.com/q/1299837
linked to: http://stackoverflow.com/q/13208755
upvote count: 1
has comment: http://stackoverflow.com/comment/40391579
has body: While trying to read data from JTextField it says: cannot refer to non final variable declared in inner class in another method CODE: import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class Soloswing { Soloswing() { JFrame jf = new JFrame("soloworld"); jf.setLayout(new FlowLayout(5, 25, 10)); JLabel l1 = new JLabel("VALUE1"); JTextField t1 = new JTextField(20); JLabel l2 = new JLabel("VALUE2"); JTextField t2 = new JTextField(20); JLabel l3 = new JLabel("RESULT"); JTextField t3 = new JTextField(20); JButton b1 = new JButton("+"); JButton b2 = new JButton("-"); JButton b3 = new JButton("*"); JButton b4 = new JButton("/"); JButton b5 = new JButton("%"); JButton bequals = new JButton("="); JButton bclear = new JButton("CE"); //int i = Integer.parseInt(t1.getText()); //int j = Integer.parseInt(t2.getText()); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setSize(300, 500); jf.add(l1); jf.add(t1); jf.add(l2); jf.add(t2); jf.add(l3); jf.add(t3); jf.add(b1); jf.add(b2); jf.add(b3); jf.add(b4); jf.add(b5); jf.add(bequals); jf.add(bclear); jf.setVisible(true); b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int j = Integer.parseInt(t2.getText()); int k = i + j; t3.setText(k); } }); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { new Soloswing(); } }); } } So, what I expect is, when JButton is clicked it should read inputs from two JTextFields and add them together and show the result in the third textField b1.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int j = Integer.parseInt(t2.getText()); int k = i + j; t3.setText(k); } }); But, it shows the error: canot refer to non final variable declared in inner class in another method
favorite count: 0
linked to: http://stackoverflow.com/q/25627023

http://stackoverflow.com/comment/40305984
type: Comment
comment on: http://stackoverflow.com/a/25772717
type: AnswerComment
score: 0
has text: @Farhanpatel equals() loops over the characters of both Strings and compares each pair of characters with the same index. It stops when it finds the first non-equal character. In that sense, equals and compareTo have the same complexity, but the operator equals calls is `!=` (not equals) while compareTo calls `-` (minus).

http://stackoverflow.com/comment/40319825
has text: In your first input there is a `-` before `function`. Should that also be replaced by `newFunction`?
comment on: http://stackoverflow.com/q/25780463
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25764725
type: Answer
has body: protected void onLayout(boolean changed, int l, int t, int r, int b) { int frameWidth = getWidth(); int frameHeight = getHeight(); FrameLayout f = mFrame; int horizontalPadding = f.getPaddingLeft() + f.getPaddingRight(); //수평여백 int verticalPadding = f.getPaddingBottom() + f.getPaddingTop(); // 수직여백. int previewHeight = frameHeight - verticalPadding; int previewWidth = frameWidth - horizontalPadding;*/ int previewHeight = frameHeight; int previewWidth = frameWidth; // resize frame and preview for aspect ratio if (previewWidth &gt; previewHeight * mAspectRatio) { previewWidth = (int) (previewHeight * mAspectRatio + .5); } else { previewHeight = (int) (previewWidth / mAspectRatio + .5); }*/ frameWidth = previewWidth + horizontalPadding; frameHeight = previewHeight + verticalPadding; int hSpace = ((r - l) - frameWidth) / 2; int vSpace = ((b - t) - frameHeight) / 2; mFrame.measure( MeasureSpec.makeMeasureSpec(frameWidth, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(frameHeight, MeasureSpec.EXACTLY)); mFrame.layout(l + hSpace, t + vSpace, r - hSpace, b - vSpace); if (mSizeListener != null) { mSizeListener.onSizeChanged(); } }
answers question: http://stackoverflow.com/q/25763482
score: 0

http://stackoverflow.com/comment/40333986
comment on: http://stackoverflow.com/q/25788791
type: QuestionComment
has text: Out of curiosity , how will you plan to store the first sequence in your java program??
score: 0
type: Comment

http://stackoverflow.com/comment/40345862
has text: A better phrasing would be `Can a Baseclass restrict its methods from using, based on who subclasses it ?` In this case `Vector` should say "No Remove for you" `Stack` as soon as it sees `Stack<E> extends Vector<E>`
comment on: http://stackoverflow.com/q/25794417
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40199703
has text: Can you be more clear what you want plz?
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25715521

http://stackoverflow.com/comment/40307115
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25773380
type: AnswerComment
has text: @Henry am I correct saying that f(n) = sum( f(n-S[m]) ) for m = 0 < S.length Sorry for the use of different language types in that pseudocode.

http://stackoverflow.com/comment/40377540
comment on: http://stackoverflow.com/q/25811700
type: Comment
type: QuestionComment
has text: Surely not, line 21 of OUTPUT.java file
score: 0

http://stackoverflow.com/q/25742217
tagged with: apache-vysper
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/26040262
accepted answer: http://stackoverflow.com/a/26040262
downvote count: 0
type: Question
score: 1
tagged with: java
upvote count: 1
answer count: 1
has title: vysper address already in use
favorite count: 0
has body: i would like to use the XMPP server "Apache Vysper" in a Java-project, so i copy this example-code: public class Start { /** * * @param args */ public static void main(String[] args) throws AccountCreationException, EntityFormatException, FileNotFoundException { // choose the storage you want to use //StorageProviderRegistry providerRegistry = new JcrStorageProviderRegistry(); StorageProviderRegistry providerRegistry = new MemoryStorageProviderRegistry(); final AccountManagement accountManagement = (AccountManagement) providerRegistry .retrieve(AccountManagement.class); Entity user1 = EntityImpl.parse("user1@vysper.org"); if (!accountManagement.verifyAccountExists(user1)) { accountManagement.addUser(user1, "password1"); } Entity user2 = EntityImpl.parse("user2@vysper.org"); if (!accountManagement.verifyAccountExists(user2)) { accountManagement.addUser(user2, "password1"); } Entity user3 = EntityImpl.parse("user3@vysper.org"); if (!accountManagement.verifyAccountExists(user3)) { accountManagement.addUser(user3, "password1"); } XMPPServer server = new XMPPServer("vysper.org"); server.addEndpoint(new TCPEndpoint()); WebSocketEndpoint wsEndpoint = new WebSocketEndpoint() { // example of how you can combine Vysper with other resources @Override protected Server createJettyServer() { Server jetty = super.createJettyServer(); ResourceHandler resourceHandler = new ResourceHandler(); resourceHandler.setResourceBase("src/examples/client"); jetty.setHandler(resourceHandler); HandlerCollection handlers = new HandlerCollection(); handlers.addHandler(resourceHandler); jetty.setHandler(handlers); return jetty; } }; wsEndpoint.setContextPath("/ws"); server.addEndpoint(wsEndpoint); server.setStorageProviderRegistry(providerRegistry); server.setTLSCertificateInfo(new File("src/cert/bogus_mina_tls.cert"), "boguspw"); try { server.start(); System.out.println("vysper server is running..."); } catch (Exception e) { e.printStackTrace(); } server.addModule(new SoftwareVersionModule()); ser…

http://stackoverflow.com/comment/40405070
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25826782
score: 0
has text: @MarkoTopolnik: I'd like to avoid a long, drawn out debate about it here - I may post something about it on Meta later - but what I'm saying is that the question doesn't necessarily warrant closure. It may warrant downvotes - that, I'm not arguing against - but not closure. Shoehorning a closure reason because one is "at a loss" as to which one to use is at best an abuse of the closure system.

http://stackoverflow.com/q/25854318
answer count: 0
type: UnansweredQuestion
tagged with: ejb-3.1
score: 3
tagged with: java
tagged with: jboss
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/40461569
downvote count: 0
has body: I am able to successfully lookup the remote interface, but when I call the method of that bean, it gives the following error: Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:jmschat, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@413157 at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:727) at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116) at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183) at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:253) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:198) at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181) at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144) at com.sun.proxy.$Proxy0.sendMessage(Unknown Source) at Client.main(Client.java:64) My Client code is: public static void main(String[] args) { Properties jndiProperties=new Properties(); jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.remote.client.InitialContextFactory"); jndiProperties.put(Context.PROVIDER_URL, "remote://127.0.0.1:4447"); jndiProperties.put("jboss.naming.client.ejb.context", true); jndiProperties.put(Context.SECURITY_PRINCIPAL, "admin"); jndiProperties.put(Context.SECURITY_CREDENTIALS, "********"); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); //jndiProperties.put("jboss.naming.client.ejb.context", true); InitialContext ctx = null; try { ctx = new InitialContext(jndiProperties); } catch (NamingException e) { e.printStackTrace(); } MessageProducerLocal messageProducerRemote= null; try { // assert ctx != null; String appName=""; String moduleName="jmschat"; String distinctName=""; String beanName=Mess…
upvote count: 3
tagged with: jboss-eap-6
favorite count: 0
has title: No EJB receiver available for handling [appName:, moduleName:jmschat, distinctName:] when invoking bean method

http://stackoverflow.com/q/25729408
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/40276255
favorite count: 0
type: Question
has title: Error CEE9001 calling external stored procedure (RPGLE/AS400) from java
tagged with: stored-procedures
upvote count: 2
tagged with: rpgle
tagged with: java
tagged with: db2-400
type: UnansweredQuestion
has body: I have a error when I run a stored procedure from java that call to a simple RPGLE program If I run the SP from DB2 (System I navigator) is success or If i run the rpgle program is as400 return ok but when the SP is running from java the first execution is ok, the second execution return a error (CEE9901 - Application error. *N unmonitored by *N at statement*IN. instruction X'4000) and I dont know why!. someone could help me? this is my code SP CREATE PROCEDURE WOOLB3.SP806012 ( IN TRAMA CHAR(62) , INOUT RPTA CHAR(1) , INOUT VALOR CHAR(15) ) LANGUAGE RPGLE SPECIFIC WOOLB3.SP806012 NOT DETERMINISTIC MODIFIES SQL DATA CALLED ON NULL INPUT EXTERNAL NAME 'WOOLB3/IR806012' PARAMETER STYLE GENERAL ; GRANT ALTER , EXECUTE ON SPECIFIC PROCEDURE WOOLB3.SP806012 TO GRPAYP ; GRANT ALTER , EXECUTE ON SPECIFIC PROCEDURE WOOLB3.SP806012 TO GRPCAL ; GRANT ALTER , EXECUTE ON SPECIFIC PROCEDURE WOOLB3.SP806012 TO PUBLIC ; GRANT ALTER , EXECUTE ON SPECIFIC PROCEDURE WOOLB3.SP806012 TO QPGMR ; JAVA Connection conn = null; CallableStatement cs = null; StringBuffer sbSQL = new StringBuffer(); String valor = ""; try { log.info("Inicio--&gt;SP806012"); conn = ResourceManager.getConnection(JNDIContext.JNDI_DATASOURCE_MCD); String esquema = FrameworkParameters.getValue(MCDConstant.ESQUEMA_RPG); sbSQL.append("{CALL ").append(esquema); sbSQL.append(".").append(MCDConstant.SP_OBTIENE_VALOR_CUOTA).append("(?,?,?)}"); cs = conn.prepareCall(sbSQL.toString()); System.out.println(trama); cs.setString(1, trama); cs.setString(2, MCDConstant.VACIO); cs.setString(3, MCDConstant.VACIO); cs.registerOutParameter(2, java.sql.Types.VARCHAR); cs.registerOutParameter(3, java.sql.Types.VARCHAR); cs.execute(); if (cs.getString(2).equals(MCDConstant.STRING_UNO)){ valor = (String)cs.getString(3).trim(); } log.info("Fin--&gt;SP806012"); } catch (SQLException e) { e.printStackTrace(); throw new DAOException(e.getMessage(), e); } catch (Exception e) { e.printStackTrace(); throw new DAOException(e); } finally{ Resour…
score: 2

http://stackoverflow.com/comment/40357372
has text: Thanks for the reply. Yes, using HTTP 1.0, I am getting indeed a -1. I was hoping that using HTTP 1.1, I would get a content-length, but instead I am getting Transfer-Encoding: chunked
type: AnswerComment
comment on: http://stackoverflow.com/a/25800838
score: 0
type: Comment

http://stackoverflow.com/a/25743970
score: 0
has body: Edit:Syntax First add an id to your layout: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.brosselesdentsbatards.MainActivity" android:id="@+id/layout"&gt; &lt;TextView ... Then in you onCreate method: RelativeLayout rLayout= (RelativeLayout) findViewById(R.id.layout); rLayout.setOnTouchListener(new View.OnTouchListener() { public boolean onTouch(View v, MotionEvent event) { text1.setText("Debug3"); return gestureDetector.onTouchEvent(event); } });
has comment: http://stackoverflow.com/comment/40253407
answers question: http://stackoverflow.com/q/25743808
type: Answer
accepted answer of: http://stackoverflow.com/q/25743808
has comment: http://stackoverflow.com/comment/40253977
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40254138
has comment: http://stackoverflow.com/comment/40253623

http://stackoverflow.com/comment/40197155
has text: You are trying to insert nothing (NULL) into the `Key` column. This has nothing to do with the value in the `Dato` column.
comment on: http://stackoverflow.com/a/25714167
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40370845
score: 0
type: Comment
type: QuestionComment
has text: Class Controller belongs to a package in "Project1". The Application class belongs to a sibling package also in "Project1". And the BaseController class belongs to a package in another "Project2", that is included in the "Project1" build path.
comment on: http://stackoverflow.com/q/25776439

http://stackoverflow.com/comment/40395114
type: Comment
score: 0
has text: Thanks! I am still a bit confused, as I remember the teacher says something like: "this wider assignment is ok, but b1 will not have access to the fields in Derived." So what does this refer to? Does it mean that it can access z through method, like you said, but it can't access through b1.z?
type: AnswerComment
comment on: http://stackoverflow.com/a/25821734

http://stackoverflow.com/a/56756498
type: Answer
answers question: http://stackoverflow.com/q/25859921
upvote count: 1
score: 1
has body: It might be worth investigating low level rest client. With this you can do: RestClient esClient = RestClient.builder(new HttpHost("localhost", 9200, "http")).build(); Request request = new Request("POST", "/INDEX_NAME/_doc/_search"); request.setJsonEntity(yourJsonQueryString); Response response = esClient.performRequest(request); String jsonResponse = EntityUtils.toString(response.getEntity());
downvote count: 0

http://stackoverflow.com/comment/40257329
has text: I prefer explicit, but it is your choice :D
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25730924
type: AnswerComment

http://stackoverflow.com/comment/40324263
type: AnswerComment
type: Comment
has text: Well... alternatively, you can accept all chars i.e. any char, and validate only at the end, when the user has finished typing. Or... you can also accept the backspace as valid.
comment on: http://stackoverflow.com/a/25782755
score: 0

http://stackoverflow.com/q/25823367
has comment: http://stackoverflow.com/comment/40399514
has body: [UPDATE] i fixed the problem. user "Hovercraft Full Of Eels" was right, i changed 3D graphics settings prefer to nvidea driver and problem fixed i have problem and can't understand what is matter. i am creating simple GUI window and putting JTextField object on it. when i run project and enter text in text field it does not displays properly. i already tryed to reinstal java, but can't fix problem. can anyone help me? here is my GUI window image here is my code (no exception thrown, nor error was occured!) package test; import javax.swing.*; import java.awt.*; public class MainClass { public static void main(String[] args) { new Form().Run(); } } class Form{ JFrame form = new JFrame(); JButton btn = new JButton(); JTextField txt = new JTextField(); public Form(){ form.setLayout(new FlowLayout()); form.setSize(500, 500); form.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); btn.setText("caption"); form.add(btn); txt.setColumns(10); form.add(txt); } public void Run(){ form.setVisible(true); } }
has comment: http://stackoverflow.com/comment/40397982
has comment: http://stackoverflow.com/comment/40398032
tagged with: jtextfield
has comment: http://stackoverflow.com/comment/40397896
type: Question
has title: java text in textfield messing up
tagged with: java
has comment: http://stackoverflow.com/comment/40398558
score: 0
has comment: http://stackoverflow.com/comment/40398012
answer count: 1
has answer: http://stackoverflow.com/a/27228432
has comment: http://stackoverflow.com/comment/40397919
has comment: http://stackoverflow.com/comment/40398027
has comment: http://stackoverflow.com/comment/40397782
has comment: http://stackoverflow.com/comment/40397798
has comment: http://stackoverflow.com/comment/40397996
type: UnansweredQuestion

http://stackoverflow.com/q/25831683
favorite count: 0
upvote count: 1
has body: I'm just rtying to display an offerwall when someone is leaving the application, so I have placed the finish() method: @Override public void finish() { super.finish(); MobileCore.init(this.getContext(), "xxx", MobileCore.LOG_TYPE.DEBUG, MobileCore.AD_UNITS.OFFERWALL); MobileCore.setStickeezReadyListener(new OnReadyListener() { @Override public void onReady(MobileCore.AD_UNITS adUnit) { if (adUnit == MobileCore.AD_UNITS.OFERWALL) { MobileCore.showOferWall(getActivity()); } } }); } But I have problems. First of all with this code this.getContext() and also with this getActivity() I know that I can not access the activity this way, but I'm extremely confused at the moment. I know that I'm missing a very small part here. Can you give me a push?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25831719
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40416405
has answer: http://stackoverflow.com/a/25831714
accepted answer: http://stackoverflow.com/a/25831714
type: Question
has comment: http://stackoverflow.com/comment/40413294
downvote count: 0
has title: How can I get the context in the finish() method?
has answer: http://stackoverflow.com/a/25831722
answer count: 3
has answer: http://stackoverflow.com/a/25831719
tagged with: android
tagged with: android-activity

http://stackoverflow.com/comment/40430113
has text: please try this way :listAdapter = new VoteListAdapter(context,voteList); and now not required this code : listAdapter.setData(voteList);
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25823671
score: 0

http://stackoverflow.com/a/27951989
type: Answer
upvote count: 37
has body: You can use QueryBuilders.wrapperQuery(jsonQueryString);
score: 37
has comment: http://stackoverflow.com/comment/97616061
answers question: http://stackoverflow.com/q/25859921
downvote count: 0

http://stackoverflow.com/comment/40267872
type: Comment
has text: I believe that the problem is that your browser does not know how to display a List<UserType>.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25751929

http://stackoverflow.com/a/25730061
downvote count: 0
upvote count: 3
answers question: http://stackoverflow.com/q/25730032
has body: i&lt;=inyo.length() here. The String index starts from 0. The length count starts from one. So, the last index of a String is 4 when its length is 5. It should be i&lt;inyo.length()
type: Answer
score: 3

http://stackoverflow.com/q/25843805
has comment: http://stackoverflow.com/comment/40437988
type: Question
tagged with: jakarta-ee
accepted answer: http://stackoverflow.com/a/25878960
linked to: http://stackoverflow.com/q/22659970
tagged with: db2
has comment: http://stackoverflow.com/comment/40437132
score: 0
answer count: 1
has title: Error while reading image data:SqlException: [jcc][10120][11936][4.11.77] Invalid operation: Lob is closed. ERRORCODE=-4470, SQLSTATE=null
tagged with: wicket
has answer: http://stackoverflow.com/a/25878960
has body: I am working on application and in one page i have been fetching images from DB and i am not able to get the images in the front end but the page is loading and showing other details. I am using was liberty profile server for this application. Could you please suggest me regarding this problem. please find the error below. ERROR CustomRequestCycle - Unexpected exception org.apache.wicket.WicketRuntimeException: Error while reading image data at org.apache.wicket.markup.html.image.resource.BlobImageResource.getImageData (BlobImageResource.java:102) at org.apache.wicket.markup.html.image.resource.DynamicImageResource$1.getData(DynamicImageResource.java:194) Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][10120][11936][4.11.77] Invalid operation: Lob is closed. ERRORCODE=-4470, SQLSTATE=null at com.ibm.db2.jcc.am.gd.a(gd.java:660) at com.ibm.db2.jcc.am.gd.a(gd.java:60) at com.ibm.db2.jcc.am.gd.a(gd.java:94) at com.ibm.db2.jcc.am.ie.c(ie.java:67) at com.ibm.db2.jcc.am.je.v(je.java:203) at com.ibm.db2.jcc.am.je.getBinaryStream(je.java:107) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.hibernate.engine.jdbc.SerializableBlobProxy.invoke(SerializableBlobProxy.java:74) at $Proxy68.getBinaryStream(Unknown Source) at org.apache.wicket.markup.html.image.resource.BlobImageResource.getImageData(BlobImageResource.java:93) ... 55 more
type: AnsweredQuestion
tagged with: ibm-was
tagged with: java

http://stackoverflow.com/comment/40411967
type: Comment
has text: thank you it made it more clear specaillay this sentence "It's a custom object provided by jsoup to be able to loop over DOM elements.".
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25831083

http://stackoverflow.com/a/25850462
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If I understand your question, you could use String#replaceAll() and a regular expression. Something like this, String inputString = " test " + "link "; System.out.println(inputString); inputString = inputString.replaceAll("\\s*<a.*\\s*", ""); System.out.println(inputString); Output is test link test
upvote count: 3
answers question: http://stackoverflow.com/q/25850366
accepted answer of: http://stackoverflow.com/q/25850366
score: 3

http://stackoverflow.com/comment/40414416
type: QuestionComment
score: 0
has text: I also don't know english very well, here is what I do when I ask a question. 1) I write in sentence case. 2) I use Google Translator. 3) I spend lot of hours on it. This is very important.
comment on: http://stackoverflow.com/q/25832379
type: Comment

http://stackoverflow.com/a/25873088
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25871996
has comment: http://stackoverflow.com/comment/40488764
answers question: http://stackoverflow.com/q/25871996
type: AcceptedAnswer
downvote count: 0
score: 1
has body: http://opencsv.sourceforge.net/ has a readNext() method that is a bit more memory efficient than loading the entire file at once. That may stop you from having to load all 45 MBs of CSV all at once.

http://stackoverflow.com/comment/40314798
comment on: http://stackoverflow.com/q/25777581
type: Comment
has text: Why `[1, 3, 2]`? Why not `[1, 2, 3]`?
type: QuestionComment
score: 1

http://stackoverflow.com/comment/40474017
comment on: http://stackoverflow.com/q/25865156
score: 0
has text: Question is not clear. can you describe more and put some code what you tried till now.
type: Comment
type: QuestionComment

netbeans-7
tags question: http://stackoverflow.com/q/25805949
tags question: http://stackoverflow.com/q/25747389
tag name: netbeans-7
tags question: http://stackoverflow.com/q/25757539
type: Tag
tags question: http://stackoverflow.com/q/25816613

http://stackoverflow.com/comment/40375039
has text: change Syteme in System
comment on: http://stackoverflow.com/q/25811216
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25747484
has title: Apache Karaf 2.3.4 and org.springframework.beans.factory.annotation package dependency
has comment: http://stackoverflow.com/comment/42590005
tagged with: karaf
tagged with: java
type: UnansweredQuestion
has body: I'm trying to put a project on Apache Karaf but gets the following error: org.osgi.framework.BundleException: Unresolved constraint in bundle com.acme.services.serviceA-impl [59]: Unable to resolve 59.0: missing requirement [59.0] osgi.wiring.package; (osgi.wiring.package=org.springframework.beans.factory.annotation) at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3826)[org.apache.felix.framework-4.0.3.jar:] at org.apache.felix.framework.Felix.startBundle(Felix.java:1868)[org.apache.felix.framework-4.0.3.jar:] at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1191)[org.apache.felix.framework-4.0.3.jar:] at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:295)[org.apache.felix.framework-4.0.3.jar:] at java.lang.Thread.run(Thread.java:745)[:1.7.0_60] and my Maven pom.xml includes the following in the build-section: &lt;Import-Package&gt; org.slf4j, org.springframework.beans.factory.annotation &lt;/Import-Package&gt; Anyone have an idea how I can resolve this?
has comment: http://stackoverflow.com/comment/40445674
score: 2
tagged with: apache-karaf
answer count: 0
downvote count: 0
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40467591
upvote count: 2
tagged with: maven
tagged with: spring

http://stackoverflow.com/q/25798867
has answer: http://stackoverflow.com/a/25798886
answer count: 3
tagged with: abstract
has comment: http://stackoverflow.com/comment/40353571
accepted answer: http://stackoverflow.com/a/25798927
has answer: http://stackoverflow.com/a/25798985
type: AnsweredQuestion
has body: So I have this abstract class public abstract class A { protected final boolean b; protected A (boolean b){ this.b = b; } } And this class that extends A public class C extends A{ protected C() { super(false); } } I dont want "b" to be able to change its' value once it's initialized But I dont know how to do it without the compiler going haywire. Any suggestions are welcome. Thanks in advance. EDIT1: static removed from b. EDIT 2: Ok realised the problem and fixed see above. Special thanks to J.Lucky :)
tagged with: final
has comment: http://stackoverflow.com/comment/40353498
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40353556
has answer: http://stackoverflow.com/a/25798927
has title: Initializing a final variable in an abstract class (Java)
tagged with: class
tagged with: variables
possible better answer: http://stackoverflow.com/a/25798886
has comment: http://stackoverflow.com/comment/40353584
score: 0

http://stackoverflow.com/a/25873813
score: 0
has body: HAMR requires Java version 7 or above. It has been tested and verified with JDK 1.7.
type: Answer
answers question: http://stackoverflow.com/q/25858243

http://stackoverflow.com/q/25746662
tagged with: active-directory
tagged with: ldap
score: 0
has comment: http://stackoverflow.com/comment/40266682
has comment: http://stackoverflow.com/comment/40279114
answer count: 1
linked to: http://stackoverflow.com/q/41107
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40264125
tagged with: java
has body: We are able to create accounts in the active directory. But for some reason we are unable to login with them. The way our system works is a user applies for an account, an admin approves it and the user is sent a temporary password to login with. We think it may have to do with the permissions of the user but are not quite sure. Our code is extensive but here is some of our code and console log: javax.naming.OperationNotSupportedException: [LDAP: error code 53 - 0000052D: SvcErr: DSID-031A120C, problem 5003 (WILL_NOT_PERFORM), data 0 We are using the same random password generator listed in this previous post: How to generate a random alpha-numeric string? Java RandomPassword randPass = new RandomPassword(11); String temporaryPassword = randPass.nextString(); Attribute password = new BasicAttribute("unicodePwd", formatPassword(temporaryPassword)); The formatPassword function comes from this article: http://www.ramblingtech.com/will_not_perform-error-from-ad-on-password-change-using-java/
type: Question
tagged with: passwords
has comment: http://stackoverflow.com/comment/40264075
has answer: http://stackoverflow.com/a/25751828
accepted answer: http://stackoverflow.com/a/25751828
has comment: http://stackoverflow.com/comment/40264152
has title: How to reset password in AD, getting an LDP OperationNotSupported error

libraries
tags question: http://stackoverflow.com/q/25847910
tag name: libraries
type: Tag

http://stackoverflow.com/comment/40487112
score: 0
comment on: http://stackoverflow.com/a/25872184
has text: Let me check, I will get back as I check it
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25837543
possible better answer: http://stackoverflow.com/a/25837565
has body: Though we all know that Java doesn't support operator overloading, then why is the + operator an arithmetic operator as well as String concatenation operator. Can anybody explain this?
accepted answer: http://stackoverflow.com/a/25837559
has answer: http://stackoverflow.com/a/25837565
type: AnsweredQuestion
tagged with: operator-overloading
tagged with: java
type: Question
score: 0
answer count: 2
has title: Operator overloading confusion in Java
has answer: http://stackoverflow.com/a/25837559

http://stackoverflow.com/q/25815043
has answer: http://stackoverflow.com/a/25815787
type: Question
tagged with: derby
has title: Java Netbeans Derby embedded database not running on standalone mode (without Netbeans)
score: 0
answer count: 1
has body: Hello I'm working with: Windows 7 (64 bits) + Java 8 + NetBeans 8.0 and learning embedded databases with Derby. I follow a simple sample "Using The Built-In Derby Database In NetBeans Starting A Java DB Application In NetBeans 6.1" https://www.youtube.com/watch?v=gCY4mcKa8-E https://www.youtube.com/watch?v=FwCe0-uYYiE The sample is fine, and the program run OK on Netbeans. Then I Create and Build so I can learn to pack and deploy the program on anothers computers. If I open the /dist folder and run the JAR file nothing happens.. The only way to run the program is if I open Netbeans and start the JB server. But I cant run the program without Netbeans support. What is wrong?
type: UnansweredQuestion
tagged with: netbeans
tagged with: java

http://stackoverflow.com/a/25851469
downvote count: 0
type: Answer
upvote count: 5
has body: Yes, you'd define an interface as an abstract class containing pure virtual functions (with the purity indicated by = 0), just like that. Like Java's interfaces, abstract classes can't be instantiated directly, but must be derived from by concrete classes which override and implement the pure virtual functions. There are a couple of issues: the keyword to introduce a class is class not Class you'll want to take the IPerson parameter by reference, IPerson &amp;, not by value; abstract classes can't be passed by value. The same probably applies to the Ward argument; even if it's not abstract, you probably want this class to refer to a ward (as the Java version would), not copy one. Unlike Java, passing a class object to a function will pass a copy of the object, unless you specifically request that it's passed by reference.
answers question: http://stackoverflow.com/q/25851296
score: 5

http://stackoverflow.com/q/25788709
type: Question
tagged with: jodatime
upvote count: 6
tagged with: date
accepted answer: http://stackoverflow.com/a/25788851
has comment: http://stackoverflow.com/comment/40339836
favorite count: 0
has answer: http://stackoverflow.com/a/25788851
has title: Convert time in millis since epoch to "mm/dd/yy"
has body: I'm converting a date string to millis like this import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.format.DateTimeFormat; import org.joda.time.format.DateTimeFormatter; private static final DateTimeZone PST = DateTimeZone.forID("PST8PDT"); private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormat.forPattern("yyyy-MM-dd").withZone(PST); Long millis = DateTime.parse(startDate, DATE_FORMATTER).withTimeAtStartOfDay().getMillis()); where startDate is the date I want to convert. How do I reverse engineer this to get the date in PST when I have the millis ?
answer count: 4
has answer: http://stackoverflow.com/a/29090196
type: AnsweredQuestion
downvote count: 0
tagged with: java
score: 6
has answer: http://stackoverflow.com/a/25788850
possible better answer: http://stackoverflow.com/a/29090196
has answer: http://stackoverflow.com/a/25805916

http://stackoverflow.com/a/25819974
answers question: http://stackoverflow.com/q/25819889
type: Answer
downvote count: 1
has body: Is this ok? class Test { public static void main(String args[]) { java.util.Scanner in = new java.util.Scanner(System.in); String x = in.nextLine(); System.out.println("\n The type of the variable is : "+x.getClass()); } } Output: subham@subham-SVE15125CNB:~/Desktop$ javac Test.java subham@subham-SVE15125CNB:~/Desktop$ java Test hello The type of the variable is : java.lang.String
upvote count: 0
score: -1

http://stackoverflow.com/a/25869850
accepted answer of: http://stackoverflow.com/q/25869768
has comment: http://stackoverflow.com/comment/40482855
answers question: http://stackoverflow.com/q/25869768
has comment: http://stackoverflow.com/comment/40482416
score: 4
has comment: http://stackoverflow.com/comment/40482636
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40482804
type: Answer
has comment: http://stackoverflow.com/comment/40482366
upvote count: 4
downvote count: 0
has body: If you want to add your class as an Onclicklistener: Button1.addActionListener(this); then your class must implement the appropriate interface ActionListener like this: public class Soundboard implements ActionListener{ //... @Override public void actionPerformed(ActionEvent e){ //... } } EDIT If you have multiple buttons, that need separated implementation, you could f.e. use anonymous classes: mybutton.addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent e){ //does something, that probably interests only mybutton //declare mybutton as **final** if you must use it } });

http://stackoverflow.com/comment/40232621
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25713957
has text: Ok. Can you elaborate on what you want the stump to be like? Also, what have you tried, and why did it fail?
score: 0

http://stackoverflow.com/a/25748902
answers question: http://stackoverflow.com/q/25748147
score: 0
has body: To get the maximum value: // getting the maximum value public static int getMaxValue(int[] array){ int maxValue = array[0]; for(int i=1;i &lt; array.length;i++){ if(array[i] &gt; maxValue){ maxValue = array[i]; } } return maxValue; }
type: Answer

http://stackoverflow.com/q/25843843
score: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25844090
tagged with: incompatibletypeerror
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25844090
has title: Parameterize iterable wrapper in Java: incompatible types error
upvote count: 1
answer count: 1
favorite count: 0
tagged with: iterable
has body: Let's assume I have some wrapper class over an iterable object. The wrapper itself is made iterable as well, bringing the functionality one level up. public class Wrapper implements Iterable&lt;ObjectField&gt; { private final InnerObject obj; Wrapper(InnerObject obj) { this.obj = obj; } @Override public Iterator&lt;ObjectField&gt; iterator() { return new FieldIterator(obj); } } where ObjectField is the inner field of my wrapper object and FieldIterator is declared as public class FieldIterator implements Iterator&lt;ObjectField&gt; { private final InnerObject obj; public FieldIterator(InnerObject obj) { this.obj = obj; } @Override public boolean hasNext() { return obj.hasNext(); } @Override public ObjectField next() { return obj.next(); } @Override public void remove() { obj.remove(); } } and the wrapper is used somethere in code as follows for (ObjectField f : wrapper) { // some code } Now I want to parameterize the wrapper with descendants of InnerObject class: public class Wrapper&lt;T extends InnerObject&gt; implements Iterable&lt;ObjectField&gt; { private final T obj; Wrapper(T obj) { this.obj = obj; } @Override public Iterator&lt;ObjectField&gt; iterator() { return new FieldIterator(obj); } } But when I do this, the client code for (ObjectField f : wrapper) stops compiling, saying: Incompatible types. Required: ObjectField, Found: java.lang.Object Please forgive me my simple question, as I am just learning Java. I suspect that the behaviour is related to Java's type erasure, but still cannot figure out how to implement this simple pattern.
downvote count: 0

http://stackoverflow.com/a/25745892
type: Answer
score: 2
upvote count: 2
has body: The most famous example is of the use of the interface Serializable. This is often repeated for the purpose of: Should the super interface suddenly gets detached from Serializable interface, it's sub-interface will still remain Serializable since it's already defined as Serializable. This often occurs doing code refactoring. Other than that, there is no difference.
downvote count: 0
answers question: http://stackoverflow.com/q/25745767

http://stackoverflow.com/q/25838405
type: Question
has body: I am new to Glass development... so hopefully someone has experienced this issue or can tell me what I am doing wrong. I am basically just using the Mirror API sample app downloaded from Google/GitHub. Everything works fine.. I am able to deploy it to our App Engine account and can authenticate via the front end into the app etc etc.... When we make a change to the app and update it on our Google AppEngine instance, are all users who have authenticated lost? It appears that users need to re-authenticate after we make a changes to the code and update it. I can't seem to figure this out. Please help. Thanks in advance.
has comment: http://stackoverflow.com/comment/40447900
score: 0
has answer: http://stackoverflow.com/a/27411245
has comment: http://stackoverflow.com/comment/40426712
answer count: 1
has title: Users lost after new version is uploaded to Google App Engine
has comment: http://stackoverflow.com/comment/40426448
tagged with: google-glass
type: UnansweredQuestion
tagged with: google-app-engine
tagged with: google-mirror-api
tagged with: java

http://stackoverflow.com/q/25775537
upvote count: 0
has comment: http://stackoverflow.com/comment/40311367
answer count: 1
favorite count: 0
score: -3
has comment: http://stackoverflow.com/comment/40311252
has comment: http://stackoverflow.com/comment/40311161
accepted answer: http://stackoverflow.com/a/25775820
type: AnsweredQuestion
tagged with: java.util.scanner
tagged with: java
downvote count: 3
has title: How can I get a user to input values to this average program
type: Question
has comment: http://stackoverflow.com/comment/40312280
has body: I have been trying to get a user to enter numbers into the average program but am having difficulty. Would I need to make and array to store the values in? The code I have written so far is below, at the moment I am trying to parse and Int value which is not working any suggestions, would prefer if people just gave explanations rather the code. Many Thanks import java.util.Scanner; class apples { public static void main(String[] args){ int test []; int grade=0; int i=0; Scanner sc = new Scanner(System.in); while (i&lt;10){ System.out.println("Enter numbers for average"); test = sc.nextInt[](); System.out.println(average(test)); i++; } } public static int average(int...numbers){arguments int total=0; for(int x:numbers) total+=x; return total/numbers.length; } }
has comment: http://stackoverflow.com/comment/40312057
has answer: http://stackoverflow.com/a/25775820

http://stackoverflow.com/q/25816146
linked to: http://stackoverflow.com/q/7652821
has comment: http://stackoverflow.com/comment/40385160
tagged with: jdialog
linked to: http://stackoverflow.com/q/25786904
tagged with: windowlistener
score: 0
possible better answer: http://stackoverflow.com/a/25816433
has body: Let's suppose two JDialogs, j1 and j2, and I need j2 to be closed when I hit the "X" button on the j1. I tried to implement WindowListener on j1, and I used j2.dispose() in the windowClosing() and the windowClosed() methods but it didn't work. Is it possible to put an actionPerformed on the "X" button for example? or is it possible to do it using a windowListener and how? Thank you in advance.
has comment: http://stackoverflow.com/comment/40385705
tagged with: swing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25816433
has title: Closing two JDialogs at the same time
tagged with: java
has answer: http://stackoverflow.com/a/25816537
accepted answer: http://stackoverflow.com/a/25816537
type: Question
answer count: 2

http://stackoverflow.com/q/25753914
has comment: http://stackoverflow.com/comment/40272954
has comment: http://stackoverflow.com/comment/40271721
has comment: http://stackoverflow.com/comment/40273655
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40271649
has comment: http://stackoverflow.com/comment/40273000
upvote count: 1
has comment: http://stackoverflow.com/comment/40271757
has comment: http://stackoverflow.com/comment/40271644
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/40271710
has comment: http://stackoverflow.com/comment/40271749
has comment: http://stackoverflow.com/comment/40271694
type: Question
has comment: http://stackoverflow.com/comment/40271777
answer count: 2
has answer: http://stackoverflow.com/a/25753978
has comment: http://stackoverflow.com/comment/40271679
score: -2
has comment: http://stackoverflow.com/comment/40271692
has title: Infinite loop value
favorite count: 0
has comment: http://stackoverflow.com/comment/40272038
has comment: http://stackoverflow.com/comment/40272134
has body: What initial values of x would make the loop infinite? I was told the answer is 123, but I don't understand how. Can somebody explain this? do { x = x - 3; } while (x &lt; 120);
has answer: http://stackoverflow.com/a/25754417
has comment: http://stackoverflow.com/comment/40271645
has comment: http://stackoverflow.com/comment/40271650

http://stackoverflow.com/comment/40342842
score: 0
type: AnswerComment
type: Comment
has text: `"and it should work"` - It will *compile*, yes. But the logic will be fundamentally changed and it will no longer "work" at runtime.
comment on: http://stackoverflow.com/a/25793391

http://stackoverflow.com/a/25755670
downvote count: 0
has comment: http://stackoverflow.com/comment/40314004
has comment: http://stackoverflow.com/comment/40314191
upvote count: 8
has comment: http://stackoverflow.com/comment/40313853
accepted answer of: http://stackoverflow.com/q/25755446
answers question: http://stackoverflow.com/q/25755446
has comment: http://stackoverflow.com/comment/40314294
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40314370
has comment: http://stackoverflow.com/comment/40314396
type: Answer
score: 8
has body: Each time you call this.next.nth(), you are calling nth() method on a completely different object. Your this will refer to that new object (in previous stack it was next). Its not a pure recursion. Just think as if you are calling different method on some different object. So when position=1 the this would refer to S5. UPDATE Lets say your List_Nodes are chained like this 10->20->30->40->50 Whenever you call node.nth(5) from main, Stack 1: position 5, this points to 10 (you are calling this.next.nth(4); means 20.nth()) Stack 2: position 4, this points to 20 (calling this.next.nth(3); = 30.nth()) Stack 3: position 3, this points to 30 (calling this.next.nth(2) = 40.nth()) Stack 4: position 2, this points to 40 (calling this.next.nth(1) = 50.nth()) Stack 5: position 1, this points to 50 (returning this; this here is 50) returns 50 returns 50 (not going back into if, so return value remains same) returns 50 returns 50 returns 50 The same this is depicted in a picture while discussing on chat. Adding it here, to benefit future reader. Another UPDATE No assignment variable in else as such You can write this like List_Node temp = this.next.nth(position-1); return temp; In general, we need to separate List and Node classes, your List should have an head and your Node will have item and next pointer. Just like the LinkedList in java. Then the nth() method will be in List class and it just iterates through it until you reach the nth element.

http://stackoverflow.com/comment/40358184
score: 4
type: Comment
comment on: http://stackoverflow.com/a/25801456
type: AnswerComment
has text: this is **definitely the better approach** then programmatically handle queries... we're working with java and DBs and any other idea is rather scaring!

http://stackoverflow.com/a/25720084
downvote count: 0
has comment: http://stackoverflow.com/comment/40208572
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40208251
upvote count: 1
has body: You can't print your HTML with CSS. The best shot that you got is to use PDFs, that's what they are for. Create a PDF from the HTML using Java and print it
answers question: http://stackoverflow.com/q/25719924

http://stackoverflow.com/comment/40298696
comment on: http://stackoverflow.com/q/25769176
score: 0
type: Comment
has text: http://stackoverflow.com/questions/153724/how-to-round-a-number-to-n-decimal-places-in-java
type: QuestionComment

http://stackoverflow.com/a/34158764
answers question: http://stackoverflow.com/q/25787197
has body: I had similar issue. Below is my detailed error message: Could not get the value for parameter encoding for plugin execution default-resources Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.apache.maven:maven-plugin-api:jar:2.0.6, org.apache.maven:maven-project:jar:2.0.6, org.apache.maven:maven-profile:jar:2.0.6, org.apache.maven:maven-artifact-manager:jar:2.0.6, org.apache.maven:maven-plugin-registry:jar:2.0.6, org.apache.maven:maven-core:jar:2.0.6, org.apache.maven:maven-plugin-parameter-documenter:jar:2.0.6, org.apache.maven:maven-repository-metadata:jar:2.0.6, org.apache.maven:maven-error-diagnostics:jar:2.0.6, org.apache.maven:maven-plugin-descriptor:jar:2.0.6, classworlds:classworlds:jar:1.1, org.apache.maven:maven-artifact:jar:2.0.6, org.apache.maven:maven-settings:jar:2.0.6, org.apache.maven:maven-model:jar:2.0.6, org.apache.maven:maven-monitor:jar:2.0.6: Failure to transfer org.apache.maven:maven-plugin-api:jar:2.0.6 from https://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:maven-plugin-api:jar:2.0.6 from/to central (https://repo.maven.apache.org/maven2): connect timed out From the first look, it seems the connection to the central repository failed. But actually it turns out something is f**ked up in my local repository. Rather than spend time to figuring out what's wrong with my 10G local repository, I use an empty folder as the new local repository. And error is gone. This is not a solution. This is just a workaround. I think maven is not robust enough when local repository gets big. And the misleading error message has wasted me a lot of time to check network or proxy issue. Hope it can save other souls some time. BTW: Apache Maven Cookbook 2015 is a very go…
score: 1
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40239202
score: 1
comment on: http://stackoverflow.com/q/25735952
has text: @coolcfan But what can i do if i've already created my java app without using maven?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40307545
type: QuestionComment
comment on: http://stackoverflow.com/q/25773815
has text: setContentView(dalsi_akce); What are you trying to do with this?
score: 0
type: Comment

http://stackoverflow.com/comment/40297858
has text: @StackOverflowException I have updated this to answer the question asked, and to include this proposed advise.
comment on: http://stackoverflow.com/a/25768639
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40482325
type: AnswerComment
score: 0
type: Comment
has text: You set up the server to serve out of the JavaScript directory. This is pretty easy in Spring MVC, and I know that running in Eclipse, it's all set up automatically. If you want it to run without needing an IDE to manage the classpath, have the profile that puts you in dev mode (no caching, etc.) also set the server's lookup path to include the `file:` URL of the on-disk repository.
comment on: http://stackoverflow.com/a/25856510

http://stackoverflow.com/q/25815074
has comment: http://stackoverflow.com/comment/40383666
has title: mongodb how to convert _id to String in JAVA
has answer: http://stackoverflow.com/a/38011354
has answer: http://stackoverflow.com/a/71064238
has answer: http://stackoverflow.com/a/40127027
favorite count: 0
tagged with: mongodb-query
has body: I am reading mongo collection from java code. When I am trying to read the _id value, I am getting the following: {"$oid":"541333629520f6e05b0cb410"} I am reading like: jsonObject.get("_id") from java code. I was expecting something like: "_id" : "541333629520f6e05b0cb410" Here I am looking for a way so that I can get the _id as a string in one operation. So far I have been trying the following: JSONObject idObj = (JSONObject)JSONObj.get("_id"); ObjectId objectId = (ObjectId) idObj.get("$oid");
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40382866
score: 2
has comment: http://stackoverflow.com/comment/40384120
tagged with: java
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/25815738
downvote count: 0
has answer: http://stackoverflow.com/a/74273236
answer count: 6
has answer: http://stackoverflow.com/a/56473380

http://stackoverflow.com/q/25777722
type: UnansweredQuestion
upvote count: 1
has title: Need Help Adding an Integer Array to an Array List in Processing
downvote count: 1
tagged with: processing
tagged with: java
has answer: http://stackoverflow.com/a/25777745
has body: Ok... So I am in the middle of a project, and I've hit a bit of a wall. If anyone could please explain how to add an integer array to an ArrayList of integer Arrays, I would greatly appreciate it. This is in processing, the javascript version more specifically. I have tested and everything works right up to 'symbols.get(i).add(tempArray). If I print tempArray right before that line it gives me '6 10 16 10 16 20', as it should. And no, it's not just the println(symbols) statement, I also tried just 'println("blah");'and that did not show up in the output, so something is going awry at the .get line. size(850,250); String[] myList = new String[100]; ArrayList&lt;Integer[]&gt; symbols = new ArrayList&lt;Integer[]&gt;(); int[] tempArray = new int[]; String numbers = ("6,10,16,10,16,20\n1,25,21,13,3,15\n6,5,20,6,21,20"); myList = (split(numbers, "\n")); int j = myList.length(); for(int i = 0; i&lt;j; i++) { tempArray = int(split(myList[i], ',')); symbols.get(i).add(tempArray); } println(symbols); ... I have also tried the following in place of 'symbols.get(i).add(tempArray);' for(int a = 0; a &lt; tempArray.length(); a++) { symbols.get(i[a]) = tempArray[a]; } println(symbols); ... I have also tried for(int a = 0; a &lt; tempArray.length(); a++) { symbols.get(i) = tempArray[a]; } println(symbols); ... and for(int a = 0; a &lt; tempArray.length(); a++) { symbols[i][a] = tempArray[a]; } println(symbols); I'm out of guesses and tries, any help would be appreciated.
type: Question
score: 0
answer count: 2
tagged with: arrays
tagged with: javascript
has comment: http://stackoverflow.com/comment/40315846
favorite count: 0
tagged with: arraylist
has answer: http://stackoverflow.com/a/25788320

http://stackoverflow.com/q/25842882
tagged with: libgdx
tagged with: audio-streaming
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40435910
tagged with: background-music
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40437211
has title: Music streaming in libgdx doesn't work (JAVA)
has answer: http://stackoverflow.com/a/25844254
accepted answer: http://stackoverflow.com/a/25844254
type: Question
has body: So I've been working on a libGDX project, and I have encountered a problem here: public class Main extends ApplicationAdapter implements Screen { (...) @Override public void create() { (...) //Starts playing Main theme Music MusicPlayer.determineMusic(mainTheme, splash); } public void render() { Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); batch.begin(); //was: //splash.splashRenderer(mainTheme, batch, splashSprite); //changed to: splash.splashRenderer(batch, splashSprite); batch.end(); System.out.println("******************End of Render******************"); } public class SplashScreen { Music gameTheme ; public SplashScreen(){ } public void splashRenderer(SpriteBatch batch, Sprite splashSprite) { batch.draw(splashSprite, 0, 0, MyConstants.WINDOW_WIDTH, MyConstants.WINDOW_HEIGHT); } @Override public void show() { //gameTheme = Gdx.audio.newMusic(Gdx.files.internal("blah.mp3")); //gameTheme.play(); } @Override public void hide() { //gameTheme.dispose(); } @Override public void dispose() { //gameTheme.dispose(); } } public class MusicPlayer { protected MusicPlayer(){ } public static void determineMusic(Music Theme, AbstractScreen screen){ if ((screen instanceof GameScreen) == false){ Theme.play(); } } } The code so far basically just loads a music file and a sprite and draws it on the screen through the splashRenderer method, but my problem is that the music doesn't start. Any help will be greately appreciated. Thanks in advance. EDIT1~ I implemented Screen, changed the method to splashRenderer(SpriteBatch, Sprite) &amp; made the music file load and play in the show method and dispose() it in the hide and in the dispose methods. I didn't add anything to the pause() method because I think it is done automatically. EDIT2~ I noticed that the music doesn't start this time either. The solution I came up with is to make a new class MusicPlayer() that will determine whether or not to play and which track. The musicPlayer is first called explicit…

http://stackoverflow.com/a/25865442
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25865327
has body: Before run your code you need to correct your code else this code not compile at least. private Point[] pointArray; // you have declare the array But you never initialize it. First initialize this. Again you are calling toString() method of an Array. Never do that since it will call Object class toString() method in Java. Edit: for your comment. I dont know the size of the array as it depends on the file. Then use List instead of Array List&lt;Point&gt; pointsList=new ArrayList&lt;&gt;(); Not only this advantage but also you can directly call toString() not like in Arrays. Since toString() method has override in AbstractCollection, you need to override toString() method in your Point class
score: 1
upvote count: 1

http://stackoverflow.com/comment/40452253
type: AnswerComment
has text: Yeah I'm sorry. My bad. However that solution will still require using the substring method. Anyway, I guess I'm just going to ignore the course requirement that prevents using IndexOf or Substring. It seems like that is the only way to solve the problem using only arrays and nested loops.
comment on: http://stackoverflow.com/a/25839592
type: Comment
score: 0

http://stackoverflow.com/comment/40207011
type: Comment
type: QuestionComment
has text: Are you able to build it yourself to find out if there are no bugs with the Jenkins job?
comment on: http://stackoverflow.com/q/25718950
score: 0

http://stackoverflow.com/comment/40224540
comment on: http://stackoverflow.com/a/25723870
type: Comment
has text: Hey thanks this helped a lot!. How do i check when the timer is finished or reaches 0 in another class.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25718929
tagged with: spring
has body: Below is the model, service implementation and the error trace of my code. Model class: @Entity @Table(name = "ph_diagnosis_history") @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id",scope=Diagnosis.class) public class Diagnosis extends AbstractEntity { @Column(name = "diagnosis_notes", length=255) @Length(max = 255, message = IprProp.MAX_LEN_255_MSG) private String diagnosisNote; @Enumerated(EnumType.STRING) private DiagnosisTypeEnum type; @Temporal(TemporalType.DATE) @Column(name = "diagnosis_date") @JsonSerialize(using = JsonDateSerializer.class) private Date diagnosisDate; @ManyToOne @JoinColumn(name = "patient_chart_id") private PatientChart patientChart; public String getDiagnosisNote() { return diagnosisNote; } public void setDiagnosisNote(String diagnosisNote) { this.diagnosisNote = diagnosisNote; } public DiagnosisTypeEnum getType() { return type; } public void setType(DiagnosisTypeEnum type) { this.type = type; } public Date getDiagnosisDate() { return diagnosisDate; } public void setDiagnosisDate(Date diagnosisDate) { this.diagnosisDate = diagnosisDate; } public PatientChart getPatientChart() { return patientChart; } public void setPatientChart(PatientChart patientChart) { this.patientChart = patientChart; } } My service: public Diagnosis updateDiagnosis(IPRDTO clientDto, Long userId, Long patientChartId, DiagnosisDTO diagnosisDTO, Long diagnosisId) throws Exception { Diagnosis diagnosis = diagnosisRepository.findOne(diagnosisId); if (diagnosis!=null){ if(diagnosis.getType().equals(DiagnosisTypeEnum.WORKING)){ BeanCopyUtil.copyProperties(diagnosisDTO, diagnosis, true); return this.diagnosisRepository.saveAndFlush(diagnosis); } else{ throw new BusinessException("updateDiagnosisValidation"); } } throw new BusinessException("noDiagnosis"); } My stack trace: [2014-09-08 11:34:08,148] INFO com.zurelsoft.ipr.service.IDiagnosisService- Logged In User Id [1]:Started updateDiagnosis diagnosis id 2 [2014-09-08 11:34:08,969] …
linked to: http://stackoverflow.com/q/24210478
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/25719030
has title: More than one row with the given identifier was found: 1, for class: com.model.Diagnosis
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25719081
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/36043499

http://stackoverflow.com/comment/40300751
score: 0
type: Comment
has text: It didn't work :( I'll ask a new question and post a link just now. [link](http://stackoverflow.com/questions/25770412/cardlayout-panels-not-changing) Thanks in advance for help guys.
comment on: http://stackoverflow.com/a/25749682
type: AnswerComment

http://stackoverflow.com/comment/40195471
type: QuestionComment
score: 1
has text: I still don't what `tick` does and what you are trying to achieve with it. Can you explain your requirement for which you are trying to implement so called `tick` ?
comment on: http://stackoverflow.com/q/25713336
type: Comment

http://stackoverflow.com/comment/40778619
type: Comment
has text: I've pasted the layout.jsp now. But when I commented the line <!--<tiles:insert attribute="header" flush="true" />--> in layout.jsp the page goes blank, seems its dependent for all the jsp(s) in common. I doubt the issue is not only with this..
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25855603

http://stackoverflow.com/a/25722874
type: Answer
upvote count: 1
score: 1
has body: Straight from the Java documentation: 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. Therefore, your latter explanation is correct.
answers question: http://stackoverflow.com/q/25722743
downvote count: 0

jsf
tags question: http://stackoverflow.com/q/25809772
type: Tag
tag name: jsf
tags question: http://stackoverflow.com/q/25719201

http://stackoverflow.com/comment/40463096
score: 0
has text: Appreciate any help. Thanks.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25858862

http://stackoverflow.com/q/25719070
answer count: 1
has title: Android Universal Image Loader Timeout
favorite count: 0
tagged with: android
type: AnsweredQuestion
tagged with: universal-image-loader
downvote count: 0
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40209996
has body: I am using Android Universal Image Loader for Downloading Image from an URL.Because My Image Size is large,Image Loader reach 5 second timeout and throw an exception. How can I increase ImageLoader Time out? Also you must know, I found below code but it didn't work because this library hasn't this function. imageDownloader(new URLConnectionImageDownloader(5 * 1000, 20 * 1000)); my ImageLoaderConfig : ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).build(); ImageLoader.getInstance().init(config);
has comment: http://stackoverflow.com/comment/40207131
has answer: http://stackoverflow.com/a/25719451
accepted answer: http://stackoverflow.com/a/25719451
upvote count: 1

http://stackoverflow.com/a/25774188
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40308362
answers question: http://stackoverflow.com/q/25774060
has body: It prints star 1 when (linje==start) and star 2 when (linje==end). After the inner loop, linje>hoyde, therefore exiting the outer loop. As noted above you might want to give your loop variables different names.
has comment: http://stackoverflow.com/comment/40308503

http://stackoverflow.com/comment/40402780
score: 0
type: QuestionComment
type: Comment
has text: @khmarbaise: Could you please answer, so that I can accept it?
comment on: http://stackoverflow.com/q/25825854

http://stackoverflow.com/q/25870764
has comment: http://stackoverflow.com/comment/40485565
has comment: http://stackoverflow.com/comment/40486941
score: 3
has comment: http://stackoverflow.com/comment/40486871
downvote count: 0
has comment: http://stackoverflow.com/comment/40487812
has answer: http://stackoverflow.com/a/28972463
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/40506642
has answer: http://stackoverflow.com/a/25873572
type: UnansweredQuestion
tagged with: spring
has title: Deploying a spring-boot application as a war file on a dedicated tomcat is not working
answer count: 4
tagged with: spring-mvc
upvote count: 3
tagged with: java
has body: I have a spring-boot application and now that I want to deploy the application on a dedicated tomcat server and not using the embedded tomcat. Both ways on deploying I'm not getting any error. I have given the scope=provided for the spring-boot-starter-tomcat dependency. When I run the application with embedded tomcat (with appropriate changes made), its working perfectly on hitting the link http://localhost:8080/testGET. But when I ran on the dedicated tomcat with scope=provided, on hitting the link http://localhost:8080/test-results-upload-1.0/testGET or http://localhost:8080/testGET I'm getting the response mapped to /error. Please help me with this. Not able to understand mistake I'm doing.. Thanks in advance. @EnableAutoConfiguration @Configuration @EnableWebMvc @ComponentScan("com............controller") @Import(SpringMongoConfig.class) public class BootStrap extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(BootStrap.class, args); } @Override protected SpringApplicationBuilder configure( SpringApplicationBuilder application) { return application.sources(BootStrap.class); } } . @Controller public class Controller { @Autowired(required = true) private IRepository config; @RequestMapping(value = "/testGET", method = RequestMethod.GET) public String testGet(HttpServletResponse response) { try { response.sendError(HttpStatus.OK.value()); return "Application working perfectly !"; } catch (IOException e) { e.printStackTrace(); return null; } } } . <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 test-results-upload test-results-upload 1.0 war <spring.boot>1.1.5.RELEASE</spring.boot> org.springframework.boot spring-boot-starter ${spring.boot} org.springframework.boot spring-boot-starter-tomcat ${spring.boot} provided org.springframework.boot spring-boot-sta…
type: Question
has answer: http://stackoverflow.com/a/33893109
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/40491791
has answer: http://stackoverflow.com/a/25892122

http://stackoverflow.com/q/25872973
favorite count: 0
has answer: http://stackoverflow.com/a/25873025
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/40488914
linked to: http://stackoverflow.com/q/11881552
tagged with: oop
score: 1
tagged with: java
has body: I came across this answer while looking for a way to implement aggregation and composition in Java. Here's the answerer's implementation for composition - final class Car { private final Engine engine; Car(EngineSpecs specs) { engine = new Engine(specs); } void move() { engine.work(); } } I wanted to ask whether it is mandatory to declare engine as private final for it to be a valid composition? Does composition also imply that the attributes of engine will never change during its lifetime?
tagged with: uml
type: Question
has answer: http://stackoverflow.com/a/25873022
has answer: http://stackoverflow.com/a/25873098
downvote count: 0
answer count: 3
has title: Is it necessary for a composition not to be modified?
linked to: http://stackoverflow.com/q/21951602

http://stackoverflow.com/q/25803428
score: 6
has comment: http://stackoverflow.com/comment/40361561
accepted answer: http://stackoverflow.com/a/25804241
tagged with: user-interface
answer count: 4
has body: I am new to java UI programming. how do i call a UI class from a main class in java public static void main(String[] args) { // TODO code application logic here FileExtractorGUI gui = new FileExtractorGUI(); gui.setVisible(true); } Basically FileExtractorGUI is a gui class. How do I load the GUI when I run the program. Currently nothing happens when I run the code. GUI CLass package fileextractor; import javax.swing.JOptionPane; /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ /** * * @author */ public class FileExtractorGUI extends javax.swing.JPanel { /** * Creates new form FileExtractorGUI */ public FileExtractorGUI() { 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() { SourceField = new javax.swing.JTextField(); jLabel1 = new javax.swing.JLabel(); DestinationField = new javax.swing.JTextField(); jLabel2 = new javax.swing.JLabel(); Extract = new javax.swing.JButton(); SourceField.setText("SourceField"); SourceField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { SourceFieldActionPerformed(evt); } }); jLabel1.setText("SourceFolder"); DestinationField.setText("DestinationField"); jLabel2.setText("DestinationFolder"); Extract.setText("Extract"); Extract.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { ExtractActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.L…
favorite count: 0
has comment: http://stackoverflow.com/comment/40361741
possible better answer: http://stackoverflow.com/a/25803548
has answer: http://stackoverflow.com/a/25803666
has answer: http://stackoverflow.com/a/25803548
tagged with: swing
upvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25804185
tagged with: java
has comment: http://stackoverflow.com/comment/40361735
has answer: http://stackoverflow.com/a/25804241
has title: How to load a Java GUI class from a main class?
type: Question
downvote count: 0

http://stackoverflow.com/comment/110135313
score: 0
type: Comment
has text: What package on maven repo contains org.eclipse.jetty.util.log.Log??
comment on: http://stackoverflow.com/a/25794109
type: AnswerComment

http://stackoverflow.com/a/26883344
has body: It is supposed that elements in the array are sorted in non-decreasing order. My O(N) solution in JavaScript: function solution(A, B) { var scale = 1000000; var N = A.length; var count=0; var left = 0; var right = N-1; var C_left = 0; while(left&lt;right){ //to avoid rounding errors, use multiplication C_left = A[left]*scale+B[left]; if(C_left&gt;=scale){ if(C_left*(A[right]*scale+B[right])&gt;=(C_left+(A[right]*scale+B[right]))*scale){ // if C[left],C[right] is ok, that means that all elements C[left++],C[right] to satisfy condition count+=right-left; right--; }else{ left++; } }else{ left++; } } //condition from codility.com test if(count&gt;1000000000) return 1000000000; else{ return count; } }
score: -1
answers question: http://stackoverflow.com/q/25750240
downvote count: 2
type: Answer
upvote count: 1

base36
type: Tag
tag name: base36
tags question: http://stackoverflow.com/q/25851786

http://stackoverflow.com/comment/40309326
type: Comment
type: QuestionComment
has text: Without the code of the repository, and the code of the rest service persisting the offer, it's hard to tell.
comment on: http://stackoverflow.com/q/25771892
score: 0

http://stackoverflow.com/comment/40212468
has text: It also returns a lot of system processes?
type: AnswerComment
comment on: http://stackoverflow.com/a/25722153
score: 0
type: Comment

http://stackoverflow.com/comment/40441523
has text: possible duplicate of [Why variables are not behaving as same as method while Overriding.?](http://stackoverflow.com/questions/17201227/why-variables-are-not-behaving-as-same-as-method-while-overriding)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25847300

http://stackoverflow.com/comment/40442264
type: AnswerComment
score: 0
has text: yes, that solution has been discussed as top bullet #1 ... i see you have a more sophisticated approach then Andoid-Developer i have just a slight improvment: make the final fields final ^^ but i must confess: i have used this approach as well when i was younger - i even wrote a code-generator for creating code snippets ^^
type: Comment
comment on: http://stackoverflow.com/a/25847835

http://stackoverflow.com/a/25774273
has body: you need to initialize digitMonth to zero as well I think there is incorrect logic in your code too: you should have : dayNum = total % 7; Hope the following code works fine: public static void main(String args[]) { Scanner scan = new Scanner(System.in); int inputYear, inputMonth, inputDay, digitMonth = 0, test2, total, dayNum; System.out.println("Enter the last two digits of the year that you were born in"); inputYear = scan.nextInt(); System.out.println("Enter the month number that your were born in"); inputMonth = scan.nextInt(); System.out.println("Enter your birth day"); inputDay = scan.nextInt(); test2 = inputYear / 4; if (inputMonth &gt; 0 &amp;&amp; inputMonth &lt; 2) { digitMonth = 1; } else if (inputMonth &gt; 1 &amp;&amp; inputMonth &lt; 3) { digitMonth = 4; } else if (inputMonth &gt; 2 &amp;&amp; inputMonth &lt; 4) { digitMonth = 4; } else if (inputMonth &gt; 3 &amp;&amp; inputMonth &lt; 5) { digitMonth = 0; } else if (inputMonth &gt; 4 &amp;&amp; inputMonth &lt; 6) { digitMonth = 2; } else if (inputMonth &gt; 5 &amp;&amp; inputMonth &lt; 7) { digitMonth = 5; } else if (inputMonth &gt; 6 &amp;&amp; inputMonth &lt; 8) { digitMonth = 0; } else if (inputMonth &gt; 7 &amp;&amp; inputMonth &lt; 9) { digitMonth = 3; } else if (inputMonth &gt; 8 &amp;&amp; inputMonth &lt; 10) { digitMonth = 6; } else if (inputMonth &gt; 9 &amp;&amp; inputMonth &lt; 11) { digitMonth = 1; } else if (inputMonth &gt; 10 &amp;&amp; inputMonth &lt; 12) { digitMonth = 4; } else if (inputMonth &gt; 11 &amp;&amp; inputMonth &lt; 13) { digitMonth = 6; } else System.out.println("You fuck-up"); total = inputYear + test2 + digitMonth + inputDay; dayNum = total % 7; switch(dayNum){ case 1:System.out.println("You were born on a Sunday");break; case 2:System.out.println("You were born on a Monday");break; case 3: System.out.println("You were born on a Tuesday");break; case 4:System.out.println("You were born on a Wednesday");break; case 5:System.out.println("You were born on a Thursday");break…
answers question: http://stackoverflow.com/q/25774027
type: Answer
score: 0

http://stackoverflow.com/comment/40481857
has text: Thanks Florent for your incredible answer
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25868906

http://stackoverflow.com/comment/40281416
score: 0
type: AnswerComment
has text: Thanks! I've tried changing the source and target to 1.8 but no luck. I've added more information to my question about java version and maven.
type: Comment
comment on: http://stackoverflow.com/a/25759558

http://stackoverflow.com/a/27417908
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25781789
downvote count: 0
answers question: http://stackoverflow.com/q/25781789
has body: If you want to show the search icon in the right of the actionbar in every activity then just make a change in the actions.xml instead of android:showAsAction="ifRoom" change it to android:showAsAction="always"
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/25766186
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40293119
has comment: http://stackoverflow.com/comment/40300447
type: Answer
accepted answer of: http://stackoverflow.com/q/25765792
answers question: http://stackoverflow.com/q/25765792
downvote count: 0
score: 1
upvote count: 1
has body: I'm afraid you will have to write a similar wrapper for Jackson2 yourself.

http://stackoverflow.com/q/25864979
has body: I want to send data from one activity to another class but the second class is not an activity. It extends Framelayout. if (imageHolder1 != null) { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, Gravity.CENTER); ImageCell newView = new ImageCell(this); resourceId = R.drawable.tile; newView.setBackgroundResource(resourceId); // newView.setImageResource(resourceId); imageHolder1.addView(newView, lp); TextView tv =newView.getTextView(); tv.setText("A"); SharedPreferences pref = getSharedPreferences("A", MODE_WORLD_WRITEABLE); Editor edt = pref.edit(); edt.putString("A", tv.toString()); edt.commit(); newView.getPointTxtView().setText("5"); newView.mEmpty = false; newView.mCellNumber = -1; mLastNewCell = newView; mImageCount++; newView.setOnClickListener(this); newView.setOnLongClickListener(this); newView.setOnTouchListener(this); } if (imageHolder2 != null) { FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, Gravity.CENTER); ImageCell newView = new ImageCell(this); resourceId = R.drawable.tile; // newView.setImageResource(resourceId); newView.setBackgroundResource(resourceId); imageHolder2.addView(newView, lp); // newView.getTextView().setText("B"); TextView tv =newView.getTextView(); tv.setText("B"); SharedPreferences pref = getSharedPreferences("A", MODE_PRIVATE); Editor edt = pref.edit(); edt.putString("A", (String) tv.getText()); edt.commit(); newView.getPointTxtView().setText("2"); newView.mEmpty = false; newView.mCellNumber = -1; mLastNewCell = newView; mImageCount++; newView.setOnClickListener(this); newView.setOnLongClickListener(this); newView.setOnTouchListener(this); } Here my another class pref = getContext().getSharedPreferences("A", Context.MODE_PRIVATE); textView.setText(pref.getString("A", null)); Log.e("ad", "awd" + pref.getString("A", null)); Log.i("Position:", "" + mCellNumber); int column = mCellNumber % total_col; int row =…
has answer: http://stackoverflow.com/a/25865318
type: Question
tagged with: android-layout
has comment: http://stackoverflow.com/comment/40474399
has answer: http://stackoverflow.com/a/25865045
answer count: 6
has comment: http://stackoverflow.com/comment/40474318
has answer: http://stackoverflow.com/a/25865295
has answer: http://stackoverflow.com/a/25865196
score: 0
accepted answer: http://stackoverflow.com/a/25865196
has answer: http://stackoverflow.com/a/25865450
has comment: http://stackoverflow.com/comment/40473829
tagged with: android
possible better answer: http://stackoverflow.com/a/25865318
has answer: http://stackoverflow.com/a/25865393
has title: Send data from one activity to another class(Not Activity)
has comment: http://stackoverflow.com/comment/40474248
has comment: http://stackoverflow.com/comment/40474421
has comment: http://stackoverflow.com/comment/40474296
has comment: http://stackoverflow.com/comment/40473859
has comment: http://stackoverflow.com/comment/40473890
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40476689
tagged with: java
tagged with: sharedpreferences

http://stackoverflow.com/comment/40197125
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25714167
has text: But the error is not that isin column dato, i am assign there and not in the key
type: AnswerComment

http://stackoverflow.com/comment/40329953
comment on: http://stackoverflow.com/q/25786542
score: 1
has text: Give us a stacktrace, please.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40267812
has text: @Tenfour04 calling batch.end() before buffer.end() was called resulted in no image being drawn at all
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25750747
score: 0

http://stackoverflow.com/comment/40360815
score: 0
has text: Didn't get the game rules, but to solve problem mentioned in the title: get all the power sets of the numbers (there are existing algos for that), then for each combination check the precondition. If it holds, calculate the sum. That's all.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25802459

http://stackoverflow.com/a/25728858
downvote count: 0
has body: Math.pow returns double, therefore you add +1 to double value and than cast it to int, short or byte. But this part is already covered by other answers. There is another interesting thing about your example. Differences of casting double to decimal types. You have differences in bracketing. And - sing instead of + in short line. Fixed them for you(to always cast at the end): System.out.println((byte) (Math.pow(2, 7)+1)); //the maximum value + 1 overflows to the minimum value System.out.println((short) (Math.pow(2, 15)+1)); //same for shorts System.out.println((int) Math.pow(2, 31)); System.out.println((int) (Math.pow(2, 31)+1)); //returns the maximum value of the int range System.out.println((int) (Math.pow(2, 31)+100)); //returns the maximum value of the int range Result: -127 -32767 2147483647 2147483647 2147483647 Now everything except int overflows. And here is why. From http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html about conversions of double to decimal types: The results for char, int, and long are unsurprising, producing the minimum and maximum representable values of the type. The results for byte and short lose information about the sign and magnitude of the numeric values and also lose precision. The results can be understood by examining the low order bits of the minimum and maximum int. The minimum int is, in hexadecimal, 0x80000000, and the maximum int is 0x7fffffff. This explains the short results, which are the low 16 bits of these values, namely, 0x0000 and 0xffff; it explains the char results, which also are the low 16 bits of these values, namely, '\u0000' and '\uffff'; and it explains the byte results, which are the low 8 bits of these values, namely, 0x00 and 0xff. Also note: +1 is unnecessary in examples. (byte) (0b10000000) equals -128 and other types act analogously.
type: Answer
accepted answer of: http://stackoverflow.com/q/25728419
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25728419
type: AcceptedAnswer

http://stackoverflow.com/comment/40336341
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25788046
has text: can u please share me any sample regarding this procedure.
score: 0

http://stackoverflow.com/comment/40289316
type: Comment
has text: did you do whatever i specified in the answer and add the mapping path as well
comment on: http://stackoverflow.com/a/25764076
score: 0
type: AnswerComment

timer
tag name: timer
tags question: http://stackoverflow.com/q/25748779
tags question: http://stackoverflow.com/q/25838611
tags question: http://stackoverflow.com/q/25838820
type: Tag
tags question: http://stackoverflow.com/q/25779756
tags question: http://stackoverflow.com/q/25782118
tags question: http://stackoverflow.com/q/25755923
tags question: http://stackoverflow.com/q/25789822
tags question: http://stackoverflow.com/q/25754740
tags question: http://stackoverflow.com/q/25791256
tags question: http://stackoverflow.com/q/25869620
tags question: http://stackoverflow.com/q/25809293
tags question: http://stackoverflow.com/q/25724906
tags question: http://stackoverflow.com/q/25721283

http://stackoverflow.com/comment/40365693
has text: So you mean the equals() method for ArrayList compares the elements within the ArrayList, while on the other hand, the default equals() method that used to compare Car check the object reference?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25805759

http://stackoverflow.com/q/25779578
tagged with: xtext
type: UnansweredQuestion
tagged with: java
type: Question
answer count: 1
score: 0
has title: Inconsistent formatting observed in using Xtext formatter
has answer: http://stackoverflow.com/a/25782364
has body: I have xtext grammar as below : MyDSLModel: (dmodel=DModel) ; DModel: {DModel} (importSection=ImportSection)? ( (groups+=Group) | (variableDefinition+=VariableDefinition) )* ; ImportSection: (importDeclarations+=Import)+ ; Import: 'import' importedNamespace=[DModel | ImportID] ; ImportID: ImportIdentifier(('.'|'/')ImportIdentifier)* ; Group: 'group' name=Identifier ; VariableDefinition: 'var' name=Identifier ; ImportIdentifier: Identifier | 'dB' | 'm' | 'true' | 'false' | 'parallel' | 'sequential' | 'sites' | 'routing' ; Identifier: PortIdentifier | 'mode' | 'options' ; PortIdentifier: SINGLE_CHARACTER_ID | ID | 'action' | 'config' | 'disabled' | 'enum' | 'extension' | 'group' | 'import' | 'mod' | 'set' | 'setup' ; terminal ID: '^'?('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')+ ; terminal SINGLE_CHARACTER_ID: ('a'..'z'|'A'..'Z'|'_') ; Now, I have a file written using this grammar, which is as below : import specification/FunctionalTIM.spec import specification/FunctionalLEV.spec import specification/FunctionalWVT.spec group GR1 group GR2 var v1 var v2 I am trying to format this code with following implementation public class MyDSLFormatter extends AbstractDeclarativeFormatter { @Inject private MyDSLGrammarAccess grammarAccess; @Override protected void configureFormatting(FormattingConfig c) { ImportElements importAccess = grammarAccess.getImportAccess(); c.setLinewrap().after(importAccess.getRule()); GroupElements groupAccess = grammarAccess.getGroupAccess(); c.setLinewrap().after(groupAccess.getRule()); VariableDefinitionElements varDefAccess = grammarAccess .getVariableDefinitionAccess(); c.setLinewrap().after(varDefAccess.getRule()); } Now, the problem I am facing is, inconsistency in formatting, when Import elements are present in my file If my file has import statements in it, then the line wrap for VariableDefinition (after the rule) is not taking effect. So, CTRL+SHIFT+F gives file as import specification/FunctionalTIM.spec import specification/Fun…

jsr310
tag name: jsr310
type: Tag
tags question: http://stackoverflow.com/q/25818435

http://stackoverflow.com/comment/40472831
comment on: http://stackoverflow.com/q/25864513
has text: Maybe a timezone issue?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/48773353
has body: I reversed bundle loading and came up with a dirty solution in case putting a jar to jre/lib/ext is not an option. Default algorithm requires a bundle file to be ISO-8859-1 encoded and doesn't provide any means to specify encoding. My solution addresses encoding issue too. The following method loads resource with application classloader and puts resulting bundle to the bundle cache using extension classloader (which is used in runtime by javafx classes to lookup bundles). import com.sun.javafx.scene.control.skin.resources.ControlResources; import java.util.Locale; import java.util.PropertyResourceBundle; import java.util.ResourceBundle; // rest of the imports is ommitted private void putResourceBundleInCache(String baseName, Charset cs) throws ReflectiveOperationException, IOException { Locale currentLocale = Locale.getDefault(); ResourceBundle.Control control = ResourceBundle.Control.getControl(ResourceBundle.Control.FORMAT_DEFAULT); String resourceName = control.toResourceName(control.toBundleName(baseName, currentLocale), "properties"); ResourceBundle bundle; try (Reader reader = new InputStreamReader(getClass().getClassLoader().getResourceAsStream(resourceName), cs)) { bundle = new PropertyResourceBundle(reader); } Class&lt;?&gt; cacheKeyClass = Class.forName("java.util.ResourceBundle$CacheKey"); Constructor&lt;?&gt; cacheKeyClassConstructor = cacheKeyClass.getDeclaredConstructor(String.class, Locale.class, ClassLoader.class); cacheKeyClassConstructor.setAccessible(true); Object cacheKey = cacheKeyClassConstructor.newInstance(baseName, currentLocale, ControlResources.class.getClassLoader()); Method putBundleInCache = ResourceBundle.class.getDeclaredMethod("putBundleInCache", cacheKeyClass, ResourceBundle.class, ResourceBundle.Control.class); putBundleInCache.setAccessible(true); putBundleInCache.invoke(null, cacheKey, bundle, control); } I call it from start method like this: public void start(Stage primaryStage) throws Exception { putResourceBundleInCache("com/…
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25791416
has comment: http://stackoverflow.com/comment/134165436
downvote count: 0

http://stackoverflow.com/q/25824421
tagged with: scala
has comment: http://stackoverflow.com/comment/40401751
type: Question
has body: In the Java API example they create a Datastore by using DatastoreHelper.getOptionsfromEnv But this creates the warning WARNING: Not using any credentials and leads ultimately to: DatastoreException(null): beginTransaction 401 I set my environment variables to the following: export DATASTORE_DATASET={Project-ID} export DATASTORE_HOST="https://www.googleapis.com/datastore/v1/datasets/{Project-ID}" export DATASTORE_SERVICE_ACCOUNT="{email address}" export DATASTORE_PRIVATE_KEY_FILE="{path to local p12 keyfile}" But still when I try to see what the credentials are: println("Datastore helper: " +DatastoreHelper.getOptionsfromEnv .dataset(datasetId).build().getCredential) I get null, what could be missing? Also is there either a way to set the Credentials inside the project (instead of using the getOptionsfromEnv)?
tagged with: java
score: 0
tagged with: google-cloud-datastore
has answer: http://stackoverflow.com/a/25833007
answer count: 1
has title: [GAE Java]: WARNING: Not using any credentials
type: UnansweredQuestion
tagged with: google-app-engine

http://stackoverflow.com/comment/40451892
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25834981
score: 0
has text: Lots of threads I mean there are hundreds of actors, each actor does system calls and create some futures to asynchronously execute tasks. I do not use TrieMap explicitly.

http://stackoverflow.com/a/25848997
has body: First things first: String[][] personalInfo = new String[10][4]; This statement creates a 2dimensional array of Strings, thus creating an array that is capable of holding an array that is capable of holding strings. (in this case 10 arrays that keep 4 strings each) Now the error: String addedContact = input.nextLine(); This line puts the entire line you added in a single string. Now the loops: 1. The outer loop loops correctly through the 10 arrays of strings. 2. The inner loop does not loop through the '2nd dimension', that is the actual array which will hold your contact. This loop should be as @Kannan Thangadurai described: for(j = 0; j &lt; personalInfo[i].length; j++){ (add relevant code here) } The last error you made is more of a bug, and is in the way you read out the user input. You actually only ever put a string in the first array and so your four contacts that you saved will all be under personalinfo[1] then you try to add another contact in the fifth place of the array that does not exist, thus raising your error.
answers question: http://stackoverflow.com/q/25848655
type: Answer
has comment: http://stackoverflow.com/comment/40444373
score: 0

http://stackoverflow.com/a/25806280
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/40366234
has comment: http://stackoverflow.com/comment/40366214
accepted answer of: http://stackoverflow.com/q/25806201
score: 5
answers question: http://stackoverflow.com/q/25806201
type: AcceptedAnswer
downvote count: 0
has body: You write a loop. So set i to 0 (int i=0), while it is less than 40 (i&lt;40), continue to loop, every loop add 1 to i (i++) for (int i=0; i&lt;40; i++) { } Then you insert the code to be looped, using the changing i to index whatever it is you want to index for (int i=0; i&lt;40; i++) { //do something with i - which is increased by one every loop through } In your case, you will need to create a bunch of labels though as JLabel[] jLabels = new JLabel[40]; Then you can index each label inside your loop //Notice there are two uses of the i variable here String imageLocation = "/cards/" + cards.get(i) + ".png"; ImageIcon icon = new ImageIcon(getClass().getResource(imageLocation)); jLabels[i].setIcon(icon); But you will need to have a simple loop (before the one above ... or within it) in order to fill the jLabels array with new JLabel() objects. I've given you all the tools you need to do that.

http://stackoverflow.com/comment/40402820
has text: thank you very much sir, it solved all my doubts.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25825557
type: Comment

http://stackoverflow.com/comment/40428123
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25839675
has text: You want `method` to construct an object based on the type of the object currently stored in `s`?

http://stackoverflow.com/a/60096343
answers question: http://stackoverflow.com/q/25821579
type: Answer
score: 13
has body: Using @Modifying and @Transaction fixed me @Modifying @Query(value="DELETE FROM lock WHERE user_id = ?1" ,nativeQuery=true) void deleteByUserId(Long userId); @Service @Transactional
upvote count: 13
downvote count: 0

http://stackoverflow.com/comment/40230743
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25732031
score: 4
has text: May I ask you where you learned this? I always seem to fail to find this sort of stuff. Where is a reference (full) of the entire API? It's nowhere to be found and rather frustrating.

http://stackoverflow.com/comment/40414866
type: Comment
type: QuestionComment
has text: Imports, permissions... this is not relevant. **Algorithm** is relevant.
score: 0
comment on: http://stackoverflow.com/q/25832379

http://stackoverflow.com/a/25827572
has body: Whenever you call Car() you create a new instance of the class. So this create a new object and calls its set method: r.eval("Car().set(7)"); But this then creates another instance rather than manipulating the existing one: p = r.eval("Car().begin()"); The call to r.eval("Car().begin()"); creates a new python object as you require, but it actually returns a reference to the python object containing the return value from the begin() method - not to the instance created. This isn't what you wanted. Leaving the python class exactly as defined, this code gets a reference to a single instance of the class: PyObject p = r.eval("Car()"); (As you already saw, an alternative is to omit the parenthesis which gets you a reference to the python class object, and then using __call__ on it to create an instance). Then to call the method on the existing instance: p.invoke("set", Py.newInteger(7)); To get at the modified value, since it is an attribute of the instance and is not available via a 'getter' method, the getattr method of the PyObject class can get to it (or you could add a get method to the python code): System.out.println(p.__getattr__("myvar")); It's a shame that once you get a reference to the object via p you can't just call the method on it with java syntax, but of course Java knows nothing of the methods and/or attributes available on the Python object and even if it did they could change at any time because of the dynamic nature of Python. So you're left with methods like invoke to bind Java/Python together.
answers question: http://stackoverflow.com/q/25826130
accepted answer of: http://stackoverflow.com/q/25826130
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/40432284
type: QuestionComment
comment on: http://stackoverflow.com/q/25841697
score: 0
has text: You mean I schedule it for every year? that's probably not what I need, just need to schedule it for the current date time, that is I want the Job to Run Now
type: Comment

http://stackoverflow.com/comment/54919031
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25727221
has text: I'm getting the same in 8u60 `sun.lwawt.macosx.CAccessible.valueChanged`
score: 0

system-calls
type: Tag
tags question: http://stackoverflow.com/q/25828623
tag name: system-calls

http://stackoverflow.com/comment/64756312
type: QuestionComment
has text: Do you know if touches trigger mouse events in SWT on tablets?
comment on: http://stackoverflow.com/q/25774560
score: 0
type: Comment

http://stackoverflow.com/comment/40226086
type: Comment
has text: What error do you see? A stack trace would be useful.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25725991

http://stackoverflow.com/q/25845103
has body: I am implementing a JTable with a TableModel. I've got a problem to make cells editable on this specific one. Here is my isCellEditable overriding of the TableModel @Override public boolean isCellEditable(int rowIndex, int columnIndex) { return true; } The Jtable instanciate with this TableModel doesn't make cells editable. First I instanciate my JScrollPane with The JTable in it : caseTM = new CaseTableModel(factory,caseList); caseListTable = new JTable(caseTM); caseScrollPanel = new JScrollPane(caseListTable); Here is the code of the CaseTableModel : public class CaseTableModel extends AbstractTableModel { Factory f; ArrayList&lt;Case&gt; cList; public CaseTableModel(Factory f,ArrayList&lt;Case&gt; caseList) { this.f=f; cList=caseList; } @Override public Class&lt;?&gt; getColumnClass(int columnIndex) { return cList.get(0).getClass(); } @Override public int getColumnCount() { return 14; } @Override public String getColumnName(int columnIndex) { switch (columnIndex) { case 0: return "Numéro d'Affaire"; case 1: return "Client"; case 2: return "Projet"; case 3: return "Position"; case 4: return "Status"; case 5: return "Date Début"; case 6: return "Date Fin"; case 7: return "Nombre de jours facturés"; case 8: return "Daily Rate"; case 9: return "IGD"; case 10: return "Autres Conditions"; case 11: return "Echeance de paiement"; case 12: return "Date de paiment"; case 13: return "Montant HT"; case 14: return "Montant TTC"; default: return "FAUX!"; } } @Override public int getRowCount() { return cList.size(); } @Override public Object getValueAt(int rowIndex, int columnIndex) { switch (columnIndex) { case 0: return cList.get(rowIndex).getNumber(); case 1: return cList.get(rowIndex).getClient(); case 2: return cList.get(rowIndex).getProject(); case 3: return cList.get(rowIndex).getPositon(); case 4: return cList.get(rowIndex).getStatus(); case 5: return cList.get(rowIndex).getStartDate(); case 6: return cList.get(rowIndex).getEndDate(); case 7: return cList.get(rowIndex).…
answer count: 0
tagged with: abstracttablemodel
has comment: http://stackoverflow.com/comment/40440406
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40439996
tagged with: java
has title: Abstract Table Model isCellEditable() Overriding did not make cells editable
type: Question
has comment: http://stackoverflow.com/comment/40440544
score: 0
tagged with: jtable

http://stackoverflow.com/a/25712983
has comment: http://stackoverflow.com/comment/40195595
has comment: http://stackoverflow.com/comment/40195663
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40195099
type: Answer
answers question: http://stackoverflow.com/q/25712918
has comment: http://stackoverflow.com/comment/40194906
has comment: http://stackoverflow.com/comment/40196046
accepted answer of: http://stackoverflow.com/q/25712918
upvote count: 1
has comment: http://stackoverflow.com/comment/40195536
has body: Try to use html tag &lt;br&gt;

http://stackoverflow.com/q/25802744
answer count: 1
tagged with: phonegap-plugins
type: UnansweredQuestion
tagged with: android
tagged with: cordova
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25803080
has title: Query related to Cordova.exec when called multiple times
score: 0
has body: I am using cordova to make calls to the plugin file. cordova.exec(onFileSystemSuccess, onFileSystemFailure, "ABCPlugin", "echo",[arg1, arg2]); If the exec function is called 2 or more time I need a way to initialize the object only once. e.g StandardFileSystemManager manager = new StandardFileSystemManager(); // which will be in the plugin file But use only the once created value of the manager object. i.e Say exec call calls the plugin file once, the object manager gets created. The second time exec is called I want to reuse the value of manager object already initialize. Hope this is clear or else let me know. I just want to know if this is possible so that, the I will not have to created the manager object multiple times

http://stackoverflow.com/q/25825431
has answer: http://stackoverflow.com/a/25830343
has answer: http://stackoverflow.com/a/25825501
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/40401536
type: Question
tagged with: for-loop
accepted answer: http://stackoverflow.com/a/25825501
possible better answer: http://stackoverflow.com/a/25826017
has answer: http://stackoverflow.com/a/25826017
score: 0
has comment: http://stackoverflow.com/comment/40401577
has answer: http://stackoverflow.com/a/25836236
tagged with: iteration
has body: i have to make a loop but i tried so many time to get a expected result, but i have no idea what I'm doing wrong. public class JavaApplication34 { int totalResults = 248; // int itemsperPage = 10; int i = 0; int j = 0; int count = 0; public void makeLoop() { for (i = 0; i &lt; 10; i++) { System.out.println("nextPage " + i); this.count = i + 1; for (j = 0; j &lt; 10; j++) { System.out.println("Filenummer " + (j + 1)); this.count = j + 1; System.out.println("count " + count); } } } public static void main(String[] args) { JavaApplication34 myTest = new JavaApplication34(); myTest.makeLoop(); } } i should get on the console following result page 1, filenummer 1, filenummer 2, filenummer 3...,filenummer 10 page 2, filenummer 11, filenummer 12, filenummer 13...,filenummer20 page 3 , and so on
has title: loop, iterate with unexpected result
has comment: http://stackoverflow.com/comment/40401498

http://stackoverflow.com/q/25817236
score: 1
tagged with: java
has title: Comparing chars in String elements of an arraylist causing indexoutofboundsexception
type: Question
has comment: http://stackoverflow.com/comment/40387583
has answer: http://stackoverflow.com/a/25817262
answer count: 2
has comment: http://stackoverflow.com/comment/40388143
downvote count: 0
has answer: http://stackoverflow.com/a/25817443
favorite count: 0
possible better answer: http://stackoverflow.com/a/25817262
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40387624
has comment: http://stackoverflow.com/comment/40387530
accepted answer: http://stackoverflow.com/a/25817443
has body: I am supposed to compare the characters in an arraylist(String) and then if all the Strings have common characters or character or no common character, i have to display the number of common characters in all the strings of an arraylist. Here is my function: public void theElementor(ArrayList&lt;String&gt; x) { char a; ArrayList&lt;String&gt; store = new ArrayList&lt;String&gt;(); for (int i = 0; i &lt;= x.size(); i++) { for (int j = x.size()-1; j &gt; i; j--) { for (int l = 0; l &lt; x.get(j).length(); l++) { \\error here if (x.get(i).contains( Character.toString(x.get(j).charAt(l)))) { a = x.get(j).charAt(l); store.add(Character.toString(a)); } } } } for (String element : store) { System.out.println(element); } } I have figured out that much and i am no longer getting the error i was getting earlier, but still not able to get the char or chars common in all the strings i input.
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/q/25840671
favorite count: 0
has answer: http://stackoverflow.com/a/25840833
tagged with: android
has title: How do I convert msecs to time string in Android?
score: -1
type: AnsweredQuestion
has body: I want to convert msecs to date time string in android java code, for example: msecs = 60*60*1000; SimpleDateFormat formatter = new SimpleDateFormat("HH:mm:ss"); String dateString = formatter.format(new Date(msecs * 1L)); But the result is 19:00:00, when I want the output to be 1:00:00. What's wrong with this code?
downvote count: 1
accepted answer: http://stackoverflow.com/a/25840833
type: Question
tagged with: java
upvote count: 0
answer count: 1

http://stackoverflow.com/a/25865579
downvote count: 1
type: Answer
has body: Use a ExecutorService. The basic idea would be something like this: // "Global" resource final ScheduledExecutorService executorService = Executors.newScheduledThreadPool(5); // Adjust threadpool size ... // inside onclick() processing ScheduledFuture&lt;Void&gt; future1 = executorService.schedule(new Callable&lt;Void&gt;() { @Override Void call() { try { runFirst(); } finally { scheduleFuture2(); } } }, 65, TimeUnit.SECONDS); ... void scheduleFuture2() { ScheduledFuture&lt;Void&gt; future2 = executorService.schedule(new Callable&lt;Void&gt;() { @Override Void call() { try { runSecond(); } finally { scheduleFuture3(); } } }, 20, TimeUnit.SECONDS); } ... void scheduleFuture3() { ScheduledFuture&lt;Void&gt; future3 = executorService.schedule(new Callable&lt;Void&gt;() { @Override Void call() { try { runThird(); } finally { scheduleFuture4(); } } }, 15, TimeUnit.SECONDS); } ... // And so on Some notes: if runFirst() , runSecond(), ... perform Swing / AWT UI operations, the you should proably make use of SwingUtilities.invokeLater inside those methods don't forget to invoke executorService.shutdown() when you not going to use this mechanism anymore. If you forget about it, you will "leak" threads. The references to Void above (uppercase "V") are intentional: we are using the Void class and not the void type
answers question: http://stackoverflow.com/q/25865127
score: 0
upvote count: 1

hadoop
tags question: http://stackoverflow.com/q/25861926
tags question: http://stackoverflow.com/q/25808725
tags question: http://stackoverflow.com/q/25749894
tags question: http://stackoverflow.com/q/25731506
tag name: hadoop
tags question: http://stackoverflow.com/q/25720553
tags question: http://stackoverflow.com/q/25824245
tags question: http://stackoverflow.com/q/25829189
tags question: http://stackoverflow.com/q/25813732
tags question: http://stackoverflow.com/q/25744449
tags question: http://stackoverflow.com/q/25777158
type: Tag
tags question: http://stackoverflow.com/q/25743302
tags question: http://stackoverflow.com/q/25753572
tags question: http://stackoverflow.com/q/25832596
tags question: http://stackoverflow.com/q/25868484
tags question: http://stackoverflow.com/q/25769454
tags question: http://stackoverflow.com/q/25744036
tags question: http://stackoverflow.com/q/25723526
tags question: http://stackoverflow.com/q/25839302
tags question: http://stackoverflow.com/q/25742284
tags question: http://stackoverflow.com/q/25714309
tags question: http://stackoverflow.com/q/25731303
tags question: http://stackoverflow.com/q/25767448
tags question: http://stackoverflow.com/q/25826993
tags question: http://stackoverflow.com/q/25760810
tags question: http://stackoverflow.com/q/25741973
tags question: http://stackoverflow.com/q/25718398
tags question: http://stackoverflow.com/q/25722958
tags question: http://stackoverflow.com/q/25827950
tags question: http://stackoverflow.com/q/25860959
tags question: http://stackoverflow.com/q/25843137
tags question: http://stackoverflow.com/q/25797045
tags question: http://stackoverflow.com/q/25757394
tags question: http://stackoverflow.com/q/25782925
tags question: http://stackoverflow.com/q/25866582

http://stackoverflow.com/a/25810450
type: Answer
has comment: http://stackoverflow.com/comment/40374265
answers question: http://stackoverflow.com/q/25810308
score: 0
has body: try this : for(int i=0; ; i = (i+5)%12){ System.out.println(i); if(i==7)break; }

http://stackoverflow.com/a/79058386
type: Answer
has body: For me, just adding @Transactional solved the issue @PostMapping @Transactional public ApiResponse<String> createSequence( @Valid @RequestBody CreateSequenceDTO createSequenceDTO) { String sequenceName = createSequenceDTO.getClusterId() + "_gate_keeper_sequence"; String sql = "CREATE SEQUENCE " + sequenceName; entityManager.createNativeQuery(sql).executeUpdate(); return ApiResponseBuilder.buildSuccessResponse(sequenceName + " created!", null); }
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25821579

http://stackoverflow.com/q/25827493
type: Question
tagged with: google-app-engine
has title: How to change version of google app engine being used on server
score: 0
has answer: http://stackoverflow.com/a/25827628
has body: I have built my google app engine app using version 1.8.8 but the production server hosted by google uses 1.9.11. I think this may be causing problems within my app since my app works locally but not on the production server. Is there anyway to change the version of the sdk that the production server uses? I can't seem to find any documentation on this.
answer count: 1
tagged with: java
type: UnansweredQuestion

intellij-13
tag name: intellij-13
tags question: http://stackoverflow.com/q/25839461
type: Tag

http://stackoverflow.com/comment/40374809
type: QuestionComment
has text: Where is the null pointer exception being thrown? What line, Could you please paste error trace?
type: Comment
comment on: http://stackoverflow.com/q/25810797
score: 0

http://stackoverflow.com/q/25764327
tagged with: android
has answer: http://stackoverflow.com/a/25764856
has body: I have a custom listView with some views (Like textView and imageView) in it. I want to change the background color of the list item when it gets focus. I have set OnfocusChange for my convert view but it doesn't work. this is my Holder Class: private class Holder { ImageView iconImage; TextView titleText ; TextView costText ; } and getView method: @Override public View getView(int position, View convertView, ViewGroup parent) { final Item item = item.get(position); final Holder temp; if (convertView == null) { convertView = inflater.inflate(R.layout.list_item, null); temp = new Holder(); temp.iconImage = (ImageView) convertView .findViewById(R.id.iconImageView); temp.titleText = (TextView) convertView .findViewById(R.id.titleTextView); temp.costText = (TextView) convertView .findViewById(R.id.costTextView); convertView.setTag(temp); } else { temp = (Holder) convertView.getTag(); } temp.titleText.setText(item.getItemTitle()); //this focus listener doesn't work. convertView.setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (hasFocus) { temp.titleText.setBackground(context.getResources() .getDrawable( R.drawable.green_background)); } else { temp.titleText.setBackground(context.getResources() .getDrawable(R.drawable.black_background)); } } }); } how can i set OnFocusChange listener for each list item in my list view?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25822150
linked to: http://stackoverflow.com/q/10788688
has title: ListItem focus change
accepted answer: http://stackoverflow.com/a/25822150
tagged with: java
has comment: http://stackoverflow.com/comment/40289620
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25764856
type: Question
tagged with: android-listview

http://stackoverflow.com/q/25805049
has comment: http://stackoverflow.com/comment/40366338
downvote count: 1
has body: I have been triing to write my rendering application with JOGL. But I am expiriencing an issue with VBO. Under linux it runs fine everytime, but under Windows it keeps crashing. I dont know what I am missing. I made my code for serving VBOs combining various tutorial, because there are very few for java and not speaking about JOGL. I have read this: http://www.java-gaming.org/index.php?topic=25672.0 I modiefied my code, so I pass GL2 instance from init function of my class, which is derived from GLEventListener as function argument all the way to my VBOClass functions. (I dont store GL2 instance as a class property) But that didn't help So my class: public class VBOMesh { private int vertexVBOId; private int normalVBOId; private int texCoordVBOId; public VBOMesh(GL2 gl) { IntBuffer ib = IntBuffer.allocate(4); gl.glGenBuffers(4, ib); vertexVBOId = ib.get(0); normalVBOId = ib.get(1); texCoordVBOId = ib.get(2); } public void setVetices(GL2 gl, List&lt;Vector3&gt; vetices) { gl.glBindBuffer( GL.GL_ARRAY_BUFFER, vertexVBOId); gl.glBufferData( GL.GL_ARRAY_BUFFER, vetices.size()*3*Float.SIZE, VectorListToFloatBuffer(vetices,3), GL.GL_STATIC_DRAW); gl.glBindBuffer( GL.GL_ARRAY_BUFFER, 0); } public void setTexCoords(GL2 gl, List&lt;Vector3&gt; texCoords) { gl.glBindBuffer( GL.GL_ARRAY_BUFFER, texCoordVBOId); gl.glBufferData( GL.GL_ARRAY_BUFFER, texCoords.size()*2*Float.SIZE, VectorListToFloatBuffer(texCoords,2), GL.GL_STATIC_DRAW); gl.glBindBuffer( GL.GL_ARRAY_BUFFER, 0); } public void setNormals( GL2 gl, List&lt;Vector3&gt; normals) { gl.glBindBuffer( GL.GL_ARRAY_BUFFER, normalVBOId); gl.glBufferData( GL.GL_ARRAY_BUFFER, normals.size()*3*Float.SIZE, VectorListToFloatBuffer(normals,3), GL.GL_STATIC_DRAW); gl.glBindBuffer( GL.GL_ARRAY_BUFFER, 0); } public void Draw( GL2 gl, List&lt;Integer&gt; indices) { IntBuffer indiceBuffer = Buffers.newDirectIntBuffer( indices.size() ); for (int ind : indices) { indiceBuffer.put(ind); } gl.glEnableClientState(GLPointerFunc.GL_VERTEX_ARRAY…
type: AnsweredQuestion
tagged with: opengl
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25806499
has comment: http://stackoverflow.com/comment/40365768
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25806499
has comment: http://stackoverflow.com/comment/40389333
has title: Rendering with VBO using JOGL trows exception at random
favorite count: 0
score: -1
tagged with: vbo
tagged with: jogl
has comment: http://stackoverflow.com/comment/40365676

http://stackoverflow.com/a/25838063
has comment: http://stackoverflow.com/comment/40427437
answers question: http://stackoverflow.com/q/25837815
has comment: http://stackoverflow.com/comment/67341273
has comment: http://stackoverflow.com/comment/40428219
upvote count: 3
has comment: http://stackoverflow.com/comment/40426741
has comment: http://stackoverflow.com/comment/40427212
has comment: http://stackoverflow.com/comment/40428068
has body: That's not how you read a resource. You can't get a File for a resource, only a stream. The URL's for resources don't correspond to files. If jsch can handle a stream, pass it the results of getResourceAsStream. If jsch can handle an array of bytes, pass it the results of reading the stream into an array of bytes. If it must have a file, create a temp file. In the third case, I'd incorporate Guava and write the code like: URL resUrl = Resources.getResource(Main.class, "auth/public_key1"); File tempFile = File.createTempFile("key", ".key"); ByteSink sink = Files.asByteSink(tempFile); try (OutputStream os = sink.openStream()) { Resources.copy(resUrl, os); } and pass the File's path to jsch.
has comment: http://stackoverflow.com/comment/40426683
has comment: http://stackoverflow.com/comment/40425968
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/40427381
downvote count: 0
has comment: http://stackoverflow.com/comment/40459606
has comment: http://stackoverflow.com/comment/40426902
has comment: http://stackoverflow.com/comment/40457551
has comment: http://stackoverflow.com/comment/40425855

http://stackoverflow.com/q/25851774
accepted answer: http://stackoverflow.com/a/25852920
type: Question
has body: I have written a JMX interface for one of our applications. Another application then connects and allows the user to see various state related attributes / invoke operations remotely via this management tool. I stumbled across a small bug where our database connection settings are being exposed over JMX, with the password unencrypted. I would like to tag the attributes / operations that should be obfuscated with some flag, but it doesnt appear as though the MBeanAttributeInfo or MBeanOperationInfo objects support adding any user defined values exception for name and description. I suppose I could delimit the description field like String desc = getAttrDesc() + ";" + getIsObfuscated(); But I dont like this approach very much. The question then is, is there a better way to provide arbitrary key value pairs to an attribute / operation info object, or the Dynamic MBean itself? It doesnt have to be on the info objects themselves, just as long as I can match them up on the management tool side. Any insight would be appreciated. Just for clarification, when I construct the MBeanOperationInfo (leaving out the attributes for the sake of example) I do so like this: LinkedList&lt;MBeanOperationInfo&gt; opperInfos = new LinkedList&lt;MBeanOperationInfo&gt;(); for (Method m : m_InstObj.getMethods()) { InstrumentedOperation anno = m.getAnnotation(InstrumentedOperation.class); String desc = anno.description(); opperInfos.add(new MBeanOperationInfo(desc, m)); } m_Operations = new MBeanOperationInfo[opperInfos.size()]; int I = 0; for (MBeanOperationInfo info : opperInfos) { m_Operations[I] = info; I++; } I would like the InstrumentedOperation annotation to have a field for obfuscated that I can use like this: anno.obfuscated(); // &lt;- retreives a boolean set as a compile time constant on the annotation and be able to include this value in the Info object. Then on the receiving side I do this: MBeanOperationInfo[] operInfos = conn.getMBeanInfo(name).getOperations(); for (MBeanOpera…
upvote count: 1
answer count: 1
favorite count: 0
tagged with: encryption
tagged with: jmx
has title: MBeanOperationInfo and MBeanAttributeInfo meta data?
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25852920

http://stackoverflow.com/comment/40269237
has text: The problem in your code is nothing to do with client programming. You may help other people if you choose a suitable title for your question
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25752437
score: 0

http://stackoverflow.com/comment/40251905
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25743634
type: Comment
has text: It is common practice to also mention many of the unchecked exceptions in the javadoc documentation (for instance `NullPointer` in the official Java API)

http://stackoverflow.com/q/25791976
has title: Grails groovy too many hibernate connections
tagged with: grails
linked to: http://stackoverflow.com/q/19691758
score: 0
tagged with: batch-file
tagged with: groovy
has answer: http://stackoverflow.com/a/25792222
answer count: 1
type: UnansweredQuestion
has body: I am struggling with manual the transaction management. Background: I need to run quarz crons which run batch processes. It is recommended for batch processing to manually decide when to flush to the db to not slow down the application to much. I have a pooled hibernate connection as the following dataSource { pooled = true driverClassName = "com.mysql.jdbc.Driver" dialect = "org.hibernate.dialect.MySQL5InnoDBDialect" properties { maxActive = 50 maxIdle = 25 minIdle = 1 initialSize = 1 minEvictableIdleTimeMillis = 60000 timeBetweenEvictionRunsMillis = 60000 numTestsPerEvictionRun = 3 maxWait = 10000 testOnBorrow = true testWhileIdle = true testOnReturn = false validationQuery = "SELECT 1" validationQueryTimeout = 3 validationInterval = 15000 jmxEnabled = true maxAge = 10 * 60000 // http://tomcat.apache.org/tomcat-7.0-doc/jdbc-pool.html#JDBC_interceptors jdbcInterceptors = "ConnectionState;StatementCache(max=200)" } } hibernate { cache.use_second_level_cache = false cache.use_query_cache = false cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' show_sql = false logSql = false } the cron job calls a service in the service i run do the following: for(int g=0; g&lt;checkResults.size() ;g++) { def tmpSearchTerm = SearchTerm.findById((int)results[g+i][0]) tmpSearchTerm.count=((String)checkResults[g]).toInteger() batch.add(tmpSearchTerm) } //increase counter i+=requestSizeTMP if (i%(requestSize*4)==0 || i+1==results.size()){ println "PREPARATION TO WRITE:" + i SearchTerm.withSession{ def tx = session.beginTransaction() for (SearchTerm s: batch) { s.save() } batch.clear() tx.commit() println "&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;writing: ${i}&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;" } session.flush() session.clear() } } So I am adding things to a batch until I have enough (4x the request size or the last item) and then I am trying to write it to the db. …
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/40479345
type: QuestionComment
has text: what am missing? it compiles fine but I am not sure what to do to get the outcome of sum(" some numbers") = some number
comment on: http://stackoverflow.com/q/25868180
score: 0
type: Comment

http://stackoverflow.com/q/25724105
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
has answer: http://stackoverflow.com/a/25724244
tagged with: spring
tagged with: java
has comment: http://stackoverflow.com/comment/40217929
type: Question
has title: java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-16000: database open for read-only access
has comment: http://stackoverflow.com/comment/40215754
has comment: http://stackoverflow.com/comment/40215417
has body: I have an spring batch application which reads data from Database and writes the result in a .dat file. The job runs fine in the DB having read and write permissions.But if I run the job with the DB having only read access. I'm getting the below error... org.springframework.dao.DataAccessResourceFailureException: Could not obtain sequence value;nested exception is java.sql.SQLException: ORA-00604: error occurred at recursive SQL level 1 ORA-16000: database open for read-only access My Query is a simple select statement.Don't know what is the root cause for this error.Please suggest
score: 0
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/comment/40435592
has text: Show your manifest file.
comment on: http://stackoverflow.com/q/25843728
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40250747
type: Comment
type: QuestionComment
has text: I edited my question to make me understandable ...
comment on: http://stackoverflow.com/q/25742692
score: 0

http://stackoverflow.com/comment/40246581
type: AnswerComment
has text: So obvious when you mention it. Thank you very much!
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25740529

http://stackoverflow.com/comment/40315942
type: QuestionComment
comment on: http://stackoverflow.com/q/25778117
type: Comment
score: 0
has text: Err, change the *sign?* What's the question here?

http://stackoverflow.com/q/25764350
favorite count: 0
has title: Not able to call public methods in Android TextView
tagged with: android
has answer: http://stackoverflow.com/a/25764538
has comment: http://stackoverflow.com/comment/40289751
has answer: http://stackoverflow.com/a/25764462
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17035271
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40290204
type: Question
has answer: http://stackoverflow.com/a/25764581
accepted answer: http://stackoverflow.com/a/25764581
has comment: http://stackoverflow.com/comment/40289802
has comment: http://stackoverflow.com/comment/40289604
possible better answer: http://stackoverflow.com/a/25764462
has comment: http://stackoverflow.com/comment/40289924
upvote count: 2
answer count: 3
downvote count: 1
has body: I am not able to call getShowSoftInputOnFocus() while am able to call setText()? Why is this happening can someone explain???
has comment: http://stackoverflow.com/comment/40289646

http://stackoverflow.com/a/25792700
type: Answer
has body: What you are struggling with is what does it mean to be equal? In Java there are two versions of equality (as with many modern languages). Are these objects equal by value? Are these objects the same object? (ie by reference) This is the difference between .equals() and == respectively. When you deserialize something it creates a new object and hence if you have another copy of that object you serialized. It will never be number 2 equal (ie equal by reference). Because the deserialization was given JSON representation and it created a new object graph from it. But it could be .equals() provided your objects properly define what .equals() means for all objects included. By default Object.equals() compares references and is the same thing as ==. However, every object can overload it, and in the case of String.equals() compares the actual content of the strings. So just change your code to use .equals() instead of == and you get what you expect: System.out.println( list.get(0).equals( list.get(1) ) ) System.out.println( list.get(0).equals( list.get(2) ) )
score: 0
answers question: http://stackoverflow.com/q/25789769

http://stackoverflow.com/q/25751382
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-intent
answer count: 0
score: 1
tagged with: java
tagged with: calendar
type: Question
has title: Calendar Activity implementation. How to reload calendar view? Android
has body: I am currently developing an android app that has a Calendar as one of its activities. My calendar works just fine but I have the following problem: For every month I have to make a request for events to an API (I am using AsyncHttpClient to achieve this), so every time the user clicks the button to see the next or previous month, I make a new request, get the data asynchronously and save it into the database. What I'm doing right know is starting a new intent for every new request, but that is just wrong because every time I click to see a different month, if I click the back button I have a bunch of instances of the same activity but with the previous months I just saw. What I really want to do is to "refresh" the CalendarActivity with the new data I just got from the request, but I'm not really sure how to do this. I tried adding the flag FLAG_ACTIVITY_NEW_TASK to the flags on my intent but it doesn't do what I expect. I also try to put a ProgressDialog and wait until the request is done but the problem is I still do the statActivity after the request is made, but I don't know how else I can do this. Here is some of my code, particularly the one I have after the request is done and it was successful: AsyncHttpClientManager.java public static void getCalendar(final int year, final int month, final Context context, final Context appContext, final ProgressDialog prgDialog) { prgDialog.show(); cookieStore = new PersistentCookieStore(appContext); // Change the default timeout from 10secs to 30secs // Calendar takes time to load client.setTimeout(DEFAULT_TIMEOUT); client.setCookieStore(cookieStore); client.addHeader("Accept", HEADER); RequestParams params = new RequestParams(); String[] dates = getDate(year, month); Log.d(TAG, "start: " + dates[0] + " end: " + dates[1]); params.put("start_date", dates[0]); params.put("end_date", dates[1]); client.get(getAbsoluteUrl(CALENDAR_PATH), params, new JsonHttpResponseHandler() { @Override public void onFailure(int statusCode, o…
upvote count: 1

http://stackoverflow.com/a/61555919
downvote count: 0
has body: After more than five years I answer my question. I think that the problem with a negative duration can be solved by a simple correction: LocalDateTime fromDateTime = LocalDateTime.of(2014, 9, 9, 7, 46, 45); LocalDateTime toDateTime = LocalDateTime.of(2014, 9, 10, 6, 46, 45); Period period = Period.between(fromDateTime.toLocalDate(), toDateTime.toLocalDate()); Duration duration = Duration.between(fromDateTime.toLocalTime(), toDateTime.toLocalTime()); if (duration.isNegative()) { period = period.minusDays(1); duration = duration.plusDays(1); } long seconds = duration.getSeconds(); long hours = seconds / SECONDS_PER_HOUR; long minutes = ((seconds % SECONDS_PER_HOUR) / SECONDS_PER_MINUTE); long secs = (seconds % SECONDS_PER_MINUTE); long time[] = {hours, minutes, secs}; System.out.println(period.getYears() + " years " + period.getMonths() + " months " + period.getDays() + " days " + time[0] + " hours " + time[1] + " minutes " + time[2] + " seconds."); Note: The site https://www.epochconverter.com/date-difference now correctly calculates the time difference. Thank you all for your discussion and suggestions.
score: 5
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/108889550
answers question: http://stackoverflow.com/q/25747499

http://stackoverflow.com/comment/40384084
type: Comment
has text: What you can do is make a void with all of the lines of code and then make each actionPerformed reference that void.
comment on: http://stackoverflow.com/q/25814716
score: 0
type: QuestionComment

http://stackoverflow.com/comment/86255067
has text: Press Shift twice. It will open a dialogue box that searches everywhere in Intellij. Search with word "caches" and it will give an option to "Invalidate Caches and Restart". Read the warning before accepting and select it. It will restart Intellij and fix the issue.
comment on: http://stackoverflow.com/a/25767959
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/q/25743950
tagged with: thread-safety
has answer: http://stackoverflow.com/a/25744100
has comment: http://stackoverflow.com/comment/40254100
downvote count: 1
type: Question
upvote count: 0
score: -1
tagged with: sql
has comment: http://stackoverflow.com/comment/40252541
answer count: 1
favorite count: 0
has body: Table with column "count". It has primary key "rowID". Now I want to fetch this count, increment it by 1 and update it. I have a scenario where multiple instances / threads try to update the same column - count. For eg. 3 threads t1,t2,t3 (not synchronised). t1 fetches count(say 0) and increments and updates. Now count would be 1. Now there is a chance that t2 and t3 might try to access the count simultaneously and then issues arise. Please suggest right way to handle this scenario.
has comment: http://stackoverflow.com/comment/40252485
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40252792
has title: Thread - concurrency issue
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/40466524
comment on: http://stackoverflow.com/q/25860663
score: 0
type: Comment
type: QuestionComment
has text: Do you need to run two separate instances of Tomcat? There are benefits of running a single instance of Tomcat, and you can stop/start web-applications independently of each other. One advantage is that you can specify a single memory pool that all applications can share, where in two instances, memory cannot be shared.

http://stackoverflow.com/q/25782059
has comment: http://stackoverflow.com/comment/40322516
has comment: http://stackoverflow.com/comment/40323225
answer count: 1
tagged with: url
favorite count: 0
has title: spring-way handle slash in resource name
tagged with: rest
has answer: http://stackoverflow.com/a/25782639
has body: I have following method in controller: @RequestMapping(value = "/items/{identifier}", method = RequestMethod.DELETE) public void delete(@PathVariable String identifier) { ... // find item in database by identifier } The problem is identifier is a String that can contain slash ('/'). I.e. situation can occurs: http://myhost/items/file:/123 For given URL 'identifier' must be "file:/123". And if there is a '/', 405 (method is not allowed) throws due to incorrect URL. How to tell Spring that it should take all after '/items/' as 'identifier' (resource name in REST terms)? EDIT: I was told that it is client's responsibility to manage slashes and encoding, so I left it as it was. But for the info, based on ankur-singhal answer in comments: Support that I wanted to was added in Spring 4.1.0, see this link and this commit. So in my case it'll be: @RequestMapping(value = "/items/{/identifier}", method = RequestMethod.DELETE) '/' before 'identifier' did a trick.
score: 2
upvote count: 3
linked to: http://stackoverflow.com/q/3235219
tagged with: spring
downvote count: 1
has comment: http://stackoverflow.com/comment/40323728
type: Question
accepted answer: http://stackoverflow.com/a/25782639
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40323024
tagged with: java

http://stackoverflow.com/comment/40239675
type: Comment
comment on: http://stackoverflow.com/q/25735952
score: 0
has text: @JonathanSolorzano e.g. you don't need to specify dependency that can't be found in any online repository; you don't need to call any external commands when building your project from Ant; all your files can be put into maven project's directories without any modification... Try start doing it, and search or ask for help when you encounter problems.
type: QuestionComment

http://stackoverflow.com/comment/40337208
comment on: http://stackoverflow.com/a/25789834
has text: I suppose when you enter FUSE filesystems on Linux, things get nasty. Not saying you *have to* support these, but basically, anything that doesn't fulfill your assumptions might blow up. What if the filesystem uses paths that are neither seperated by `/`, nor by \? Use [`File.separator`](http://docs.oracle.com/javase/1.5.0/docs/api/java/io/File.html#separator) to adapt to this. But there will be things which you likely won't think of before some trips over them.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/48611628
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25734035
has text: Hi Smoky, How do you to retrieve the value via HQL?? kindly provide a sample code.. am having the same problem...
type: Comment

http://stackoverflow.com/q/25825584
downvote count: 0
has body: The two patterns I'm trying to obtain are: 11111 12222 12333 12344 12345 and... *1234 **123 ***12 ****1 ***** Please help me on this. I can't find a way. The only code I can think of is: public class pattern_5 { public static void main(String args[]) { int n=5; for(int i=1;i&lt;=n;i++) { for(int j=1;j&lt;=i;j++) { System.out.print(j); } System.out.println(); } } } The output is wrong. Basically, I only get half of the intended figure (you can get the star half by changing j to * maybe).
has title: java number and "*" looped patterns
has comment: http://stackoverflow.com/comment/40401750
has answer: http://stackoverflow.com/a/25825659
favorite count: 0
tagged with: logic
has comment: http://stackoverflow.com/comment/40401889
possible better answer: http://stackoverflow.com/a/25825625
has answer: http://stackoverflow.com/a/25825625
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25825659
tagged with: loops
upvote count: 1
tagged with: design-patterns
type: Question
score: 1
tagged with: java
answer count: 2
tagged with: for-loop

http://stackoverflow.com/a/25798835
answers question: http://stackoverflow.com/q/25798776
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Let's step through the code a bit... al.add("C"); al.add("A"); al.add("E"); al.add("B"); al.add("D"); al.add("F"); Generates a list of ["C", "A", "E", "B", "D", "F"] //0 1 2 3 4 5 Then... al.add(1, "A2"); Adds "A2" to the position of 1 in this, so we now have a list of ["C", "A2", "A", "E", "B", "D", "F"] //0 1 2 3 4 5 6 Then... al.remove("F"); Which removes the entry "F" from the list... ["C", "A2", "A", "E", "B", "D"] //0 1 2 3 4 5 And then... al.remove(2); Which removes "A" from the list, because "A" is the item at index 2, remember, Java is zero indexed ["C", "A2", "E", "B", "D"] //0 1 2 3 4 Take a closer look at: The java.util.List JavaDocs The Collections trail for more details

http://stackoverflow.com/comment/40464508
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25859745
has text: Just move the logic in code() to main().
type: QuestionComment

http://stackoverflow.com/comment/40217254
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25724353
has text: Hum maybe you're right. At least, it will do the thing as long as there are no other difference in the 2 versions. Thanks for helping me think through it. Edit : someone suggested me to use one project as a dependence of the other. Maybe I should think about it ?

spring-test-dbunit
type: Tag
tag name: spring-test-dbunit
tags question: http://stackoverflow.com/q/25821235

http://stackoverflow.com/q/25729319
accepted answer: http://stackoverflow.com/a/29814439
has title: How does a classloader load classes reference in the manifest classpath?
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40225183
tagged with: jar
favorite count: 0
tagged with: classloader
possible better answer: http://stackoverflow.com/a/36185628
score: 11
has comment: http://stackoverflow.com/comment/40226087
has answer: http://stackoverflow.com/a/36185628
upvote count: 11
has answer: http://stackoverflow.com/a/29814439
tagged with: java
tagged with: classpath
type: Question
type: AnsweredQuestion
has body: I used maven to built a jar with an external classpath additions using addClasspath. When I run that jar using java -jar artifact.jar it is able to load classes from that main jar and from all jars in the libs directory. However if I ask the system property java.class.path it will only list the main jar. If I ask the system class loader for its urls (ClassLoader.getSystemClassLoader().getURLs()) it will also only return the main jar. If I ask any class contained in some library for its class loader it will return the system class loader. How is the system class loader able to load those classes? It has to have some knowledge about those libraries in order to load classes from those. Is there a way to ask it for this kind of "extended" classpath?

http://stackoverflow.com/comment/40277922
has text: @IlgarMamedov I see that. And what do you do when x == table.length? So why do it?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25757514

http://stackoverflow.com/q/25851126
tagged with: jsp
favorite count: 0
has comment: http://stackoverflow.com/comment/40449171
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25851575
upvote count: 1
tagged with: spring
has body: Im studying the form Validation with annotations in Spring mvc 3.0. When i add <mvc:annotation-driven /> to my ***-servlet.xml i get tthe following error, after starting eclipse: java.lang.NoClassDefFoundError: org/springframework/web/method/annotation/ExceptionMethodMapping at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.getDeclaredMethods(Unknown Source) at org.springframework.core.type.StandardAnnotationMetadata.hasAnnotatedMethods(StandardAnnotationMetadata.java:159) at org.springframework.context.annotation.ConfigurationClassUtils.isLiteConfigurationCandidate(ConfigurationClassUtils.java:106) at org.springframework.context.annotation.ConfigurationClassUtils.checkConfigurationClassCandidate(ConfigurationClassUtils.java:87) at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:257) at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:227) at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:623) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454) at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:609) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:571) at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:623) at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:491) at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:432) at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133) at javax.servlet.Gen…
type: Question
score: 1
tagged with: java
has title: java.lang.NoClassDefFoundError: org/springframework/web/method/annotation/ExceptionMethodMapping
has comment: http://stackoverflow.com/comment/40449116
downvote count: 0
answer count: 1

http://stackoverflow.com/q/25810093
tagged with: eclipse
linked to: http://stackoverflow.com/q/251807
has comment: http://stackoverflow.com/comment/40373057
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40374380
has comment: http://stackoverflow.com/comment/40373396
has comment: http://stackoverflow.com/comment/40373896
score: 2
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/84041494
has title: Create a new Eclipse Project programmatically
has body: How can I create a new Eclipse Project programatically just by calling a method in my Java class or something like that? Here I found a solution, but when I add this code, I get the following error: IProject cannot be resolved to a type This is my code: IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); if (!project.exists()) { project.create(monitor); project.open(monitor); } I found also another answer here, but still the details are not clear for me. Could you please tell me how can I do it perhaps in some easy to follow steps?
type: Question
has comment: http://stackoverflow.com/comment/40567219

http://stackoverflow.com/comment/40244436
has text: Okay I find it you forgot to put END before AS, thanks
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25738893
type: Comment

http://stackoverflow.com/comment/40372545
comment on: http://stackoverflow.com/a/25804383
score: 0
has text: And further more, you said that after .execute() is called, the bulk can no longer be used to call .insert(), and that means I need to call initialize() again to require for a new "queue", is that right? Then, can I initialize a new "queue" **before** the .execute() is called on the current one?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40279162
score: 0
comment on: http://stackoverflow.com/q/25758308
type: Comment
type: QuestionComment
has text: Yeah, a stack trace would help people help you.

http://stackoverflow.com/q/25789176
has comment: http://stackoverflow.com/comment/67704789
tagged with: jpa
has body: String q1Str = "SELECT parent_id FROM meta WHERE st_id = "+childIds+";"; Query q1 = em.createNativeQuery(q1Str); //q1.setHint("org.hibernate.cacheable", true); Object parentId = null; try{ parentId = q1.getSingleResult(); }catch(NoResultException nre){ //nope } enabling hibernate.cacheable will throw me the following exception aliases expected length is 0; actual length is 1
has answer: http://stackoverflow.com/a/31072851
downvote count: 0
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15595627
has comment: http://stackoverflow.com/comment/41184047
has title: Aliases expected length is 0; actual length is 1 on hibernate query cache
has answer: http://stackoverflow.com/a/63693277
has comment: http://stackoverflow.com/comment/41225616
has comment: http://stackoverflow.com/comment/41224137
linked to: http://stackoverflow.com/q/54801806
linked to: http://stackoverflow.com/q/40221978
score: 7
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40335672
has comment: http://stackoverflow.com/comment/68003305
has comment: http://stackoverflow.com/comment/41217412
upvote count: 7
type: Question
answer count: 2

http://stackoverflow.com/q/25742440
has body: I'm here to pose a kinda noob question, so please no hate here mates. The java application I'm trying to create has the following structure. login request via net Validation(same machine) **JAVA PROGRAM** ---------------------------------&gt; **WebService** ---------------------------------------&gt; **db** Response Response **db** --------------&gt; **WebService** ----------------&gt; **JAVA PROGRAM** But my doubt is on how to build that webservice. I've watched several glassfish tutorials, but none of them seem to explain how to actually create this type of connections. Thank you!
favorite count: 0
upvote count: 0
score: -3
tagged with: web-services
has answer: http://stackoverflow.com/a/25742912
possible better answer: http://stackoverflow.com/a/25742830
has answer: http://stackoverflow.com/a/25742830
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40250231
tagged with: java
tagged with: mysql
has title: Java to a web service and mysql
type: Question
answer count: 2
downvote count: 3
accepted answer: http://stackoverflow.com/a/25742912

http://stackoverflow.com/comment/40347219
type: QuestionComment
has text: Are you sure it's `http://localhost:8080/users` and there's no root path before `users` part? Maybe start from some `GET` request, it should be easier to diagnose.
comment on: http://stackoverflow.com/q/25795369
score: 0
type: Comment

http://stackoverflow.com/q/25828115
has answer: http://stackoverflow.com/a/25836844
type: AnsweredQuestion
has title: Storing Month Format on a Database (From Java)
has comment: http://stackoverflow.com/comment/40406805
upvote count: 1
has answer: http://stackoverflow.com/a/25828439
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/40406928
has comment: http://stackoverflow.com/comment/40406866
has comment: http://stackoverflow.com/comment/40406755
has comment: http://stackoverflow.com/comment/40406654
score: 1
has comment: http://stackoverflow.com/comment/40406606
tagged with: java
tagged with: date
answer count: 2
accepted answer: http://stackoverflow.com/a/25828439
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40406587
has body: I have an Android app where there is a spinner (drop-down) list where I list the next 24 months from the current date. (The Context: The user can pick a date in the next two years to schedule a payment). Currently, I correctly display the current date (based by locale) in the spinner and this is not the problem. My question is: What kind of unit should I store for the value of the selection? The first choice seemed like a unix timestamp, but that refers to a specific point in time down to the millisecond and doesn't represent a whole month. I can't just use a month (for example, 10 is November), because I need the year too. For example, it is September 2014 as I write this. If the user wants to schedule a payment two months from now, they would select "Nov 2014" (the format I choose). What value can I use in the database that would ALWAYS represent this month in this specific year? I fear I am overthinking this. Here is my code so far: for (int i = 0; i &lt; 24;i++) { Month m = new Month(); cal.add(Calendar.MONTH, i); Date date = cal.getTime(); m.num = date.toString(); // This is where I am trying to store the output - not sure if I am on right track? } Month is my object I am creating for the spinner. It has two values; one not shown here that is the readable format, the other is num which is my value.
tagged with: android
possible better answer: http://stackoverflow.com/a/25836844

http://stackoverflow.com/comment/40372485
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25790338
type: Comment
has text: Thank you for answer. You are correct, but IMHO the switch is a tool for experienced developer. Usage of it can introduce issue (fall througt) and increase instead decrese the complexity of code by unwanted dependecies in sigle decision point. But still it is valid and precious tool that from time to time can boots some action. But still you can not state that if your code does not have swith the you do not know Java language. Have a nice day.

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/25802877
tags question: http://stackoverflow.com/q/25729727
tags question: http://stackoverflow.com/q/25806576
tags question: http://stackoverflow.com/q/25873180
tags question: http://stackoverflow.com/q/25723331
tags question: http://stackoverflow.com/q/25863676
tag name: android-actionbar
tags question: http://stackoverflow.com/q/25716110

http://stackoverflow.com/q/25790790
has body: The program works for all variables EXCEPT High Active and Somewhat Active. I can't seem to figure out why but I believe it has to do with the .equalsIgnoreCase import java.util.Scanner; public class BMI { public static void main(String[] args) { // TODO Auto-generated method stub Scanner keyboard = new Scanner(System.in); System.out.println("Welcome to the BMR calculator!"); System.out.println("Are you male or female? Enter m or f."); String gender = keyboard.next(); System.out.println("How tall are you in inches?"); int height = keyboard.nextInt(); System.out.println("How much do you weigh in pounds?"); int weight = keyboard.nextInt(); System.out.println("How old are you in years?"); int age = keyboard.nextInt(); System.out.println("How would you describe your lifestyle? \"Sedentary\", \"Somewhat Active\", \"Active\", or \"Highly Active\"?"); String active = keyboard.next(); // This gets all the necessary information to calculate the BMI. if (gender.equalsIgnoreCase("f")) //If the person is female BMR = 655 + (4.3 x weight in pounds) + (4.7 x height in inches) – (4.7 x age in years) { if (active.equalsIgnoreCase("Sedentary")) { double BMR = (655 + (4.3 * weight) + (4.7 * height) - (4.7 * age)) * 1.2; System.out.println("Your BMR is " +BMR+ " calories!"); } ///My issue occurs here I think. else if (active.equalsIgnoreCase("Somewhat Active")) { double BMR = (655 + (4.3 * weight) + (4.7 * height) - (4.7 * age)) * 1.3; System.out.println("Your BMR is " +BMR+ " calories!"); } else if (active.equalsIgnoreCase("Active")) { double BMR = (655 + (4.3 * weight) + (4.7 * height) - (4.7 * age)) * 1.4; System.out.println("Your BMR is " +BMR+ " calories!"); } else if (active.equalsIgnoreCase("Highly Active")) { double BMR = (655 + (4.3 * weight) + (4.7 * height) - (4.7 * age)) * 1.5; System.out.println("Your BMR is " +BMR+ " calories!"); } } else if (gender.equalsIgnoreCase("m")) //If the person is male BMR = 66 + (6.3 x weight in pounds) + (12.9 x height in inches) – (6.8 x age…
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25791318
downvote count: 0
type: UnansweredQuestion
has title: Using Java, .equalsIgnoreCase doesn't work with two words. How do I fix?
has comment: http://stackoverflow.com/comment/40339192
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40337749
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/25790880
type: Question
answer count: 2

http://stackoverflow.com/comment/41005837
type: AnswerComment
score: 0
type: Comment
has text: I have the same problem .. do you have a solution to that?
comment on: http://stackoverflow.com/a/25759023

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/25749606
tags question: http://stackoverflow.com/q/25741636
tags question: http://stackoverflow.com/q/25733907
tags question: http://stackoverflow.com/q/25822991
tags question: http://stackoverflow.com/q/25822433
tags question: http://stackoverflow.com/q/25728007
tags question: http://stackoverflow.com/q/25786375
tags question: http://stackoverflow.com/q/25844326
tags question: http://stackoverflow.com/q/25749875
tags question: http://stackoverflow.com/q/25804776
tags question: http://stackoverflow.com/q/25748719
tags question: http://stackoverflow.com/q/25863795
tags question: http://stackoverflow.com/q/25813164
tags question: http://stackoverflow.com/q/25749552
tags question: http://stackoverflow.com/q/25811875
tags question: http://stackoverflow.com/q/25727926
tags question: http://stackoverflow.com/q/25823790
tags question: http://stackoverflow.com/q/25837012
tags question: http://stackoverflow.com/q/25721676
tags question: http://stackoverflow.com/q/25730500
tags question: http://stackoverflow.com/q/25739304
tags question: http://stackoverflow.com/q/25713884
tags question: http://stackoverflow.com/q/25789769
tags question: http://stackoverflow.com/q/25848665
tags question: http://stackoverflow.com/q/25849912
tags question: http://stackoverflow.com/q/25735497
tags question: http://stackoverflow.com/q/25761034
tags question: http://stackoverflow.com/q/25716058
tags question: http://stackoverflow.com/q/25822958
tags question: http://stackoverflow.com/q/25853854
tags question: http://stackoverflow.com/q/25789573
tags question: http://stackoverflow.com/q/25723274
tags question: http://stackoverflow.com/q/25817604
tags question: http://stackoverflow.com/q/25736280
tags question: http://stackoverflow.com/q/25812027
tags question: http://stackoverflow.com/q/25835052
tags question: http://stackoverflow.com/q/25869027
tags question: http://stackoverflow.com/q/25814164
tags question: http://stackoverflow.com/q/25811221
type: Tag
tags question: http://stackoverflow.com/q/25798880
tags question: http://stackoverflow.com/q/25806263
tags question: http://stackoverflow.com/q/25756912
tags question: http://stackoverflow.com/q/25721510
tags question: http://stackoverflow.com/q/25796652
tags question: http://stackoverflow.com/q/25789594
tags question: http://stackoverflow.com/q/25847508
tags question: http://stackoverflow.com/q/25850440
tags question: http://stackoverflow.com/q/25859921
tags question: http://stackoverflow.com/q/25841395
tags question: http://stackoverflow.com/q/25828048
tags question: http://stackoverflow.com/q/25800804
tags question: http://stackoverflow.com/q/25792148
tags question: http://stackoverflow.com/q/25794516
tags question: http://stackoverflow.com/q/25849705
tags question: http://stackoverflow.com/q/25820649
tags question: http://stackoverflow.com/q/25854691
tags question: http://stackoverflow.com/q/25764126
tags question: http://stackoverflow.com/q/25744441
tags question: http://stackoverflow.com/q/25847561
tags question: http://stackoverflow.com/q/25753615
tags question: http://stackoverflow.com/q/25853071
tags question: http://stackoverflow.com/q/25854411
tags question: http://stackoverflow.com/q/25843919
tags question: http://stackoverflow.com/q/25844862
tags question: http://stackoverflow.com/q/25817922
tags question: http://stackoverflow.com/q/25795142
tags question: http://stackoverflow.com/q/25861400
tags question: http://stackoverflow.com/q/25821103
tags question: http://stackoverflow.com/q/25824253
tags question: http://stackoverflow.com/q/25742968
tag name: json
tags question: http://stackoverflow.com/q/25857362
tags question: http://stackoverflow.com/q/25742644
tags question: http://stackoverflow.com/q/25738569
tags question: http://stackoverflow.com/q/25858782
tags question: http://stackoverflow.com/q/25758106
tags question: http://stackoverflow.com/q/25869294
tags question: http://stackoverflow.com/q/25799782
tags question: http://stackoverflow.com/q/25779430

http://stackoverflow.com/comment/40286810
score: 0
comment on: http://stackoverflow.com/a/25760665
type: AnswerComment
has text: Traceback (most recent call last): File "checkrgb.py", line 5, in <modul print "R:", img[:, :, 0].max() IndexError: too many indices for array
type: Comment

soapui
tags question: http://stackoverflow.com/q/25720206
type: Tag
tags question: http://stackoverflow.com/q/25804889
tag name: soapui
tags question: http://stackoverflow.com/q/25797803

http://stackoverflow.com/comment/40226388
has text: now everything is logic, i receive the same answers, i still have some problems but you helped me solve this one, thanks man
comment on: http://stackoverflow.com/a/25726984
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25766991
has comment: http://stackoverflow.com/comment/40296492
has title: Multiple buttons with different layouts
accepted answer: http://stackoverflow.com/a/25790368
tagged with: layout
answer count: 1
tagged with: button
has comment: http://stackoverflow.com/comment/40308037
score: 0
tagged with: android
tagged with: android-activity
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25790368
type: Question
tagged with: java
has body: I have one activity with 5 buttons. Each button should show up one activity (total 5 different activities). I tried many methods for multiple buttons but my app does not work. The first button of the activity starts its linked activity without any problem (btEtiologia and the activity is Etiology), but the second button still won't show up, and returns to the Main Activity (that is home layout). When I restart the app, I try with the second button, and third buttons and works, but the fourth button won´t show up and returns to the main activity. I have dowloaded the app on a samsung galaxy S2 and is the same than emulator. ¿Is anything wrong with my code? Here is the java code of Inicio: package com.example.protesis; import android.support.v7.app.ActionBarActivity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.Toast; public class Inicio extends ActionBarActivity implements View.OnClickListener { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_inicio); Button btInformacion = (Button) findViewById(R.id.btInformacion); btInformacion.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Toast.makeText(getBaseContext(), "Esta aplicación esta basada en el manejo de las infecciones de prótesis articulares de la IDSA", Toast.LENGTH_SHORT).show(); } }); findViewById(R.id.btEtiologia).setOnClickListener(this); findViewById(R.id.btAlgoritmo).setOnClickListener(this); findViewById(R.id.btAntibioiv).setOnClickListener(this); findViewById(R.id.btAntibioral).setOnClickListener(this); findViewById(R.id.btRetirada).setOnClickListener(this); } public void onClick(View arg0){ // create a general intent Intent intent = null; // define an intent for all cases switch(arg0.getId()){ case R.id.btEtiologia: // Setting intent for first butt…

http://stackoverflow.com/a/25782972
has comment: http://stackoverflow.com/comment/40325182
has comment: http://stackoverflow.com/comment/40324256
answers question: http://stackoverflow.com/q/25782757
has comment: http://stackoverflow.com/comment/40324092
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: how about check and throw exception in constructor? private Singleton(){ if(SingletonHolder.INSTANCE !=null) throw new IllegalStateException("Not allowed!"); } another possibility is, implement your singleton pattern with java Enum. public enum Singleton { INSTANCE; public void doStuff(){...} }
downvote count: 0
has comment: http://stackoverflow.com/comment/40324639
score: 1
has comment: http://stackoverflow.com/comment/40324389
has comment: http://stackoverflow.com/comment/40325024
accepted answer of: http://stackoverflow.com/q/25782757
has comment: http://stackoverflow.com/comment/40324421

http://stackoverflow.com/q/25822102
answer count: 2
has title: Handling Strings with octal ASCII code (in Java)
has answer: http://stackoverflow.com/a/25822244
accepted answer: http://stackoverflow.com/a/25822234
has body: i'm having some trouble with a text file that contains strings like these: Grandchamp-le-Ch\303\242teau It's the name of a Wikipedia page by the way. The two asciis represent "â" I think. Is there any piece of software that easily converts the string above into Grandchamp-le-Château or maybe Grandchamp-le-Ch%C3%A2teau I would prefer a java absed solution, but any other idea is just as well! Any advice or hint is very much appreciated!
favorite count: 0
possible better answer: http://stackoverflow.com/a/25822244
type: AnsweredQuestion
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/25822234
downvote count: 1
type: Question
tagged with: ascii
score: 0

http://stackoverflow.com/comment/40353582
score: 1
type: Comment
has text: you will also need synchronization here and you will need to synchronize on ```A.class```
comment on: http://stackoverflow.com/a/25798886
type: AnswerComment

http://stackoverflow.com/q/25735979
type: Question
tagged with: mongodb
answer count: 2
has body: I've never used CouchDB/MongoDB/Couchbase before and am evaluating them for my application. Generally speaking, they seem to be a very interesting technology that I would like to use. However, coming from an RDBMS background, I am hung up on the lack of transactions. But at the same time, I know that there is going to be much less a need for transactions as I would have in an RDBMS given the way data is organized. That being said, I have the following requirement and not sure if/how I can use a NoSQL DB. I have a list of clients Each client can have multiple files Each file must be sequentially number for that specific client Given an RDBMS this would be fairly simple. One table for client, one (or more) for files. In the client table, keep a counter of last filenumber, and increment by one when inserting a new record into the file table. Wrap everything in a transaction and you are assured that there are inconsistencies. Heck, just to be safe, I could even put a unique constraint on a (clientId, filenumber) index to ensure that there is never the same filenumber used twice for a client. How can I accomplish something similar in MongoDB or CouchDB/base? Is it even feasible? I keep reading about two-phase commits, but I can't seem to wrap my head around how that works in this kind of instance. Is there anything in Spring/Java that provides two-phase commit that would work with these DBs, or does it need to be custom code?
tagged with: couchdb
has title: CouchDB/Couchbase/MongoDB transaction emulation?
linked to: http://stackoverflow.com/q/299723
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25736306
tagged with: spring
tagged with: transactions
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25736681
upvote count: 1

http://stackoverflow.com/a/25765658
type: Answer
has body: This answer might help you: https://stackoverflow.com/a/5959341 To validate a string, use if (setNum.matches(regexStr)) where regexStr can be: //matches numbers only String regexStr = "^[0-9]*$" //matches 10-digit numbers only String regexStr = "^[0-9]{10}$" //matches numbers and dashes, any order really. String regexStr = "^[0-9\\-]*$" //matches 9999999999, 1-999-999-9999 and 999-999-9999 String regexStr = "^(1\\-)?[0-9]{3}\\-?[0-9]{3}\\-?[0-9]{4}$" There's a very long regex to validate phones in the US (7 to 10 digits, extensions allowed, etc.). The source is from this answer: A comprehensive regex for phone number validation String regexStr = "^(?:(?:\\+?1\\s*(?:[.-]\\s*)?)?(?:\\(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*\\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})(?:\\s*(?:#|x\\.?|ext\\.?|extension)\\s*(\\d+))?$"
score: 10
upvote count: 10
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25763935
downvote count: 0
answers question: http://stackoverflow.com/q/25763935

http://stackoverflow.com/q/25854530
has comment: http://stackoverflow.com/comment/40454638
has body: The task is to create a program in Java that prints a histogram to the console, that shows the frequency distribution of a set of values The program is to read integers in the range of 1-100 incl. and then produce a chart like the one on the given image. So far, I have come up with the following solution, but the teacher says that it is too complex, and that there is an easier way to implement it. No one from my class, has been able to see how though, but I can see what she is saying about the solution I have come up with, shown below, since there is a problem scaling it, when I use the first int in the filled array, to sort it. public void printChart() { res = new int[10]; for (int i = 0; i &lt; ia.length; i++) { int firstDigit = 0; if (i &gt; 10) { firstDigit = Integer.parseInt(Integer.toString(ia[i]).substring(0, 1)); } res[firstDigit] += 1; } for (int i = 0; i &lt; res.length; i++) { System.out.format("%-10s %-5s", (i) + "1" + " - " + (i+1) + "0", "|"); for (int o = 0; o &lt; res[i]; o++) { System.out.print("*"); } System.out.println(""); } } She suggested that I make a new array containing the same amount as the original array, sort of like what I have written here, but I can't seem to figure out how to loop through it, to print it out. She even says it's possible with no if sentences, so I imagine that I will have to write some condition(s) in the for loop. public void printChart2() { res = new int[NUMBERS]; // Fill the other array, by counting the amount of a specific int // and placing it on the given relevant index for (int i = 0; i &lt; ia.length; i++) { res[ia[i]] += 1; } for (int i = 0; i &lt; res.length; i += 10) { System.out.format("%-10s %-5s", (i+1) + " - " + (i+10), "|"); } } Here is my fields and constructor, just in case. private final int NUMBERS = 100; private final int RANDOMMAX = 99; private int[] ia; private int[] res; public Arbitrary() { ia = new int[NUMBERS]; for (int i = 0; i &lt; NUMBERS; i++) { ia[i] = (int) (Math.random() * RANDOMMAX) …
has comment: http://stackoverflow.com/comment/40454716
has comment: http://stackoverflow.com/comment/40454834
tagged with: loops
accepted answer: http://stackoverflow.com/a/25854742
type: AnsweredQuestion
tagged with: nested-loops
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25854742
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40454884
tagged with: arrays
has comment: http://stackoverflow.com/comment/40454605
tagged with: logic
has title: Logic in nested loops

http://stackoverflow.com/a/25844673
has body: Set[Set][1] is an interface, HashSet[HashSet][2] is a class, Implementing Set interface methods in HashSet classes, HashSet class implements Set interface
type: Answer
answers question: http://stackoverflow.com/q/25844599
score: 0

http://stackoverflow.com/a/25859229
downvote count: 0
answers question: http://stackoverflow.com/q/25859178
type: Answer
upvote count: 3
has body: You can run a task at fixed rate using ScheduledExecutorService and stop it on some action (here by reading System.in): public static void main(String[] args) throws InterruptedException { ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(); ses.scheduleAtFixedRate(new Runnable() { @Override public void run() { // do some work } }, 0, 5, TimeUnit.MINUTES); // every 5 minutes // when anything is entered, the task is stopped Scanner sc = new Scanner(System.in); String whatever = sc.next(); // shutdown the executor ses.shutdown(); ses.awaitTermination(15, TimeUnit.SECONDS); }
score: 3
has comment: http://stackoverflow.com/comment/40464230

http://stackoverflow.com/q/25713777
has comment: http://stackoverflow.com/comment/40196359
has body: im a beginner in java and im trying to make rthis very basic program that draw a simple christmas of height 5-40.However, the christmas tree stump is just a *,and I would like it to change depending of wich decade we are in: for example, if the user enter number between 5-9, thestump would be 1 * large and height of 1; if user would enter 10-19,stump would be 3 * large and height of 2;20-29 a stump of 5 * large and height of 4...Basically, increase the stump width by two every decade.Heres my code so far: public static void main(String[] args) { int temp; do{ Scanner scan = new Scanner(in); out.print("enter a number "); temp = scan.nextInt(); if(temp &gt;= 5 &amp;&amp; temp &lt;= 40){ int x = (temp-1)*2 +1; int y = x/2; int z = 1; for(int i=0; i&lt;temp-1; i++) { for(int j=0; j&lt;=y; j++) { out.print(" "); } for(int k = 0; k&lt;z; k++) { out.print("*"); } out.println(); y--; z+=2; } for(int i =0; i&lt;=x/2; i++) { out.print(" "); } out.println("*"); }else{ out.print("please enter a number between 5-40 or enter 0 to quit"); } }while(temp != 0); } } Im not quite sur of how to do that.Thank you!
answer count: 1
favorite count: 0
tagged with: division
tagged with: drawing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25713957
tagged with: java
downvote count: 2
type: Question
upvote count: 0
score: -2
tagged with: project
has comment: http://stackoverflow.com/comment/40196446
has title: christmas tree stump(java)
accepted answer: http://stackoverflow.com/a/25713957
has comment: http://stackoverflow.com/comment/40196374

http://stackoverflow.com/a/25837406
answers question: http://stackoverflow.com/q/25837345
score: 0
type: Answer
has body: I don't know how you calculate these values through PuzzlePropertyUtility but if you want a descending order you need to revert the return value as return o2FScore - o1FScore ;

http://stackoverflow.com/comment/40371257
type: Comment
has text: waiting for your reply.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25790421

http://stackoverflow.com/comment/40284882
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25760743
has text: @Trengot What exactly do you mean by "will give a different result"?
type: AnswerComment

http://stackoverflow.com/q/25728124
possible better answer: http://stackoverflow.com/a/25728169
favorite count: 0
answer count: 5
has title: Creating a loop with a Scanner
accepted answer: http://stackoverflow.com/a/25728171
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/25728164
has body: I am trying to make it so a scanner takes in the number the user enters then prints hello world for how many times the user has imputed that number using a while loop. I created a Scanner for x, I am having trouble finding out how to properly execute the loop though. // import Scanner to take in number user imputs import java.util.Scanner; public class HelloWorld { public static void main(String[] args){ // create a scanner class that takes in users number Scanner scan = new Scanner(System.in); System.out.println("Please enter a whole number: " ); // use x as the number the user entered int x = scan.nextInt(); while ( ){ System.out.println("Hello World!"); } } }
has answer: http://stackoverflow.com/a/25728202
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25728169
has answer: http://stackoverflow.com/a/25728716
has answer: http://stackoverflow.com/a/25728171

http://stackoverflow.com/comment/40462235
has text: ok hold on just a minute
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25858545

cachedrowset
type: Tag
tags question: http://stackoverflow.com/q/25842172
tag name: cachedrowset
tags question: http://stackoverflow.com/q/25819496

http://stackoverflow.com/q/25713625
answer count: 4
type: UnansweredQuestion
tagged with: design-patterns
has answer: http://stackoverflow.com/a/25723149
has body: I have three java component - ComponentA, ComponentB, ComponentC. I want to orchestrate these component. There could be multiple combination (but in sequence) while executing these component for e.g. ComponentA, -> ComponentB, -> ComponentC or ComponentA, -> ComponentC. Which pattern would be the best fit here ? Every component has their own functionality and doesn't depend on each other. I'm looking at mediator java pattern but not sure if this is good fit in this case.
has title: Design Pattern for orchestration
tagged with: java
has answer: http://stackoverflow.com/a/66071272
type: Question
upvote count: 4
downvote count: 0
score: 4
favorite count: 0
has answer: http://stackoverflow.com/a/33070596
has answer: http://stackoverflow.com/a/25724416

http://stackoverflow.com/a/26025795
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/25849705
answers question: http://stackoverflow.com/q/25849705
score: 6
has body: This is quite interesting. I think you can solve this with BeanSerializerModifier. The idea is to register a custom serialiser which would have access to the original bean serialiser, the property description and the object value. If the property is annotated with a GenerateHash annotation, then the serialiser will emit an additional field. Here is an example: public class JacksonGenerateHash { @Retention(RetentionPolicy.RUNTIME) public static @interface GenerateHash { } public static class Bean { @GenerateHash public final String value; public Bean(final String value) { this.value = value; } } private static class MyBeanSerializerModifier extends BeanSerializerModifier { @Override public JsonSerializer&lt;?&gt; modifySerializer( final SerializationConfig serializationConfig, final BeanDescription beanDescription, final JsonSerializer&lt;?&gt; jsonSerializer) { return new HashGeneratingSerializer((JsonSerializer&lt;Object&gt;) jsonSerializer, null); } } private static class HashGeneratingSerializer extends JsonSerializer&lt;Object&gt; implements ContextualSerializer { private final JsonSerializer&lt;Object&gt; serializer; private final BeanProperty property; public HashGeneratingSerializer( final JsonSerializer&lt;Object&gt; jsonSerializer, final BeanProperty property) { this.serializer = jsonSerializer; this.property = property; } @Override public void serialize( final Object o, final JsonGenerator jsonGenerator, final SerializerProvider serializerProvider) throws IOException { serializer.serialize(o, jsonGenerator, serializerProvider); // if the generatehash is present the property must be set if (property != null) { jsonGenerator.writeNumberField("_hash_" + property.getName(), o.hashCode()); } } // override this method to access the bean property @Override public JsonSerializer&lt;?&gt; createContextual( final SerializerProvider prov, final BeanProperty property) throws JsonMappingException { if (property != null &amp;&amp; property.getAnnotation(GenerateHash.cla…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/41333038

http://stackoverflow.com/a/25867925
answers question: http://stackoverflow.com/q/25855563
type: Answer
accepted answer of: http://stackoverflow.com/q/25855563
type: AcceptedAnswer
score: 0
has body: I thought there was a better solution. This is what I did, maybe help somebody: List&lt;Profile&gt; followers=JPA.em().createQuery( "select p from " + Profile.class.getName() + " p " + "join p.fansFollowed f where f.id = :id") .setParameter("id", profile.id) .getResultList(); for (Profile follower : followers) { follower.fansFollowed.remove(profile); follower.save(); } profile.delete();

http://stackoverflow.com/a/25828668
accepted answer of: http://stackoverflow.com/q/25828633
type: Answer
answers question: http://stackoverflow.com/q/25828633
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40407458
has body: You have to give the text field a variable name if you want to change its settings. Change this line: matrix.add(new JTextField(temp, 2)); to these lines: JTextField text = new JTextField(temp, 2)); text.setHorizontalAlignment(JTextField.CENTER); matrix.add(text);
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/40273026
comment on: http://stackoverflow.com/a/25753540
score: 0
type: Comment
has text: Thanks @Phesmo for the explanation, in addition,as per my understanding `?<=\\G` means lookbehind at the end of previous match and `?<=\\G.{15}` means look behind at the end of previous match after 15 characters, the end of last match is where the split needs to be done.
type: AnswerComment

http://stackoverflow.com/q/25714235
tagged with: android-binder
has comment: http://stackoverflow.com/comment/41690401
has body: I need a viable workaround for this problem. I take a picture using the android Camera. The method invoked is called onPictureTaken. The program is supposed to take the byte array from the picture, and pass it back to the intent waiting for it in another class. My problem is that I get the Failed Binder Transaction error. I know this is because the data is too big. Is there a viable way to compress it before sending it? **Note, I know I could just make and compress a bitmap, but its far more preferable with the way my program is written to send the actual byte array instead. Code below: public void onPictureTaken(byte[] data, Camera camera) { Toast.makeText(getApplicationContext(), "Picture Taken", Toast.LENGTH_SHORT).show(); //start of finish intent Intent intent = new Intent(); intent.putExtra("image_arr", data); setResult(1, intent); camera.stopPreview(); if (camera != null) { camera.release(); mCamera = null; } finish(); In addition, I only get this error on some android devices, for example my GS5 does not throw this error, but my Moto X does. Is there a way to make sure the compression that will be done is enough that it won't throw an error on the device? Thanks!
has comment: http://stackoverflow.com/comment/45902755
type: UnansweredQuestion
tagged with: android
tagged with: android-bitmap
has title: Android Failed Binder Transaction Workaround
answer count: 0
score: 0
tagged with: java
type: Question

http://stackoverflow.com/q/25796079
has comment: http://stackoverflow.com/comment/40348240
has comment: http://stackoverflow.com/comment/40348071
answer count: 4
has answer: http://stackoverflow.com/a/25797040
has answer: http://stackoverflow.com/a/25796220
has title: Java class to break down change into coins?
has answer: http://stackoverflow.com/a/25796346
has comment: http://stackoverflow.com/comment/40376280
type: AnsweredQuestion
score: 1
tagged with: java
has body: I am working on a java assignment where you enter the price of an object and the amount a theoretical customer handed you for the item. Then the program returns how much you owe them, and breaks it down into dollars, quarters, dimes, nickles, and pennies that you should give them. Basically here's what it would look like when it runs What was the purchase price? (exclude the decimal in calculation if it helps you) $98.50 How much money did you pay with? (exclude the decimal) $100.00 The purchase price was $98.50 You payed $100.0 You received $1.50 in change. 0 one hundred dollar bill(s) 0 fifty dollar bill(s) 0 twenty dollar bill(s) 0 ten dollar bill(s) 0 five dollar bill(s) 1 one dollar bill(s) 2 quarter(s) 0 dime(s) 0 nickel(s) 0 penny/pennies I understand most of it, but I cant seem to wrap my mind around the breakdown of the change handed back. Here's my code so far, but if someone could show me how to break down the change. import java.util.*; public class ChangeTendered { public static void main(String[] args){ Scanner scan = new Scanner(System.in); System.out.println("Enter the purchase price: "); double price = scan.nextDouble(); System.out.println("Enter the amount payed: "); double ammountPayed = scan.nextDouble(); double changeDue = ammountPayed - price; int dollars = (int)changeDue; System.out.println("Return"+ dollars+ "Dollars"); scan.close(); } } On a side note, I just cast the changeDue to an int in order to chop off the decimal and get the dollars due, if that caused any confusion.
possible better answer: http://stackoverflow.com/a/25796346
type: Question
upvote count: 2
downvote count: 1
has answer: http://stackoverflow.com/a/25796211
favorite count: 0
accepted answer: http://stackoverflow.com/a/25796220
has comment: http://stackoverflow.com/comment/40350305
has comment: http://stackoverflow.com/comment/40371319

http://stackoverflow.com/q/25855535
tagged with: webdav
has answer: http://stackoverflow.com/a/29236356
type: Question
has title: Jackrabbit WebDAV Synchronization Examples?
tagged with: apache
answer count: 1
tagged with: jackrabbit
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I'm using the Jackrabbit library for communicating with a cloud storage using the webdav protocol. I need a way to list all files from a specific directory and get the last modified property but I can't seem to find any working examples on this. I basically need code to synchronize files from the local directory with the webdav url. import java.io.File; import java.io.FileInputStream; import org.apache.commons.httpclient.Credentials; import org.apache.commons.httpclient.HttpClient; import org.apache.commons.httpclient.UsernamePasswordCredentials; import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.InputStreamRequestEntity; import org.apache.commons.httpclient.methods.RequestEntity; import org.apache.jackrabbit.webdav.client.methods.DavMethod; import org.apache.jackrabbit.webdav.client.methods.MkColMethod; import org.apache.jackrabbit.webdav.client.methods.PutMethod; public class WebDavClient { private String resourceUrl; private HttpClient client; private Credentials credentials; private DavMethod method; public WebDavClient(String resourceUrl, String username, String password) throws Exception { this.resourceUrl = resourceUrl; client = new HttpClient(); credentials = new UsernamePasswordCredentials(username, password); client.getState().setCredentials(AuthScope.ANY, credentials); } public int upload(String fileToUpload) throws Exception { method = new PutMethod(getUpdatedWebDavPath(fileToUpload)); RequestEntity requestEntity = new InputStreamRequestEntity( new FileInputStream(fileToUpload)); ((PutMethod) method).setRequestEntity(requestEntity); client.executeMethod(method); return method.getStatusCode(); } public int createFolder(String folder) throws Exception { method = new MkColMethod(getUpdatedWebDavPath(folder)); client.executeMethod(method); return method.getStatusCode(); } private String getUpdatedWebDavPath(String file) { // Make sure file names do not contain spaces return resourceUrl + "/" + new File(file).get…
tagged with: java

http://stackoverflow.com/a/25715683
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40199925
answers question: http://stackoverflow.com/q/25715535
has body: I'm guessing what you're attempting to accomplish is a Caesar Cypher. Take a look at this post: Java Int &amp; ASCII Question

http://stackoverflow.com/a/25782880
answers question: http://stackoverflow.com/q/25782608
has comment: http://stackoverflow.com/comment/40324063
has comment: http://stackoverflow.com/comment/40323838
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40323935
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40324042
has body: You'd need something along these lines: private void recursiveMethod(int numberOfSyllablesToAdd, String[] syllables, String word) { for (int i = 0; i &lt; syllables.length; i++) { String newWord = word + syllables[i]; if (numberOfSyllablesToAdd &gt;= 0) { recursiveMethod(numberOfSyllablesToAdd - 1, syllables, newWord); } else { System.out.println(newWord); } } } Note: This is really ineffective for multiple reasons (like not using a StringBuilder or StringBuffer to create the words)

list
type: Tag
tags question: http://stackoverflow.com/q/25788937
tags question: http://stackoverflow.com/q/25847449
tags question: http://stackoverflow.com/q/25866974
tags question: http://stackoverflow.com/q/25749161
tags question: http://stackoverflow.com/q/25818701
tags question: http://stackoverflow.com/q/25728006
tags question: http://stackoverflow.com/q/25790022
tags question: http://stackoverflow.com/q/25840144
tag name: list
tags question: http://stackoverflow.com/q/25791406
tags question: http://stackoverflow.com/q/25799808
tags question: http://stackoverflow.com/q/25768530
tags question: http://stackoverflow.com/q/25771848
tags question: http://stackoverflow.com/q/25729553
tags question: http://stackoverflow.com/q/25762188
tags question: http://stackoverflow.com/q/25778687
tags question: http://stackoverflow.com/q/25720638
tags question: http://stackoverflow.com/q/25734672
tags question: http://stackoverflow.com/q/25773118
tags question: http://stackoverflow.com/q/25809662
tags question: http://stackoverflow.com/q/25720921
tags question: http://stackoverflow.com/q/25822968
tags question: http://stackoverflow.com/q/25787704
tags question: http://stackoverflow.com/q/25752181

http://stackoverflow.com/q/25843946
tagged with: lotus-domino
has comment: http://stackoverflow.com/comment/40436259
has comment: http://stackoverflow.com/comment/40437388
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40435829
tagged with: java
has body: For explain situation I was in Lotus Designer. I works with java class and I would like add code from java Library and I can't. My library are in the Script's Libraries but I can't import this class of my Library !! I don't understand !! exemple : Code =&gt; Script's Libraries =&gt; com.pasquier.utilitaire.UtiliRepertoire; =&gt; java's code =&gt; package com.pasquier.photoWeb.DAO; package com.pasquier.photoWeb.DAO; import com.pasquier.utilitaire.UtilRepertoire; &lt;= "import can not be resolved" public class PhotoDAO { } Could you help me ?
has comment: http://stackoverflow.com/comment/40436019
type: Question
has comment: http://stackoverflow.com/comment/40435848
score: 0
has answer: http://stackoverflow.com/a/26032905
has comment: http://stackoverflow.com/comment/40436735
answer count: 1
has comment: http://stackoverflow.com/comment/40436091
has title: How import java class from library java in code java
tagged with: shared-libraries
has comment: http://stackoverflow.com/comment/40436166
accepted answer: http://stackoverflow.com/a/26032905

http://stackoverflow.com/comment/84128463
has text: Possible duplicate of [How to define in Liquibase a set of default columns, def. PKs, def. indexes, def. values for table creation?](https://stackoverflow.com/questions/25228076/how-to-define-in-liquibase-a-set-of-default-columns-def-pks-def-indexes-def)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25840467
score: 0

http://stackoverflow.com/comment/40275196
has text: You're certainly on the right track with replaceAll() as one solution to your problem. [Here](http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#replaceAll%28java.lang.String,%20java.lang.String%29) Is the Javadoc on that method.
score: 0
comment on: http://stackoverflow.com/q/25755889
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40365797
has text: Cool. Thank you!! and thanks for explaining the different equals() between Array and ArrayList!
comment on: http://stackoverflow.com/a/25805759
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25786202
accepted answer: http://stackoverflow.com/a/25786358
type: AnsweredQuestion
tagged with: java
has body: I have some buttons in my application, which open up a dialog when clicked on them. In those dialogs a user can fill in his homework in an edittext. Anyway i would like to save that user input, so that if I close the dialogs or the application I am able to recall that data and because I am new to eclipse and programming i don't know how to do it. This is my MainActivity public class MainActivity extends ActionBarActivity { protected static final String TAG = null; private Button bthomeWork; private Button bthomeWork1; private Button bthomeWork2; private Button bthomeWork3; private Button bthomeWork4; private AlertDialog.Builder dialogbuilder; private String strName=""; private void homeworkdialog(){ dialogbuilder = new AlertDialog.Builder(this); final EditText txtinput = new EditText(this); dialogbuilder.setTitle("Homework"); dialogbuilder.setMessage("Was sind deine Hausaufgaben?"); dialogbuilder.setView(txtinput); dialogbuilder.setPositiveButton("OK", new DialogInterface.OnClickListener() { @SuppressLint("ShowToast") @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub strName+= txtinput; Toast.makeText(getApplicationContext(), "Eingetragen", Toast.LENGTH_SHORT); } }); dialogbuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @SuppressLint("ShowToast") @Override public void onClick(DialogInterface dialog, int which) { // TODO Auto-generated method stub Toast.makeText(getApplicationContext(), "Kein Eintrag", Toast.LENGTH_SHORT); } }); dialogbuilder.show(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_main); bthomeWork = (Button)findViewById(R.id.bthomeWork); bthomeWork1= (Button)findViewById(R.id.bthomeWork1); bthomeWork2= (Button)findViewById(R.id.bthomeWork2); bthomeWork3= (Button)findViewById(R.id.bthomeWork3); bthomeWork4= (Button)findViewById(R.id.bthomeWork4); bthomeWork.setOnClickListener(new View.On…
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/40329493
has answer: http://stackoverflow.com/a/25786358
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40329435
has title: Save Dialog Input
tagged with: android

http://stackoverflow.com/comment/40272173
has text: +1 and credit for the answer. Just out of curiosity, do you know what is causing the resulting error? I posted it as an edit to my original post above.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25754152

http://stackoverflow.com/comment/40330516
comment on: http://stackoverflow.com/q/25786880
type: QuestionComment
has text: The xml layout is there in the link given. Anyways here it is - http://stackoverflow.com/questions/17805040/how-to-create-a-number-picker-dialog/17806895#17806895
score: 0
type: Comment

http://stackoverflow.com/comment/40371510
type: QuestionComment
comment on: http://stackoverflow.com/q/25809076
score: 0
type: Comment
has text: Are u using maven? or adding the jars directly in library

http://stackoverflow.com/comment/40266328
score: 0
has text: What does the constructor for `Supplier` look like? Are you setting an explicit value for `SUPPLIERID`? If so, what does your persistence layer do in this case? I know PostgreSQL would use the value you provided and not generate a new one.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25748817

http://stackoverflow.com/a/33193390
score: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25798250
answers question: http://stackoverflow.com/q/25798250
upvote count: 5
has body: Well I ran into this same problem now almost exactly a year later. Google brought me back to my own question and now I have the solution so I figured I would give an answer. I was using an incorrect URL for the connection. The correct URL is jdbc:mysql://yourURLhere. I had forgotten the 'mysql' and the '//' are needed as well.
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/25778208
upvote count: 1
has body: Unless I'm missing something you want int n = (int) (Math.random() * 101) - 50; System.out.println(n); Explanation Get a random int in the range 0 to 100 and subtract 50, that gives the range -50 to positive 50. Per the Math.random() Javadoc - Returns a double value with a positive sign, greater than or equal to 0.0 and less than 1.0.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25778117
score: 1

http://stackoverflow.com/q/25854691
has title: map a json object of string arrays to a java class
accepted answer: http://stackoverflow.com/a/25855542
has comment: http://stackoverflow.com/comment/40455226
has comment: http://stackoverflow.com/comment/40455337
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40454840
favorite count: 0
has comment: http://stackoverflow.com/comment/40455937
has comment: http://stackoverflow.com/comment/40455461
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25855542
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am trying map a json object of string arrays to a java class. json: { "SKU": ["A", "B", "C"], "Desc": ["Milk", "Bread", "Jam"] } java class to map json to: public class Inventory_Metrics { public String[] SKU; public String[] Desc; } json mapping method: @Path("/post") @POST @Consumes({MediaType.APPLICATION_FORM_URLENCODED, MediaType.APPLICATION_JSON}) @Produces(MediaType.APPLICATION_JSON) public Response addInventory(String json) throws JsonParseException, JsonMappingException, IOException { ObjectMapper mapper = new ObjectMapper(); Inventory_Metrics inv_met = mapper.readValue(json, Inventory_Metrics.class); System.out.print(inv_met.SKU[0]); return Response.ok().build(); } The exception is: SEVERE: Servlet.service() for servlet [Jersey REST Service] in context with path [/api] threw exception [org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of com.mycode.database.mapping.Inventory_Metrics out of START_ARRAY token at [Source: java.io.StringReader@182856b6; line: 1, column: 1]] with root cause org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of com.mycode.database.mapping.Inventory_Metrics out of START_ARRAY token at [Source: java.io.StringReader@182856b6; line: 1, column: 1]
upvote count: 1
type: Question

http://stackoverflow.com/comment/40282218
type: QuestionComment
score: 0
has text: Does Java have default parameters value?
comment on: http://stackoverflow.com/q/25760009
type: Comment

http://stackoverflow.com/a/25739137
has comment: http://stackoverflow.com/comment/40246117
has comment: http://stackoverflow.com/comment/40245051
type: AcceptedAnswer
downvote count: 0
has body: Yes, Java applications can create folders and files into folders which is not the folder of the application. But of course this will only succeed if the OS user that runs the Java application has the permission to create those folders and files. Your code looks fine. One thing to note that File.mkdir() can only be used to create a child folder of an already existing folder. If you want to create a full path (meaning all folders that don't exist in the path), use File.mkdirs() instead. File.mkdirs() is more flexible in the way that it also works if only the last element is to be created, so you should prefer to use that. Edit: Since you mentioned this is an Android project: Yes, this also works on Android, but you'll also have to request permission for this. In the manifest you have to add something like this: &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
type: Answer
has comment: http://stackoverflow.com/comment/40246948
upvote count: 3
has comment: http://stackoverflow.com/comment/40245294
score: 3
accepted answer of: http://stackoverflow.com/q/25739088
has comment: http://stackoverflow.com/comment/40245888
answers question: http://stackoverflow.com/q/25739088

http://stackoverflow.com/comment/40252859
type: Comment
type: QuestionComment
has text: I tried that one too.. but didn't work..
score: 0
comment on: http://stackoverflow.com/q/25744147

http://stackoverflow.com/a/25794557
has comment: http://stackoverflow.com/comment/40346481
has body: Not all collections designed in java framework adhere to there algorithmic counter part. For e.g. Queue is FIFO but it is implemented by LinkedList(because linked list implements Queue interface), so you can do things which you don't expect a queue to do(like removing element from specified position, null insertion etc). If you want to create the API for strictly defining algorithmic operations, then : 1. create you own class and back them by java classes 2. Be conscious when you are coding, and don't call irrelevant methods.
type: Answer
has comment: http://stackoverflow.com/comment/40345353
has comment: http://stackoverflow.com/comment/40345272
has comment: http://stackoverflow.com/comment/40345650
has comment: http://stackoverflow.com/comment/40345681
has comment: http://stackoverflow.com/comment/40345169
has comment: http://stackoverflow.com/comment/40345388
answers question: http://stackoverflow.com/q/25794417
score: 0
has comment: http://stackoverflow.com/comment/40345095
has comment: http://stackoverflow.com/comment/40345039

http://stackoverflow.com/comment/40221047
has text: I'm just learning the Math functions, and the formatting numbers with printf so it was ideally just a learning exercise. I can see definitely see why you would wonder why I would want to do that though.
score: 0
comment on: http://stackoverflow.com/q/25717224
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25727221
has answer: http://stackoverflow.com/a/34425462
has title: Applet on Mac OS X 10.9.4. hangs on CAccessible.selectionChanged()
type: AnsweredQuestion
score: 3
linked to: http://stackoverflow.com/q/20116958
downvote count: 0
tagged with: applet
tagged with: macos
favorite count: 0
accepted answer: http://stackoverflow.com/a/34425462
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/54919031
tagged with: freeze
has body: Our java applet sometimes hangs when working with dialog on Mac OS X 10.9.4. always with same thread dump: "AWT-EventQueue-2" prio=5 tid=0x00007fb599138800 nid=0xbd03 runnable [0x000000010fa75000] java.lang.Thread.State: RUNNABLE at sun.lwawt.macosx.CAccessible.selectionChanged(Native Method) at sun.lwawt.macosx.CAccessible.access$300(CAccessible.java:44) at sun.lwawt.macosx.CAccessible$AXTextChangeNotifier.caretUpdate(CAccessible.java:138) at javax.swing.text.JTextComponent.fireCaretUpdate(JTextComponent.java:407) at javax.swing.text.JTextComponent$MutableCaretEvent.fire(JTextComponent.java:4417) at javax.swing.text.JTextComponent$MutableCaretEvent.mouseReleased(JTextComponent.java:4473) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:289) at java.awt.Component.processMouseEvent(Component.java:6516) at javax.swing.JComponent.processMouseEvent(JComponent.java:3320) at java.awt.Component.processEvent(Component.java:6281) at java.awt.Container.processEvent(Container.java:2229) at java.awt.Component.dispatchEventImpl(Component.java:4872) at java.awt.Container.dispatchEventImpl(Container.java:2287) at java.awt.Component.dispatchEvent(Component.java:4698) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4832) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4492) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4422) at java.awt.Container.dispatchEventImpl(Container.java:2273) at java.awt.Window.dispatchEventImpl(Window.java:2719) at java.awt.Component.dispatchEvent(Component.java:4698) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:735) at java.awt.EventQueue.access$200(EventQueue.java:103) at java.awt.EventQueue$3.run(EventQueue.java:694) at java.awt.EventQueue$3.run(EventQueue.java:692) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Prot…
has comment: http://stackoverflow.com/comment/48638177
upvote count: 3
possible better answer: http://stackoverflow.com/a/26132884
tagged with: java
has answer: http://stackoverflow.com/a/26132884

http://stackoverflow.com/a/25720762
accepted answer of: http://stackoverflow.com/q/25720374
type: Answer
has comment: http://stackoverflow.com/comment/40217756
has comment: http://stackoverflow.com/comment/40280607
has comment: http://stackoverflow.com/comment/40275090
answers question: http://stackoverflow.com/q/25720374
score: 0
has body: in the meantime I found out why these tasks were fired : I missed &lt;&lt; after the task statement, so changing my two taks to task clearVersionProperties() &lt;&lt; { println "Clearing version file" String whatToWrite = "version=@version@" writeVersionFile(whatToWrite) } task writeVersionProperties(dependsOn: [svnRevision]) &lt;&lt; { println "Writing version file" String whatToWrite = "version="+project.ext.revision; writeVersionFile(whatToWrite) } writeVersionProperties.mustRunAfter clearVersionProperties This did the job.... I am not sure, if this is a bug, feature or side effect. But it seems to me the same utterly evil trap like forgetting () after a function.
has comment: http://stackoverflow.com/comment/40256297
type: AcceptedAnswer

kettle
tags question: http://stackoverflow.com/q/25724763
type: Tag
tag name: kettle

http://stackoverflow.com/q/25840940
has comment: http://stackoverflow.com/comment/40434948
has comment: http://stackoverflow.com/comment/40433935
type: Question
tagged with: jakarta-ee
tagged with: glassfish
has body: This EJB module is aimed at moving the database connection from the client to server-side to improve the connection and overall structure. I copied the same persistence.xml file over, and added, from Netbeans, EclipseLink from Glassfish for the JPA connection. Why isn't the EJB module picking up the persistence.xml file? tree of the clean project: LegacyEJB/ ├── build.xml ├── nbproject │ ├── ant-deploy.xml │ ├── build-impl.xml │ ├── genfiles.properties │ ├── private │ │ └── private.properties │ ├── project.properties │ └── project.xml ├── setup │ └── glassfish-resources.xml └── src ├── conf │ ├── MANIFEST.MF │ └── persistence.xml └── java ├── META-INF │ └── persistence.xml └── net └── bounceme └── dur ├── db │ ├── Clients.java │ ├── Criteria.java │ ├── DatabaseConnection.java │ ├── MyProps.java │ ├── User.java │ └── UserRole.java └── legacy └── ejb └── LegacySession.java glassfish stacktrace: INFO: visiting unvisited references INFO: EJB5181:Portable JNDI names for EJB LegacySession: [java:global/LegacyEJB/LegacySession!net.bounceme.dur.legacy.LegacySessionRemote, java:global/LegacyEJB/LegacySession] INFO: EJB5182:Glassfish-specific (Non-portable) JNDI names for EJB LegacySession: [net.bounceme.dur.legacy.LegacySessionRemote#net.bounceme.dur.legacy.LegacySessionRemote, net.bounceme.dur.legacy.LegacySessionRemote] INFO: LegacyEJB was successfully deployed in 1,409 milliseconds. INFO: visiting unvisited references INFO: visiting unvisited references INFO: ACDEPL103: Java Web Start services started for the app client LegacyApplication (contextRoot: /LegacyApplication) INFO: LegacyApplication was successfully deployed in 264 milliseconds. INFO: query db WARNING: EJB5184:A system exception occurred during an invocation on EJB LegacySession, method: public java.util.List net.bounceme.dur.legacy.ejb.LegacySession.getAll() WARNING: javax.ejb.EJBException at com.sun.ejb.containers.EJBContainerTransactionManager.processSystemException(EJBContainerTransactionManager.java:748) …
has title: PersistenceException: No Persistence provider for EntityManager from Glassfish EJB module
score: 0
has comment: http://stackoverflow.com/comment/40433298
tagged with: jpa
has comment: http://stackoverflow.com/comment/40433840
has comment: http://stackoverflow.com/comment/40435993
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40432571

http://stackoverflow.com/comment/73931260
has text: @EralpB I am afraid even in the latest HATEOAS reference documentation these issues have not been addressed
score: 0
comment on: http://stackoverflow.com/a/25874652
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25717010
score: 0
has comment: http://stackoverflow.com/comment/40202540
has comment: http://stackoverflow.com/comment/40202382
has comment: http://stackoverflow.com/comment/40202465
type: Answer
has body: peek() is not the same as peek(E) that you have implemented. You have defined peek within your StduentList as public E peek(E slist) { But are using String si = slist.peek(); To call it... In fact, I'm having a hard time trying to figure out why you need to override any of the methods in the first place...
answers question: http://stackoverflow.com/q/25716974

http://stackoverflow.com/a/25783549
upvote count: 2
answers question: http://stackoverflow.com/q/25783431
has comment: http://stackoverflow.com/comment/40325159
has comment: http://stackoverflow.com/comment/40324932
type: Answer
score: 2
downvote count: 0
has body: The Oracle DBMS_RANDOM package has a function called SEED which resets the seed to a value which you can define.

http://stackoverflow.com/comment/40450296
comment on: http://stackoverflow.com/q/25851934
type: Comment
type: QuestionComment
has text: You are also asking for a single 6 letter word. Then (assuming you use next() which will return the next word ) when you get to the second word which is non existent you're going to get an error message
score: 0

http://stackoverflow.com/q/25754875
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40273325
has comment: http://stackoverflow.com/comment/40273392
has comment: http://stackoverflow.com/comment/40273494
tagged with: java
has comment: http://stackoverflow.com/comment/40273398
type: Question
has comment: http://stackoverflow.com/comment/40273386
has body: I'm writting a Java method that stores words read in from a file in an ArrayList, but only one instance of each should be stored in the ArrayList. So what kind of algorithm is best fitted for this? Also, the ArrayList is already created in a different method.
has comment: http://stackoverflow.com/comment/40273339
has comment: http://stackoverflow.com/comment/40273592
tagged with: arraylist
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25754905
has title: Store only one instance of an element in an ArrayList?

http://stackoverflow.com/a/25810602
has comment: http://stackoverflow.com/comment/40521811
has body: well, I think they've tried to cover the "worst case". For example, if you try to convert 1 day into nanos, the number will be larger than the max integer System.out.println(TimeUnit.DAYS.toNanos(1)); //86400000000000 System.out.println(Integer.MAX_VALUE); //21474836477 But I agree somehow that numbers can get even bigger than the max long integer in extreme situations. At least the javadoc warns the user about that.
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/25810370
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/40518971
has comment: http://stackoverflow.com/comment/40514197

http://stackoverflow.com/q/25730881
answer count: 2
downvote count: 2
has title: Java Test class
has body: I am still pretty new to programming and need a little help with a program I am writing. It consists of two classes, a generic OrderedPair class and an ObjectPairTest class. This so far is my OrderedPair class: I used some of the suggestions from the comments below and have changed my ObjectPair class to as follows: package lab2; public class OrderedPair&lt;F, S&gt;{ public F getFirst; public S getSecond; private F first; private S second; public OrderedPair(F first, S second ){ this.first = first; this.second = second; } public F getFirst() { return first; } public S getSecond() {return second;} public String toString() {return first.toString() + " | "+second.toString();} public static final OrderedPair&lt;String, Integer&gt; c1 = new OrderedPair&lt;String, Integer&gt;("Pi", 3); public static final OrderedPair&lt;String,String&gt; c2 = new OrderedPair&lt;String, String&gt;("Great", "Super"); public static final OrderedPair&lt;Integer, Integer&gt; c3 = new OrderedPair&lt;Integer, Integer&gt;(1, 2); public static final OrderedPair&lt;Float, String&gt; c4 = new OrderedPair&lt;Float, String&gt;( 5f, "Maximum"); public static final OrderedPair&lt;Integer, Float&gt; c5 = new OrderedPair&lt;Integer, Float&gt;(69, 69f); } And my ObjectPairTest class is as follows: package lab2; public class OrderedPairTest{ public static void main(String[] args){ System.out.println(c1.toString()); System.out.println(c2.toString()); System.out.println(c3.toString()); System.out.println(c4.toString()); System.out.println(c5.toString()); }//End class Main }//End class OrderedPairTest However when I try and run, it gives me the error message: Exception in thread "main" java.lang.Error: Unresolved compilation problems: c1 cannot be resolved c2 cannot be resolved c3 cannot be resolved c4 cannot be resolved c5 cannot be resolved at lab2.OrderedPairTest.main(OrderedPairTest.java:6) Thank you all for your help so far.
has comment: http://stackoverflow.com/comment/40228494
upvote count: 2
score: 0
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/25730934
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/328661
has answer: http://stackoverflow.com/a/25730924
has comment: http://stackoverflow.com/comment/40230100
tagged with: java
type: Question

http://stackoverflow.com/q/25783368
score: 1
tagged with: java
tagged with: playframework
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25785887
favorite count: 0
has body: I've a configuration file from which I want to read the name of the view and then render the view. I'm trying to use java reflection for this and code looks something like: Class viewClass = Play.current().classloader().loadClass(viewName); Method render = viewClass.getDeclaredMethod("render"); page = (Html)render.invoke(viewClass.newInstance()); I'm getting Java.lang.ClassNotFoundException. viewName is the name of the view.
type: AnsweredQuestion
tagged with: playframework-2.0
tagged with: scala
has comment: http://stackoverflow.com/comment/40328645
accepted answer: http://stackoverflow.com/a/25785887
upvote count: 1
has title: Load view classes dynamically in Play using reflection in java
type: Question
tagged with: reflection

http://stackoverflow.com/comment/40391807
type: Comment
type: QuestionComment
has text: @Nabin yes, I want to do that.
score: 0
comment on: http://stackoverflow.com/q/25819715

http://stackoverflow.com/a/25797228
answers question: http://stackoverflow.com/q/25797175
accepted answer of: http://stackoverflow.com/q/25797175
score: 7
has body: 0x47 (hexadecimal) is 71 (decimal). If you want your integer to be printed in hexadecimal notation, use Integer.toHexString
upvote count: 7
type: AcceptedAnswer
downvote count: 0
type: Answer

web.xml
tags question: http://stackoverflow.com/q/25789117
tag name: web.xml
tags question: http://stackoverflow.com/q/25738594
type: Tag
tags question: http://stackoverflow.com/q/25839671
tags question: http://stackoverflow.com/q/25808633

http://stackoverflow.com/comment/40474493
comment on: http://stackoverflow.com/a/25864623
has text: There should not be any problem because CircularImageView is subclass of ImageView but I am not sure. You should try this.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40325581
score: 3
type: QuestionComment
has text: Maybe you can deploy your jar in the repository and then include it like any other depedency. [Guide to deploying 3rd party JARs to remote repository](http://maven.apache.org/guides/mini/guide-3rd-party-jars-remote.html) But it will not be updated when you deploy your project. It will be an independent artifact.
type: Comment
comment on: http://stackoverflow.com/q/25783822

http://stackoverflow.com/comment/40332077
has text: You forget to post UsersServiceTest.testTask(). You know, the place where the exception happens. I can already venture a guess that no JPA transaction is actually started anywhere around that code.
score: 1
comment on: http://stackoverflow.com/q/25786815
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40427358
has text: I'm not writing this for chase.com. Can someone just help with the question.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25815318

http://stackoverflow.com/comment/40368833
score: 0
has text: @MarkRotteveel You should add that as an answer. I can reproduce the problem, and changing `UserId` to `int` fixes it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25796392

http://stackoverflow.com/q/25841421
answer count: 1
has body: I have a CompositeConfiguration object which has some property configurations and some XMLConfigurations.For the XMLConfiguration, the DefaultExpressionEngine is set as XPathExpressionEngine One of the .properties file has properties starting with "." eg : .propertyName="name" CompositeConfiguration compositeConfiguration = new CompositeConfiguration(); XMLConfiguration xmlConfig = new XMLConfiguration("xmlFile.xml"); xmlConfig.setDefaultExpressionEngine(new XPathExpressionEngine()); compositeConfiguration.addConfiguration(xmlConfig); compositeConfiguration.addConfiguration(new PropertiesConfiguration(new File("file1.properties"))); compositeConfiguration.addConfiguration(new PropertiesConfiguration(new File("file2.properties"))); compositeConfiguration.addConfiguration(new PropertiesConfiguration(new File("file3.properties"))); compositeConfiguration.getProperty(".propertyName"); I get the following exception: org.apache.commons.jxpath.JXPathInvalidSyntaxException: Invalid XPath: '.propertyName'. Syntax error after "." at org.apache.commons.jxpath.ri.Parser.parseExpression(Parser.java:63) at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.compileExpression(JXPathContextReferenceImpl.java:249) at org.apache.commons.jxpath.ri.JXPathContextReferenceImpl.iteratePointers(JXPathContextReferenceImpl.java:616) at org.apache.commons.jxpath.JXPathContext.selectNodes(JXPathContext.java:686) at org.apache.commons.configuration.tree.xpath.XPathExpressionEngine.query(XPathExpressionEngine.java:183) at org.apache.commons.configuration.HierarchicalConfiguration.fetchNodeList(HierarchicalConfiguration.java:958) at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.fetchNodeList(AbstractHierarchicalFileConfiguration.java:439) at org.apache.commons.configuration.HierarchicalConfiguration.getProperty(HierarchicalConfiguration.java:344) at org.apache.commons.configuration.AbstractHierarchicalFileConfiguration.getProperty(AbstractHierarchicalFileConfiguration…
tagged with: xpath
has title: Apache Commons CompositeConfiguration XPath exception on getProperty(".propertyName")
type: UnansweredQuestion
tagged with: apache-commons-config
tagged with: apache-commons
tagged with: java
tagged with: xml-configuration
type: Question
linked to: http://stackoverflow.com/q/5115324
has answer: http://stackoverflow.com/a/25854121
score: 0

http://stackoverflow.com/q/25763225
tagged with: ffmpeg
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25854284
tagged with: java
has title: Create video from series of images using android
linked to: http://stackoverflow.com/q/11006910
type: Question
tagged with: x264
linked to: http://stackoverflow.com/q/10284708
tagged with: jcodec
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/25854284
linked to: http://stackoverflow.com/q/17695475
has body: I'm trying to write an android application in which we allow user to create video from series of images. I did lot of investigation like C/C++ libraries FFMPEG, X264. These can be used using NDK, but i dont know how to use it via NDK, i also did investigation but did not get about this. I find another library JCodec It is java based. I tried different codes of JCodec but did not get any success. Below are Links related to JCodec: this, this and this. Now can anyone guide me about this question and can i have some suggestion how to implement this feature.

http://stackoverflow.com/comment/40403435
score: 0
type: Comment
has text: Post an [MCVE](http://stackoverflow.com/help/mcve).
type: QuestionComment
comment on: http://stackoverflow.com/q/25825834

http://stackoverflow.com/comment/40384366
comment on: http://stackoverflow.com/a/25815452
score: 0
type: Comment
has text: Do what? i'm pretty new at android developing and i don't know the proper code lines. thanks.
type: AnswerComment

http://stackoverflow.com/comment/40245536
type: QuestionComment
comment on: http://stackoverflow.com/q/25739572
has text: is this better explanation for, better described nad clear - [I want to display only 1 value of the 2 columns. Does anyone know how I can do this?](http://stackoverflow.com/questions/25738472/get-id-and-data-from-database-and-add-to-jcombobox)
score: 0
type: Comment

http://stackoverflow.com/q/25714003
has body: I have been searching google for stuff like "Java Bitmap", "Create Java Bitmap", etc and cannot seem to find much information. From all of the code examples it looks like all of the bitmap libraries are third party or for android. What I want to do is very simple. I want to create a small bitmap maybe 10x80, and be able to color each pixel at (x,y). I want to make a small I guess color bar that will show that position of items in a queue by color. Are there any build in libraries to do this?
favorite count: 0
score: 13
tagged with: bitmap
upvote count: 15
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25714053
linked to: http://stackoverflow.com/q/982713
has answer: http://stackoverflow.com/a/25714053
tagged with: java
duplicate of: http://stackoverflow.com/q/982713
has answer: http://stackoverflow.com/a/25714025
type: Question
accepted answer: http://stackoverflow.com/a/25714025
has title: Does Java have a Bitmap class?
answer count: 2
linked to: http://stackoverflow.com/q/2684123
downvote count: 2

http://stackoverflow.com/comment/41983336
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25766443
score: 0
has text: Remember objects of the same class can be given different constructor arguments.

http://stackoverflow.com/a/78444104
type: Answer
score: 0
has body: In my case the Hibernate persistence unit was incorrectly configured as transaction-type="RESOURCE_LOCAL" instead of JTA.
answers question: http://stackoverflow.com/q/25821579

http://stackoverflow.com/q/25754609
tagged with: opencv
score: 2
type: AnsweredQuestion
has body: i need some help with ideas about how to change a recognized face throug a webcam, but instead of make a rectangle around the face i need to put an image for example a meme, or something else, rigth now i already can recognize a face and the code put a rectangle but i dont want that, i want to change the face for something else. i have this code for (Rect rect : faceDetections.toArray()) { Core.rectangle(imagen, new Point(rect.x, rect.y), new Point(rect.x + rect.width, rect.y + rect.height), new Scalar(0, 255, 0)); } and i have the image loaded like this: Mat image2 = Highgui.imread("/índice.jpg"); i've found examples in C# but i need java so please if you can help me. =)
tagged with: java
tagged with: face-recognition
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25776209
has title: Image recognition on OpenCV java
has comment: http://stackoverflow.com/comment/40278588
has answer: http://stackoverflow.com/a/25758290
accepted answer: http://stackoverflow.com/a/25758290
downvote count: 0
favorite count: 0
upvote count: 2
possible better answer: http://stackoverflow.com/a/25776209

http://stackoverflow.com/q/25720989
has answer: http://stackoverflow.com/a/25721195
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/25721091
type: UnansweredQuestion
has body: I have deployed storm server, but I am receiving the following error every time I start supervisor. 2014-09-08 09:04:40 o.a.z.ClientCnxn [INFO] Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) 2014-09-08 09:04:40 o.a.z.ClientCnxn [WARN] Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection refused at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.7.0_65] at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:739) ~[na:1.7.0_65] at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350) ~[zookeeper-3.4.5.jar:3.4.5-1392090] at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068) ~[zookeeper-3.4.5.jar:3.4.5-1392090] can anyone please help me with the error. Thanks in advance
has answer: http://stackoverflow.com/a/33848594
score: 2
has answer: http://stackoverflow.com/a/33968963
tagged with: java
tagged with: apache-storm
type: Question
upvote count: 2
tagged with: apache-zookeeper
downvote count: 0
has title: Storm - java.net.ConnectException: Connection refused

http://stackoverflow.com/comment/40320115
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25780270
has text: @JBNizet : I want the correct time and date in yyyy-MM-dd hh:MM:ss a Z format . If i get the correct answer then i can format using SimpleDateFormat . But I am unable to get correct answer in the first place !

http://stackoverflow.com/a/25806988
has comment: http://stackoverflow.com/comment/40385656
has body: With getExternalStoragePublicDirectory(DIRECTORY_DCIM) you would probably get /storage/emulated/0/DCIM. But it is never a guarantee that the pictures will be there. They could as well be in /storage/emulated/1/DCIM. So better let the user indicate the right directory.
has comment: http://stackoverflow.com/comment/40396814
score: 1
has comment: http://stackoverflow.com/comment/40413447
has comment: http://stackoverflow.com/comment/40410866
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25806885
has comment: http://stackoverflow.com/comment/40385785
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25806885
has comment: http://stackoverflow.com/comment/40385898
has comment: http://stackoverflow.com/comment/40385711
has comment: http://stackoverflow.com/comment/40385858
has comment: http://stackoverflow.com/comment/40413299
has comment: http://stackoverflow.com/comment/40398039
type: Answer
has comment: http://stackoverflow.com/comment/40403563
has comment: http://stackoverflow.com/comment/40397784
has comment: http://stackoverflow.com/comment/40385941
has comment: http://stackoverflow.com/comment/40411319
downvote count: 0
has comment: http://stackoverflow.com/comment/40398903
has comment: http://stackoverflow.com/comment/40385866
has comment: http://stackoverflow.com/comment/40387124
has comment: http://stackoverflow.com/comment/40385088

http://stackoverflow.com/comment/40466007
score: 0
type: Comment
type: QuestionComment
has text: You're missing a closing `}` after the first `else if` and before the second `else if`...
comment on: http://stackoverflow.com/q/25860637

http://stackoverflow.com/comment/40396755
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25822665
has text: I place a log4j.xml file in my test/resources folder.
score: 0

http://stackoverflow.com/comment/40465340
type: Comment
comment on: http://stackoverflow.com/a/25845379
score: 0
type: AnswerComment
has text: hey apangin, thank you for the article and the explanation! I had to dig way back into my computer architecture knowledge to connect all the dots here, but your explanation and Martin Thompson's article was great. hope you have a good week ahead!

http://stackoverflow.com/comment/40250834
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25742984
has text: try {// super.getHibernateTemplate().save(user); //super.getHibernateTemplate().saveOrUpdate(user); //super.getHibernateTemplate().update(user); //this.userDao.updateUser(dbUser); } catch(DataAccessException accessException){ throw new DaoException("Internal DB error occured."); }
type: QuestionComment

http://stackoverflow.com/q/25873358
downvote count: 0
has title: ApacheCXF Example Error
has comment: http://stackoverflow.com/comment/40491713
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40492468
has comment: http://stackoverflow.com/comment/40488994
type: Question
tagged with: apache
has body: I'm trying to run through this ApacheCXF Tutorial that I found at http://kevinboone.net/cxftest.html using Intellij. When compiling the code I keep getting. Error: (17, 34) java: cannot find symbol symbol: class TestMeSoapPortImpl location: class com.cxftest.server.TestmePort_TestMeSoapPort_Server I have no idea why. public class TestmePort_TestMeSoapPort_Server{ protected TestmePort_TestMeSoapPort_Server() throws java.lang.Exception { System.out.println("Starting Server"); Object implementor = new TestMeSoapPortImpl(); String address = "http://127.0.0.1:9000/cxftest/testme"; Endpoint.publish(address, implementor); } public static void main(String args[]) throws java.lang.Exception { new TestmePort_TestMeSoapPort_Server(); System.out.println("Server ready..."); Thread.sleep(5 * 60 * 1000); System.out.println("Server exiting"); System.exit(0); } } ---------- Structure A. com.cxftext.server cxftest.wsdl CXFTestImpl (Class) CXFTestService (Class) ObjectFactory (Class) package-info.java Server (Class) TestMe (Class) TestmePort (Interface) TestmePort_TestMeSoapPort_Server (Class) TestMeResponse (Class) { Starting Server Sep 16, 2014 12:42:41 PM org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromWSDL INFO: Creating Service {http://kevinboone.net/cxftest}CXFTestService from WSDL: file: com/cxftest/server/cxftest.wsdl Exception in thread "main" javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service. at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:371) at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251) at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:152) at javax.xml.ws.Endpoint.publish(Endpoint.java:240) at com.cxftest.server.Server.(Server.java:15) at com.cxftest.server.Server.main(Server.java:20) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Nativ…

http://stackoverflow.com/comment/40659203
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25863888
score: 0
has text: why don't you compare generated bytecode? It should be the same.

http://stackoverflow.com/comment/40409573
comment on: http://stackoverflow.com/a/25829770
has text: Okay, but what about the rest? why is it not inserting at rest of the appropriate positions?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40354940
score: 0
has text: I used the quotes because I wanted to group John, Bob together with Rudy, Judy. Because they're in the same column in the csv, they'll be placed into the same array. The problem is the double quotes that were used to group those two names together remain in the array
type: Comment
comment on: http://stackoverflow.com/q/25799196
type: QuestionComment

http://stackoverflow.com/q/25769740
tagged with: java
tagged with: loops
downvote count: 1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40300477
upvote count: 0
has answer: http://stackoverflow.com/a/25769988
score: -1
has body: In my code i want to check longitude and latitude value. If values are empty, code will check for 15 seconds. If values are received , while loop will break and will show "You win". If they are still empty, it should show "error in gps" after 15 seconds. The problem is that code is waiting perfectly but Progress Bar is not showing in the screen because screen got stuck during wait time. After 15 seconds screen is free. Please tell me how to resolve this issue. Thanks @Override public void onClick(View arg0) { // TODO Auto-generated method stub Toast.makeText(getBaseContext(), longitude.getText(), Toast.LENGTH_LONG).show(); Toast.makeText(getBaseContext(), latitude.getText(), Toast.LENGTH_LONG).show(); pBar = new ProgressDialog(oproprietor.this); pBar.setCanceledOnTouchOutside(false); pBar.setProgressStyle(ProgressDialog.STYLE_SPINNER); pBar.setMessage("Waiting 15 seconds"); pBar.show(); long t= System.currentTimeMillis(); long end = t+15000; while(System.currentTimeMillis() &lt; end) { if(!longitude.getText().equals("") || !latitude.getText().equals("") ){ pBar.dismiss(); break; } else continue; } if(longitude.getText().equals("") || latitude.getText().equals("")){ pBar.dismiss(); Toast.makeText(oproprietor.this, "Error in gps", Toast.LENGTH_LONG).show(); } else if(!longitude.getText().equals("") || !latitude.getText().equals("") ){ pBar.dismiss(); Toast.makeText(oproprietor.this, "You win", Toast.LENGTH_LONG).show(); } } });
has comment: http://stackoverflow.com/comment/40300550
tagged with: thread-sleep
has title: Waiting for X time in loop using JAVA/Android
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/25769850
tagged with: android
linked to: http://stackoverflow.com/q/4591878

http://stackoverflow.com/comment/40376301
score: 0
type: QuestionComment
type: Comment
has text: Have you tried wrapping your content of element in `CDATA`?
comment on: http://stackoverflow.com/q/25811351

http://stackoverflow.com/a/25778429
type: Answer
has body: Seems like the Documentation is refering User and UserDAO as your own User Model Entity (Table) and User Data Access Layer Entity (Class to Save, Update, Delete and Retrieve). These necessarily not required to be a part of Apache Shiro (Reason some Data Access Layer may be in RDBMS, Some in In-memory dbs, some could even be in properties file, why not?) You must implement User and UserDAO to save to your own persistence store. UserAccount also is the Model object you use when you want to register user accounts. Like the Gmail signup. You must know that Apache Shiro is just a layer for Security (Authentication, Authorization, etc). Persistence must be implemented by you. Strongly advice you to check out Spring Data JPA and Spring Security.
has comment: http://stackoverflow.com/comment/40318128
upvote count: 1
answers question: http://stackoverflow.com/q/25777994
downvote count: 0
has comment: http://stackoverflow.com/comment/40325590
has comment: http://stackoverflow.com/comment/40318019
accepted answer of: http://stackoverflow.com/q/25777994
type: AcceptedAnswer
score: 1

http://stackoverflow.com/q/25736249
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40239101
has comment: http://stackoverflow.com/comment/40238936
has comment: http://stackoverflow.com/comment/40239120
has comment: http://stackoverflow.com/comment/40274259
tagged with: java
has comment: http://stackoverflow.com/comment/40245533
upvote count: 1
has title: How to call an applet in another class's main method
type: UnansweredQuestion
answer count: 0
downvote count: 0
tagged with: applet
score: 1
has body: We are required to make an Applet (not JApplet) in class. I want to call my applet in another class's main method. How do I do this? I tried the following: public static void main(String[] args) { GUI myGui = new GUI(); //GUI is my applet class myGui.init(); myGui.start(); } This returns a null pointer exception, however. Can anyone help?

http://stackoverflow.com/q/25789392
score: 0
tagged with: java
answer count: 1
tagged with: configuration
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40360069
tagged with: sts-springsourcetoolsuite
has answer: http://stackoverflow.com/a/25810349
has body: STS Version: 3.4.0.RELEASE Build Id: 201310051614 java version "1.7.0_65" Java(TM) SE Runtime Environment (build 1.7.0_65-b20) Java HotSpot(TM) Client VM (build 24.65-b04, mixed mode, sharing) Runing on OS Name Microsoft Windows 7 Enterprise Version 6.1.7601 Service Pack 1 Build 7601 System Type x64-based PC Having wrongly pasted a large clipboard text item into the Run Configuration/Arguments/Program Arguments I am unable to remove. The UI locks up. I've tried exiting STS then clicking on the Java Application run configuration in order to delete it but again the UI locks up as soon as the application run configuration is clicked in the list. Presumably STS is having difficulty with the size. of the arguments. Is there a way to delete the cached Java Application Run Configuration externally from the STS UI?
has title: sts run configuration program arguments too large
type: Question
has comment: http://stackoverflow.com/comment/40335004

http://stackoverflow.com/a/25813244
has body: No, it should not behave in the same way as a multidimensional array. This is because json_array is not an array, it is a different Java object. Only arrays can be accessed with this specific syntax you've shown above. You will need to look into the documentation for this class to see how to access the information you want. It should provide clear and well-documented methods for getting what you need. You wouldn't want this syntax to allow you to access the array which backs your class anyways. This would be a breach of encapsulation and be poor design in general. A good starting point is here http://www.json.org/javadoc/org/json/JSONArray.html
answers question: http://stackoverflow.com/q/25813164
score: 0
type: Answer

http://stackoverflow.com/comment/40456086
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25855132
score: 0
has text: Does anything show up in your logs? Also, I think I understand your motivation, but catching Throwable is a bad practice.

http://stackoverflow.com/comment/40432220
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25842033
has text: code in github: https://github.com/gephi/gephi/blob/master/modules/ProjectAPI/src/main/java/org/gephi/project/impl/ProjectControllerImpl.java

http://stackoverflow.com/comment/40376734
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25811717
type: Comment
has text: AlarmReceiver.java is my broadcast but problem is this even it doesn't launch avtivity in onCreate() function let me try... maybe problem is this...

http://stackoverflow.com/q/25797866
favorite count: 0
score: 8
has title: Hibernate makes Weld not initializing in Java SE
upvote count: 8
tagged with: maven
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25808029
possible better answer: http://stackoverflow.com/a/74446191
type: Question
has answer: http://stackoverflow.com/a/74446191
answer count: 2
downvote count: 0
has body: So, I have a basic Java SE program with dependency injection using Weld 1.2. Everything is working fine, until I throw Hibernate into the mix, with the following pom.xml dependency entries: javax javaee-api 7.0 org.jboss.weld.se weld-se 2.2.4.Final org.hibernate hibernate-core 4.3.6.Final Hibernate being the added dependency, making it break. This is my entry class: public class EntryPoint { public static void main( String[] ARGV ) { Weld weld = new Weld(); WeldContainer container = weld.initialize(); Application application = container.instance().select(Application.class).get(); application.testFetch(); weld.shutdown(); } } When I try to run it after including Hibernate dependency, this is my output: Sep 11, 2014 11:13:44 PM org.jboss.weld.bootstrap.WeldStartup <clinit> INFO: WELD-000900: 2.2.4 (Final) Sep 11, 2014 11:13:44 PM org.jboss.weld.bootstrap.WeldStartup startContainer INFO: WELD-000101: Transactional services not available. Injection of @Inject UserTransaction not available. Transactional observers will be invoked synchronously. Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: org.jboss.jandex.ClassInfo.hasNoArgsConstructor()Z at org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:66) at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:43) at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:51) at org.jboss.weld.bootstrap.ConcurrentBeanDeployer.addClasses(ConcurrentBeanDeployer.java:62) at org.jboss.weld.bootstrap.BeanDeployment.createClasses(BeanDeployment.java:209) at org.jboss.weld.bootstrap.WeldStartup.startInitialization(WeldStartup.java:351) at org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(WeldBootstrap.java:76) at org.jboss.weld.environment.se.Weld.initialize(Weld.java:157) at com.mybeautycompare.integration.EntryPoint.main(EntryPoint.java:24) at…
tagged with: cdi
linked to: http://stackoverflow.com/q/15168365
accepted answer: http://stackoverflow.com/a/25808029
tagged with: weld

http://stackoverflow.com/comment/40451893
type: Comment
has text: `"\("` will cause a compilation error as it is not a valid escape character. `"\\("` is what is needed
score: 1
comment on: http://stackoverflow.com/a/25852983
type: AnswerComment

http://stackoverflow.com/comment/40350116
score: 0
has text: I'm thinking what @prabugp is thinking...
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25796945

http://stackoverflow.com/comment/40442358
comment on: http://stackoverflow.com/q/25847798
type: Comment
type: QuestionComment
has text: For DateComparisons, have a look into JodaTime. It makes data/time calculations really easy...
score: 0

http://stackoverflow.com/q/25817293
tagged with: jogl
type: UnansweredQuestion
upvote count: 1
type: Question
tagged with: opengl
score: 1
tagged with: java
has title: Preserving a JOGL Context
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25818402
has body: I want to be able to preserve an OpenGL context through the process of changing a window's fullscreen and decoration. Since I have to dispose of the window when I want to change the decoration (which must also be done when changing to full screen to have no pseudo decorated fullscreen), the context seems to be destroyed. Is there a way to preserve a context in such a way that I never need to have some init code run twice?
favorite count: 0

http://stackoverflow.com/comment/40229191
has text: i dont want to suppress warnings, i want to suppress my mistakes, lack of knowledge and improve my understanding.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25731252
type: Comment

http://stackoverflow.com/a/25774107
answers question: http://stackoverflow.com/q/25773886
has body: I think it may be better to separate the monomial into 2 parts: the coefficient and the variable. That way you can use the variable part in your map as the key and the coefficient as the value (which can then up updated). All this code should be implementation details inside a Polynomial object I'm not sure why you think a coefficient-free monomial does not look right. You don't have to expose the object to the outside if you don't want. But it might be a nice way to have getters on your Polynomial to get the coefficients for each monomial.
score: 1
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40382701
upvote count: 1

http://stackoverflow.com/comment/40394231
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25807872
has text: @karthik i was going to suggest this only..well you have already done this..cheers
type: Comment

http://stackoverflow.com/comment/40200554
score: 0
type: AnswerComment
has text: I call the RecipesAdapter constructor in my MainActivity.java class so I don't think I can remove it replace it with Context context
type: Comment
comment on: http://stackoverflow.com/a/25715808

http://stackoverflow.com/a/25768733
answers question: http://stackoverflow.com/q/25768435
type: Answer
upvote count: 4
downvote count: 0
score: 4
has body: Try this: package studing; public class Array { public static void main(String[] args) { Random r = new Random(); int[] ar1 = new int[100]; for(int i = 0; i &lt; ar1.length; i++) { ar1[i] = r.nextInt(100); System.out.print(ar1[i] + " "); } } } Why? Using Math.random() can return 1, this means Math.random()*100 can return 100, but OP asked for maximum 99! Using nextInt(100) is exclusive 100, it can only return values from 0 to 99. Math.random() can not return -0.000001 that would be round to 0 and 1.0000001 can not be returned that should round to 1. So you have less chance to get 0 or 99 than all the numbers between. This way it is not realy random, to guess "its not 0 or 99" is more true than "its not 1 or 98". Also it do not make a detour via casting and mathematic operations you don't realy need, hey you dont need to strictfp on amd-cpus or old intel-cpus.

http://stackoverflow.com/q/25800659
tagged with: cxf
tagged with: java
tagged with: jax-ws
has body: I'm building an embedded JAX-WS SOAP service using Java. I'm defining my data types using javax.xml.bind. I have a field in one of the data types that I'd like to be hidden, so that it will be supported but not be visible when a WSDL is published. My motivation is that we are deprecating an attribute however I would to still support it (the contents will be ignored and unused). In the below example, if the user visits the WSDL at http://myservice?wsdl they will not see the attribute email as a part of user Is there any annotation I can use that will provide this functionality? Alternatively @XmlType public class User { @XmlElement public String name; @XmlElement @Hidden (?) public String email; }
has comment: http://stackoverflow.com/comment/40369778
type: Question
has title: Invisible or hidden XML element in SOAP service
has comment: http://stackoverflow.com/comment/40357822
has comment: http://stackoverflow.com/comment/40362319
has comment: http://stackoverflow.com/comment/40370397
has comment: http://stackoverflow.com/comment/40357316
accepted answer: http://stackoverflow.com/a/25810373
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40372624
has comment: http://stackoverflow.com/comment/40357804
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25810373

http://stackoverflow.com/q/25831964
has comment: http://stackoverflow.com/comment/40413474
tagged with: synchronization
tagged with: deadlock
score: 0
type: AnsweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/25832008
type: Question
has comment: http://stackoverflow.com/comment/40413584
tagged with: java
has body: I want to do the following idea in java if that is possible: I have a synchronized method that has over 1000 line of code, and it takes a long time to finish. Many users request the same method at the same time so the performance is awfully bad. What I am thinking is that I want to open this method for a certain number of user concurrently (lets say 5) rather than 1 user at a time in the synchronized. Is this doable in java? And what technology I have to know in order to do it?
has title: Allow specific number of users to access a method in java
linked to: http://stackoverflow.com/q/19386544
answer count: 1
accepted answer: http://stackoverflow.com/a/25832008

http://stackoverflow.com/comment/40409671
comment on: http://stackoverflow.com/a/25829810
type: Comment
type: AnswerComment
has text: @GurupratapSaini "Let's say, 1 off error is fixed, but that still does not answer why does the newlink is not in its sorted pposition at all" Yes it does. The off-by-one error is **exactly** why the newLink is not inserted into its sorted position.
score: 0

http://stackoverflow.com/q/25760156
score: 2
has answer: http://stackoverflow.com/a/30485854
has body: We have a domain class @Entity public class Gallery implements Serializable { @Id @GeneratedValue private Long id; @Enumerated(EnumType.ORDINAL) private Status status; // more attributes and getters/setters } The status is an enum: public enum Status { OPEN (0, "offen"), ACTIVE (1, "aktiv"), INACTIVE (2, "inaktiv"); // attributes, constructor... } Then we have a Spring Data repository with a query: public interface GalleryRepository extends PagingAndSortingRepository&lt;Gallery, Long&gt; { @Query("SELECT g FROM Gallery g WHERE (:status IS NULL or g.status = :status)") public List&lt;Gallery&gt; findBySearchCriteria(@Param("status") Status status); } The purpose of the (:status IS NULL or g.status = :status) is that we want all data, when no status is given and get only the appropriate data when status is given. We get results from this query when status is null, but we don't get any result if status is e.g. ACTIVE, althought there is data in the database with status=ACTIVE. Wenn we remove the :status IS NULL or from the query, we get results when status is ACTIVE. The query looks like public interface GalleryRepository extends PagingAndSortingRepository&lt;Gallery, Long&gt; { @Query("SELECT g FROM Gallery g WHERE (g.status = :status)") public List&lt;Gallery&gt; findBySearchCriteria(@Param("status") Status status); } I let log the SQL and parameters and when I run the SQL (with the :status IS NULL or) manually I get the expected results: Hibernate: select gallery0_.id as id1_13_, gallery0_.institution_id as institut5_13_, gallery0_.internName as internNa2_13_, gallery0_.name as name3_13_, gallery0_.selectedShortId_id as selected6_13_, gallery0_.status as status4_13_ from Gallery gallery0_ where ? is null or gallery0_.status=? 2014-09-10 09:54:49,531 TRACE type.descriptor.sql.BasicBinder: binding parameter [1] as [VARBINARY] - ACTIVE 2014-09-10 09:54:49,531 TRACE type.descriptor.sql.BasicBinder: binding parameter [1] as [VARBINARY] - ACTIVE 2014-09-10 09:54:49,535 TR…
tagged with: java
tagged with: hibernate
tagged with: spring-data
type: Question
has answer: http://stackoverflow.com/a/25760636
upvote count: 2
has title: Spring Data query with nullable Enum
answer count: 3
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/59174771
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25763882
has title: Why does this happens in passing an array?
has body: I'm trying to pass the array of values from a function in .js file to .jsp file using document.formname.action but its creating the array index out of bound. My .js file (note this line: document.detailsview.action=" "): function savetheChanges(count) { var kkot1=new Array(); var iitemcode1=new Array(); var dropdown11=new Array(); var billno=document.getElementById("billno").value; for(var i=0;i&lt;count;i++) { var selec = document.getElementById("sel"+i); dropdown11[i] = selec.options[selec.selectedIndex].value; kkot1[i]=document.getElementById("kot"+i).value; iitemcode1[i]=document.getElementById("itemcode"+i).value; //var dummydrop=dropdown1[i]; alert(i+" "+dropdown11[i]); //var mydropp=dropdown11[i]; } document.detailsview.action="BillCB.jsp?method=" + "11" + "&amp;billno="+billno+"&amp;itemStatus1="+dropdown11+ "&amp;kot="+kkot1+ "&amp;itemcode="+iitemcode1; } BillCB.jsp (method11): case 11: gotMethod = true; billdetails_be.billno = Integer.valueOf(request.getParameter("billno")); String[] kotCbb=request.getParameterValues("kot"); String[] itemCbb=request.getParameterValues("itemcode"); String[] statCbb=request.getParameterValues("itemStatus1"); System.out.println("IN AVAILABLE:Size of KOT array is :" +kotCbb.length); System.out.println("IN AVAILABLE:Size of ITEM array is:"+itemCbb.length); System.out.println("IN AVAILABLE:size of STATUS array is:"+statCbb.length); Output in console is: IN AVAILABLE:Size of KOT array is :19 IN AVAILABLE:Size of ITEM array is:19 IN AVAILABLE:size of STATUS array is:1
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40290206
tagged with: java
type: Question
score: 0
tagged with: arrays
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/40290282
has comment: http://stackoverflow.com/comment/40289265
has comment: http://stackoverflow.com/comment/40288822

http://stackoverflow.com/comment/40314814
comment on: http://stackoverflow.com/q/25777561
has text: See if this answer helps: http://stackoverflow.com/a/19044753/1144203
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40399433
type: Comment
type: QuestionComment
has text: why not use jsonarray? and you can use EntityUtils to get the string-json directlty
comment on: http://stackoverflow.com/q/25824253
score: 0

http://stackoverflow.com/comment/90023061
comment on: http://stackoverflow.com/a/25856361
type: Comment
score: 0
type: AnswerComment
has text: @FranklinYu Our bet has been on web development (html, css, bootstrap and angular).

http://stackoverflow.com/comment/40356951
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25800465
has text: i have experienced similar crash for my apk, though not on google play. Reason was Java 8 compatibility issue with maven android release plugin,After moving back to java 6 issue got resolved..
score: 0

http://stackoverflow.com/q/25860585
has answer: http://stackoverflow.com/a/25988483
upvote count: 6
has comment: http://stackoverflow.com/comment/40556975
score: 4
has comment: http://stackoverflow.com/comment/40605829
has comment: http://stackoverflow.com/comment/40468425
downvote count: 2
has answer: http://stackoverflow.com/a/26013187
has comment: http://stackoverflow.com/comment/40556742
has answer: http://stackoverflow.com/a/26011091
favorite count: 0
linked to: http://stackoverflow.com/q/27581
has comment: http://stackoverflow.com/comment/40556960
has comment: http://stackoverflow.com/comment/40472080
has body: I need clarification whether my approach is right or wrong any modifications required. Let me explain clearly. I will have a excel file in which there will be country code country name years(mm/yyyy) as extra 10 columns countrycode country Name 12/2000 11/2000 10/2000 09/2000 08/2000 07/2000 06/2000 05/2000 04/2000 03/2000 02/2000 01/2000 IND India 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.1 11.2 11.3 USA Uinted States 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.1 9.2 9.3 In a row if anyof the price is repeated for that particular year and country , i need to show message as Duplicate present in Excel file. For the above , i implemented by this way. For a VO i override the hashCode() with the hashcode of (coutrycode + year + price) and equals method too and while inserting in database i pass this VO to HashSet and I eliminate duplicate and compare the size of original list size with HashSet size. But sometime if there is unique price also I am getting message as duplicate. Please suggest me my approach is right or wrong or another way I can implement.
has comment: http://stackoverflow.com/comment/40695916
has comment: http://stackoverflow.com/comment/40695810
has comment: http://stackoverflow.com/comment/40696677
linked to: http://stackoverflow.com/q/4360035
answer count: 4
has answer: http://stackoverflow.com/a/25988299
accepted answer: http://stackoverflow.com/a/25988299
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40467980
tagged with: collections
possible better answer: http://stackoverflow.com/a/25988483
type: Question
has title: Hashcode deceives me sometimes

http://stackoverflow.com/q/25847300
score: 9
has comment: http://stackoverflow.com/comment/40441523
answer count: 3
downvote count: 0
accepted answer: http://stackoverflow.com/a/25847392
tagged with: inheritance
favorite count: 0
linked to: http://stackoverflow.com/q/17201227
type: AnsweredQuestion
has title: Java method overriding and variable shadowing
has comment: http://stackoverflow.com/comment/40441374
has answer: http://stackoverflow.com/a/25847531
has answer: http://stackoverflow.com/a/25847392
linked to: http://stackoverflow.com/q/1568091
type: Question
has body: public class Circle { public float r = 100; public float getR() { return r; } } public class GraphicCircle extends Circle { public float r = 10; public float getR() { return r; } // Main method public static void main(String[] args) { GraphicCircle gc = new GraphicCircle(); Circle c = gc; System.out.println("Radius = " + gc.r); System.out.println("Radius = " + gc.getR()); System.out.println("Radius = " + c.r); System.out.println("Radius = " + c.getR()); } } Hi, I am having trouble understanding the output of the code above. The output is: Radius = 10.0 Radius = 10.0 Radius = 100.0 Radius = 10.0 I understand why gc.r is 10. I also understand why gc.getR() is 10 (because the getR() method in the GraphicCircle overrides the getR() method of Circle). But I don't understand why c.r is 100, and c.getR() is 10 (I am having trouble understanding what happens in inheritance when you typecast to an ancestor class as the code has done above).
linked to: http://stackoverflow.com/q/9453701
possible better answer: http://stackoverflow.com/a/25847393
upvote count: 9
has answer: http://stackoverflow.com/a/25847393
tagged with: java

http://stackoverflow.com/comment/40316643
type: AnswerComment
comment on: http://stackoverflow.com/a/25777559
type: Comment
has text: JodaTime works great, gave me everything I needed, and I didn't even have to scratch my head
score: 0

http://stackoverflow.com/q/25839293
has answer: http://stackoverflow.com/a/25840407
tagged with: android
has answer: http://stackoverflow.com/a/25839486
has body: Hi I am making a application for a homework assignment and at a wall right now. I want to take two inputs such as someones name and then email then display a thank you message with their name and email. I have this for my thank you page which I am having trouble making my button do anything when I click it. I have this for code and I have no errors showing up. import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; public class SignupActivity extends ActionBarActivity { TextView greetMessage; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_signup); Bundle bundle = this.getIntent().getExtras(); if(null != bundle){ String name = bundle.getString("name"); String email = bundle.getString("email"); if(null != name &amp;&amp; name != "" &amp;&amp; email != "") { greetMessage = (TextView)findViewById(R.id.textView1); greetMessage.setText("Thank you " + name + "you can expect and email from us soon to your email address at " + email); } } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.signup, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } } and my other code for the other activity import android.support.v7.app.ActionBarActivity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; im…
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has title: Beginner with Android Development having trouble
tagged with: eclipse
tagged with: import
type: Question
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40243412
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25738743
has text: The credentials are correct. I've double checked in my Parse userbase.
type: AnswerComment

http://stackoverflow.com/q/25856425
downvote count: 0
has comment: http://stackoverflow.com/comment/40458295
has title: How to force un-signed java applications to run
favorite count: 0
tagged with: security
has body: I am trying to access a java-operated ssh/shell terminal on my cPanel, but i keep getting a Application Blocked by Security Settings Your security settings have blocked a self-signing application from running. I have lowered java's security level to medium in the java control panel, and also added the cPanel's ssh link to the java exception site list, but it still gives me the same blocked message saying that the java applet is requesting a package found on another domain address not specified in the exemption site list. A really stupid error all I'm trying to do is access my domains shell client. Google Chrome 37.0.2062.120 (Official Build 281580) m OS Windows 8.1 Blink 537.36 (@181352) JavaScript V8 3.27.34.17 Java Version 7 update 67 Flash 15.0.0.152 Please help?
tagged with: permissions
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40458216
type: Question
has answer: http://stackoverflow.com/a/25856549
answer count: 1

http://stackoverflow.com/comment/40368826
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/25807422
has text: Good luck! That's not a standard format, close as I can tell, but simply a toString dump or some such. You're gonna have to write ad-hoc code to parse it. (It might help to say a Gregorian chant while you work.)

http://stackoverflow.com/comment/40305585
comment on: http://stackoverflow.com/a/25772717
has text: @Farhanpatel Also, to answer the time complexity question, `String.equals()` is `O(n)` in the average/worst case, `O(1)` in the best case, see http://hg.openjdk.java.net/jdk7u/jdk7u6/jdk/file/8c2c5d63a17e/src/share/classes/java/lang/String.java line 974
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25824487
tagged with: collections
linked to: http://stackoverflow.com/q/1206073
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40399822
has answer: http://stackoverflow.com/a/25824548
tagged with: sorting
has comment: http://stackoverflow.com/comment/40399857
tagged with: arraylist
has body: I have the following collection in my driver class: ArrayList&lt;SoftDrink&gt; drinks = new ArrayList&lt;&gt;(); where SoftDrink has three private instance variable (there are accessor methods in the class): String name; String colour; int volume; Users are asked to input information about a drink and SoftDrink objects are added to the ArrayList like this: drinks.add(new SoftDrink(drinkName, colour, volume)); When the user is done adding drinks I want the program to print out a list of the soft drinks that the user has entered, sorted first by alphabetical order of name, then by alphabetical order of colour, then by volume (in ascending order). Example: Coke Red 500 Coke Silver 500 Fanta Orange 300 Fanta Orange 500 What is the most Javaish way I could go about comparing these objects in the ArrayList and then sorting them approriately according to these various parameters?
score: 0
accepted answer: http://stackoverflow.com/a/25824548
answer count: 1
has title: How to sort this ArrayList by various parameters in Java?
duplicate of: http://stackoverflow.com/q/708698

http://stackoverflow.com/q/25718599
accepted answer: http://stackoverflow.com/a/25719320
score: 0
answer count: 1
tagged with: jface
has title: Create ComboBox within a TitleAreaDialog (JFace dialog)
tagged with: combobox
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25719320
tagged with: java
tagged with: swt
type: Question
has body: I am trying to create a combo box within a TitleAreaDialog of a JFace Dialog. In the following code am I asking the user for the values for height and width and also the user has to choose the line strength out of the combo box (uneditable). This will be 1, 2, 3 or 4. This is what I have so far: import org.eclipse.jface.dialogs.TitleAreaDialog; import org.eclipse.swt.SWT; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; public class RectDialog extends TitleAreaDialog { private Text txtWidth; private Text txtHeight; private Text txtLineStrength; private String width; private String height; private String lineStrength; public RectDialog(Shell parentShell) { super(parentShell); } @Override public void create() { super.create(); setTitle("New Rectangle"); // setMessage("", IMessageProvider.INFORMATION); } @Override protected Control createDialogArea(Composite parent) { Composite area = (Composite) super.createDialogArea(parent); Composite container = new Composite(area, SWT.NONE); container.setLayoutData(new GridData(GridData.FILL_BOTH)); GridLayout layout = new GridLayout(2, false); container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); container.setLayout(layout); createWidth(container); createHeight(container); createLineStrength(container); return area; } private void createLineStrength(Composite container) { // TODO: Create line strength } private void createHeight(Composite container) { Label lbtHeight = new Label(container, SWT.NONE); lbtHeight.setText("Height"); GridData dataHeight = new GridData(); dataHeight.grabExcessHorizontalSpace = true; dataHeight.horizontalAlignment = GridData.FILL; txtHeight = new Text(container, SWT.BORDER); txtHeight.setLayoutData(dataHeight); } private void createWidth(Composite container) { La…

http://stackoverflow.com/a/25838580
score: 6
type: AcceptedAnswer
downvote count: 0
has body: Using ANTLR for CSV parsing is a nuclear option IMHO, but since you're at it... Implement the interface ANTLRErrorListener. You may extend BaseErrorListener for that. Collect the errors and append them to a list. Call parser.removeErrorListeners() to remove the default listeners Call parser.addErrorListener(yourListenerInstance) to add your own listener Parse your input Now, for the lexer, you may either do the same thing removeErrorListeners/addErrorListener, or add the following rule at the end: UNKNOWN_CHAR : . ; With this rule, the lexer will never fail (it will generate UNKNOWN_CHAR tokens when it can't do anything else) and all errors will be generated by the parser (because it won't know what to do with these UNKNOWN_CHAR tokens). I recommend this approach.
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/25832429
accepted answer of: http://stackoverflow.com/q/25832429

http://stackoverflow.com/comment/40462629
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25858543
has text: I fail to see how this is specifically programming related.

http://stackoverflow.com/comment/40613327
type: QuestionComment
comment on: http://stackoverflow.com/q/25825075
has text: @KalpeshSoni not CORBA? that's what the solution I found uses, or so I understand.
score: 0
type: Comment

http://stackoverflow.com/q/25796606
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: decimal
answer count: 2
has comment: http://stackoverflow.com/comment/40350963
possible better answer: http://stackoverflow.com/a/25797776
has answer: http://stackoverflow.com/a/25797633
has title: binary to decimal program isn't giving correct answer java
has answer: http://stackoverflow.com/a/25797776
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40350158
favorite count: 0
tagged with: binary
upvote count: 1
accepted answer: http://stackoverflow.com/a/25797633
has body: So i have to write a program for homework where it takes a binary number and prints out its the decimal form. I've tried and and i just can't really get it. Like im printing out what it's doing every time in the loop and it looks like im getting the wrong value when i multiply the inputed data by the 2^i. If someone could help, that would be amazing import java.util.Scanner; public class Homework { public static void main(String[] args) { @SuppressWarnings("resource") Scanner userinput = new Scanner(System.in); System.out.println("Enter a binary number (only 1's or 0's): "); String binary_number = userinput.next(); int value = 0; int square_value = 0; for (int i = 0; i &lt; binary_number.length(); i++) { char binary_place_holder = binary_number.charAt(i); square_value = (int) Math.pow(2, i); if (binary_place_holder == '1') { value = (square_value*binary_place_holder+value); } System.out.println(binary_place_holder+ " " + square_value + " " + value); } System.out.print(binary_number + " == " + value); } }

http://stackoverflow.com/q/25857667
possible better answer: http://stackoverflow.com/a/25857770
has comment: http://stackoverflow.com/comment/40460589
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40460653
type: Question
answer count: 2
downvote count: 4
has answer: http://stackoverflow.com/a/25857778
upvote count: 0
has title: Fix NullPointerException
has comment: http://stackoverflow.com/comment/40460597
tagged with: arrays
tagged with: string
has body: I'm writing code to read a text file and count all the words in the text file. But in the while loop the string array is getting a NullPointerException. I kinda understand that it means the object is not being pointed to or something along those lines but i cant figure out how to fix it. public class W273 { public static void main(String[] args) throws IOException { while (JPL.test()) { String fileName = "phillip.txt"; BufferedReader in = new BufferedReader(new FileReader(fileName)); String line = in.readLine(); String[] words = line.split(" "); int count = 0; String loop; while (in != null) { // move this line words = line.split(" "); for (int i = 0; i &lt; words.length; i++) { loop = words[i]; // NullPointerException here count++; } line = in.readLine(); } in.close(); System.out.print(count); } } }
accepted answer: http://stackoverflow.com/a/25857778
has comment: http://stackoverflow.com/comment/40460856
has comment: http://stackoverflow.com/comment/40460765
tagged with: nullpointerexception
favorite count: 0
has comment: http://stackoverflow.com/comment/40460559
has answer: http://stackoverflow.com/a/25857770
has comment: http://stackoverflow.com/comment/40460674
score: -4

http://stackoverflow.com/comment/40436637
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25844405
type: AnswerComment
has text: That would be the case if it was `log.warn("Main failure {}", e);`. In this case the logger knows that it is an `Exception` in the second parameter and so logs the stack trace in it.

path
tags question: http://stackoverflow.com/q/25760676
tags question: http://stackoverflow.com/q/25736392
tags question: http://stackoverflow.com/q/25856919
type: Tag
tag name: path

http://stackoverflow.com/comment/40259800
type: Comment
comment on: http://stackoverflow.com/a/25722100
has text: @Regnodulous : See [this](http://stackoverflow.com/questions/16588064/how-do-i-add-a-library-project-to-the-android-studio) if you are having trouble importing the project in Android Studio.
type: AnswerComment
score: 0

retrofit
tags question: http://stackoverflow.com/q/25740236
type: Tag
tags question: http://stackoverflow.com/q/25795145
tags question: http://stackoverflow.com/q/25817604
tags question: http://stackoverflow.com/q/25811875
tag name: retrofit
tags question: http://stackoverflow.com/q/25853071

http://stackoverflow.com/a/27368591
score: 27
has comment: http://stackoverflow.com/comment/49918616
has comment: http://stackoverflow.com/comment/43189290
type: Answer
has body: This can be fixed by invalidating the cache. On the main menu, choose File -> Invalidate Caches/Restart. Source
upvote count: 31
has comment: http://stackoverflow.com/comment/93436879
downvote count: 4
answers question: http://stackoverflow.com/q/25770563

http://stackoverflow.com/q/25867293
downvote count: 1
favorite count: 0
has title: Sorting Linked list of objects with respect to values
has answer: http://stackoverflow.com/a/25867369
accepted answer: http://stackoverflow.com/a/25867353
type: AnsweredQuestion
upvote count: 0
tagged with: linked-list
possible better answer: http://stackoverflow.com/a/25867423
tagged with: java
has answer: http://stackoverflow.com/a/25867353
type: Question
score: -1
has body: I have a custom class as follows. class customclass { int a; int b; } I have put objects of this class in a linked list. LinkedList&lt;customclass&gt; ll = new LinkedList&lt;customclass&gt;(); customclass c1= new customclass(); c1.a=1; c1.b=5; ll.add(c1); customclass c2= new customclass(); c2.a=10; c2.b=5; ll.add(c2); customclass c3= new customclass(); c2.a=11; c2.b=15; ll.add(c3); How to use Collections.sort to sort the list with respect to values of "a" from each object of the class customclass.
has comment: http://stackoverflow.com/comment/40477540
answer count: 3
has answer: http://stackoverflow.com/a/25867423
has comment: http://stackoverflow.com/comment/40477585

http://stackoverflow.com/comment/40413715
type: AnswerComment
comment on: http://stackoverflow.com/a/25832056
score: 0
type: Comment
has text: Well, everybody writes his first Swing app at some time, and I didn't deal with Anonymus Inner Classes until I extended `MouseAdapter`

http://stackoverflow.com/q/25835468
downvote count: 0
has comment: http://stackoverflow.com/comment/40420192
favorite count: 0
tagged with: geometry
type: Question
has comment: http://stackoverflow.com/comment/40419965
has comment: http://stackoverflow.com/comment/40420037
has answer: http://stackoverflow.com/a/25835625
tagged with: shapes
has comment: http://stackoverflow.com/comment/40419912
has comment: http://stackoverflow.com/comment/40420006
upvote count: 2
tagged with: java
has title: Draw a triangle from scratch given three points
answer count: 1
has body: I'm learning how to draw basic shapes using points in my graphics course, and I can't figure out how to draw a triangle. I thought it would be similar to drawing a rectangle, but a lot of variables (such as slope and different kinds of triangles) need to be taken into account. Below is my working function of drawing a rectangle drawRectangle(point 1, point 2){ xStart = min(point 1.x, point 2.x) yStar = min(point 1.y, point 2.y) xEnd = max(point 1.x, point 2.x) yEnd = max(point 1.y, point 2.y) for(int i = yStart, i&lt;= yEnd, i++){ for(int j = xStart, j&lt;= yEnd, j++){ drawPoint(i, j); } } } drawRectangle is pretty straight forward, since I just have to loop over the starting point to the ending points of the vertices. However, a triangle has three points, what should I do? I thought about maybe dividing a triangle into two halves, so each half would have a flat "base", but I am not sure if that's a viable approach or not. Edit: Maybe I was unclear, when I say draw a triangle, I meant a color-filled triangle
has comment: http://stackoverflow.com/comment/40419929
type: UnansweredQuestion
tagged with: draw
has comment: http://stackoverflow.com/comment/40420149
score: 2

http://stackoverflow.com/comment/40506202
type: Comment
comment on: http://stackoverflow.com/a/25867527
score: 0
type: AnswerComment
has text: @GregS [Look here](http://docs.oracle.com/javase/8/docs/technotes/guides/security/StandardNames.html#KeyStore).

http://stackoverflow.com/q/25832079
has answer: http://stackoverflow.com/a/25832131
possible better answer: http://stackoverflow.com/a/25832131
favorite count: 0
score: 2
linked to: http://stackoverflow.com/q/25791978
type: AnsweredQuestion
downvote count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40419796
type: Question
has comment: http://stackoverflow.com/comment/40413695
tagged with: java
has comment: http://stackoverflow.com/comment/40413748
tagged with: concurrency
has title: Which data structure to use to store millions of objects in multithreading environment ( Scalability and performace )?
tagged with: scalability
accepted answer: http://stackoverflow.com/a/25850382
upvote count: 2
has body: My requirement is like : I want to perform frequent operation on millions of objects in multi-threaded environment with concurrency and scalability keeping in mind, I need best data structure suitable for this requirement. For example : public interface CarDetails { public CopyOnWriteArrayList&lt;Car&gt; getAllCars(); public Car getMostSoldCars(int carModel); public void addNewCarDetails(Car car); public void oldCardDetails(Car car); } Initially i had thought to use concurrent API's(CopyOnWriteArrayList) as its performs better compared to externally synchronizing the List( eg: Collections.synchronizedList(list object)). Issue with CopyOnWriteArrayList : To store millions of objects in memory and performing frequest operations on it has performance impact because CopyOnWriteArrayList creates entirely new List whenever any updation occurs on it and performing such opertions on millions of objects has performance issue. It is good for multiple readers but i am looking for performance on large number of objects. Issue with Collections.synchronizedList(list object) : Externally synchronizing the list has another issue because it locks on entire object which has another performance issue. Could anyone suggest me , Which collection API's is suitable for this type of requirement( Concurrency , Scalability , Millions of objects , better performance on frequent operation). Thanks in advance !!!
answer count: 2
has comment: http://stackoverflow.com/comment/40413733
has answer: http://stackoverflow.com/a/25850382

http://stackoverflow.com/a/25816714
type: Answer
has comment: http://stackoverflow.com/comment/40393837
has body: In Java 8 you can do the following: long days = ChronoUnit.DAYS.between(LocalDate.of(2014, Month.MARCH, 01), LocalDate.of(2014, Month.FEBRUARY, 15));
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/25816616
score: 0
has comment: http://stackoverflow.com/comment/40387934

http://stackoverflow.com/q/25818889
type: Question
has answer: http://stackoverflow.com/a/25819299
tagged with: jackson
answer count: 1
downvote count: 0
tagged with: proguard
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
has body: I have a model class which I parse using Jackson. public class MyModel { private String x; private String y; @JsonProperty("zzzz") private String z; public String getX() { return x; } public String getY() { return y; } public String getZ() { return z; } } The JSON returned has keys "x", "y" and "zzzz". When I run this without proguard enabled, it works perfectly fine and I am able to read the value of all three variables. When I run proguard, I am able to get only "z" and the others are null. Am I expected to add JsonProperty("field_name") for all my fields even if the key name is the same as the field name? I am using the latest jackson libs (2.4.2). Any help would be appreciated. Thanks!
upvote count: 1
has title: Jackson not parsing all fields when proguard is enabled

http://stackoverflow.com/comment/40487626
type: QuestionComment
has text: Try using `java.lang.System.getProperty("line.separator");`. If this solves the error, it means there's a `System` class in one of your packages.
comment on: http://stackoverflow.com/q/25872672
score: 1
type: Comment

http://stackoverflow.com/q/25758267
answer count: 1
downvote count: 0
linked to: http://stackoverflow.com/q/585599
score: 6
favorite count: 0
type: UnansweredQuestion
tagged with: sockets
has body: I have a client-server application. In the client side(I have no access to client code), a socket exception occurs intermittently that says "java.net.SocketException: Connection reset". It's not "java.net.SocketException: Connection reset by peer". With this information, can I conclude that the issue is with Client side?
upvote count: 6
tagged with: web-services
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25758622
has title: Connection reset versus Connection reset by Peer

http://stackoverflow.com/comment/40400543
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25823892
type: Comment
has text: @AlexLuya: If the `split` is correctly coded in Java code, it should work. My guess is you want to to be using `'` rather than `"` in the string you're passing to it.

http://stackoverflow.com/comment/40463343
has text: The ascii value for `b` is `98` and `y` is `121` so it should be `219` instead of 155.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25858862
score: 0

http://stackoverflow.com/comment/40200839
type: Comment
type: QuestionComment
has text: You also want to change `int one == oneTen;` to `String one = oneTen.nextLine();` for your code to compile/work.
score: 0
comment on: http://stackoverflow.com/q/25716097

http://stackoverflow.com/comment/40327677
type: QuestionComment
has text: @Narmer Because of the program itself. To rewrite it entirely is very bad idea.
comment on: http://stackoverflow.com/q/25785129
type: Comment
score: 0

http://stackoverflow.com/comment/40440723
type: QuestionComment
has text: Mayn't be of much use. If it is a non void return function one liner would be of not much use. That would be extra overhead for the compiler to check, which might lead to longer compile times.
score: 1
comment on: http://stackoverflow.com/q/25846938
type: Comment

http://stackoverflow.com/comment/40445944
has text: its String type actually we use webservice request there we send String type but again we set it to BigDecimal for saving to DB
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25849818

http://stackoverflow.com/comment/40462140
has text: Also, instead of downloading Scala manually, you can get an MSI installer specifically created for Windows. It would add Scala to your Windows path, update the registry if needed, etc. For example, for Scala 2.11.2, you can get it here: http://downloads.typesafe.com/scala/2.11.2/scala-2.11.2.msi
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25858433

http://stackoverflow.com/q/25792456
has comment: http://stackoverflow.com/comment/40341151
tagged with: java
has comment: http://stackoverflow.com/comment/40341230
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/25792547
answer count: 1
has comment: http://stackoverflow.com/comment/40341126
has answer: http://stackoverflow.com/a/25792547
tagged with: trove4j
has title: Setting default value in Trove hash map
type: AnsweredQuestion
tagged with: hashmap
has body: How do I set the default value (returned when the key doesn't exist) for a TLongDoubleHashMap collection. It returns 0 by default, I would like it to return NaN. I found this in the documentation: Returns the value that will be returned from get(long) or put(long, double) if no entry exists for a given key. The default value is generally zero, but can be changed during construction of the collection. But I have found no way to set the value during construction.

http://stackoverflow.com/comment/40417714
type: Comment
has text: How should I close the stream? Should I make the ObjectInputStream accessible from other threads and then do `threadToKill.is=null;` or something? I'm probably misunderstanding your suggestion.
score: 0
comment on: http://stackoverflow.com/q/25834245
type: QuestionComment

http://stackoverflow.com/comment/40401536
type: QuestionComment
comment on: http://stackoverflow.com/q/25825431
has text: Is this line right? `page 2, filenummer 11, filenummer 3, filenummer...,filenummer20` I would except you want `page 2, filenummer 11, filenummer 12, filenummer...,filenummer20`
score: 0
type: Comment

http://stackoverflow.com/comment/40470112
comment on: http://stackoverflow.com/q/25862888
type: Comment
type: QuestionComment
has text: sorry, I modified it now
score: 0

http://stackoverflow.com/comment/40366577
has text: @Killer I wouldn't say that `web.xml` is code, but it could be a usefull information, thats right
comment on: http://stackoverflow.com/q/25806157
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40203989
has text: someone has pointed out its a duplicate question try making those changes,if it doesnt work your build file might be playing some tricks
comment on: http://stackoverflow.com/a/25717783
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40429987
has text: And bu fixing class and function names, you mean by removing the $ signs? @keshlam
type: Comment
comment on: http://stackoverflow.com/a/25840657
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40420458
score: 0
has text: Oh, so you mean just on the basis of difference in the number of parameters I decide which object to return
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25835535

http://stackoverflow.com/q/25783638
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40327985
score: -1
has comment: http://stackoverflow.com/comment/40325094
type: Question
has answer: http://stackoverflow.com/a/25787602
upvote count: 0
has comment: http://stackoverflow.com/comment/40325113
has title: java.io.FileNotFoundException:retrieve a set of files from a folder in server
answer count: 1
has body: I'm attempting to fetch a set of files from server, using getfile(), and I get this Exception: java.io.FileNotFoundException: E:\SERVER\Server Content\Apps\icons (Access is denied) Here's my code: DownloadController downloadcontroller = null; try { downloadcontroller = ServerConnector.getServerConnector().getDownloadController(); } catch (NotBoundException ex) { Logger.getLogger(HomeUI_2Controller.class.getName()).log(Level.SEVERE, null, ex); } catch (MalformedURLException ex) { Logger.getLogger(HomeUI_2Controller.class.getName()).log(Level.SEVERE, null, ex); } catch (RemoteException ex) { Logger.getLogger(HomeUI_2Controller.class.getName()).log(Level.SEVERE, null, ex); } RemoteInputStream file = null; try { file = downloadcontroller.getFile("E:\\SERVER\\Server Content\\Apps\\icons"); } catch (IOException ex) {} public RemoteInputStream getFile(String fileName) throws IOException { // create a RemoteStreamServer (note the finally block which only releases // the RMI resources if the method fails before returning.) //read data RemoteInputStreamServer istream = null; try { File file = new File(fileName); System.out.println(file.exists()); FileInputStream fileInputStream = new FileInputStream(file); BufferedInputStream bufferedInputStream = new BufferedInputStream( fileInputStream); istream = new SimpleRemoteInputStream(bufferedInputStream); // export the final stream for returning to the client //send data RemoteInputStream result = istream.export(); // after all the hard work, discard the local reference (we are passing // responsibility to the client) istream = null; return result; } finally { // we will only close the stream here if the server fails before // returning an exported stream if (istream != null) { istream.close(); } } } Logger.getLogger(HomeUI_2Controller.class.getName()).log(Level.SEVERE, null, ex);
has comment: http://stackoverflow.com/comment/40327603
tagged with: client
accepted answer: http://stackoverflow.com/a/25787602
favorite count: 0
tagged with: download
downvote count: 1

http://stackoverflow.com/comment/40335150
type: AnswerComment
has text: No it can also create the schema try it once
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25788297

http://stackoverflow.com/q/25734874
has comment: http://stackoverflow.com/comment/40236274
has answer: http://stackoverflow.com/a/25735009
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/25734966
favorite count: 0
has answer: http://stackoverflow.com/a/25734979
type: UnansweredQuestion
has title: How to compare strings and return position in a linked node?
tagged with: linked-list
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40236256
has comment: http://stackoverflow.com/comment/40236255
has body: I am trying to write a method that returns the position of a given object in a linked list. The method signature should be public int getPosition(T anObject). I am having trouble figuring out this method. Here is what I have so far: public int getPosition(T anObject) { int position = 0; Node currentNode = firstNode; for(int i = 0; i &lt; length; i++) { if(anObject.equals(currentNode.data)) { position = i + 1; currentNode = currentNode.next; } } return position; } My output position isn't changing. It stays at zero. Here is my driver program. public class Homework3Driver { public static void main(String[] args) { String[] names = {"Abby", "Bobby", "Carla", "Doug"}; LList&lt;String&gt; nameList = new LList(names, 4); String[] newNames = {"Edgar", "Frank"}; nameList.addAll(newNames); System.out.println("Output should be 3: " + nameList.getPosition("Carla") + "\n"); System.out.println("Output should be 0 or a negative number: " + nameList.getPosition("George") + "\n"); } }
upvote count: 1
tagged with: nodes
type: Question

http://stackoverflow.com/comment/40472942
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25864551
has text: Use `java -cp .;vendorcatalogapi.jar MyFirstClass` with windows, `java -cp .:vendorcatalogapi.jar MyFirstClass` with Unix(-like). Just a hint: Give the `.java` files the same name of your java class. It will be much easier for you to find classes.

http://stackoverflow.com/comment/40372356
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25796494
type: AnswerComment
has text: Good work. One comment: it's not running in Visual Studio that's the slowdown, but running with the debugger attached. If in Visual Studio you select Debug->Run without Debugging (or press Ctrl+F5), the program will run at the same speed as it runs from the command line.

http://stackoverflow.com/a/25786410
upvote count: 2
has comment: http://stackoverflow.com/comment/40369892
downvote count: 0
answers question: http://stackoverflow.com/q/25786185
has body: Go to your Project folder e.g. MyProject in command Prompt run below commands one by one (assuming you have installed maven in your system) cd C:\MyWorkSpace cd MyProject mvn clean install -DskipTests=true mvn eclipse:eclipse and then right click your project and click Refresh That might solve your problem.
has comment: http://stackoverflow.com/comment/40371267
type: Answer
score: 2

usb-debugging
tags question: http://stackoverflow.com/q/25741773
type: Tag
tag name: usb-debugging

http://stackoverflow.com/a/25750694
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/25750641
downvote count: 0
type: Answer
has body: The \t character is a tabulation character. Subsequent tabs act "inconsistently", as in, they won't display the same amount of space. You should use a regular number of spaces instead. Something like: System.out.println("Of what race do you belong?\n[H]uman [E]lf [D]warf [O]rc [G]nome");

http://stackoverflow.com/comment/40205169
has text: Thank You! You are right. but how can i handle it with java code ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25718304

http://stackoverflow.com/comment/40207449
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25719622
score: 0
has text: oic...yah, `nextInt()` probably throws the exception. I was looking at all the wat of recursive calls...now that's definitely asking for trouble.

http://stackoverflow.com/q/25722397
has comment: http://stackoverflow.com/comment/40343309
answer count: 1
tagged with: tomcat
has title: Ghost Driver inside a Tomcat App
has comment: http://stackoverflow.com/comment/40245557
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40340285
tagged with: java
tagged with: selenium
type: Question
tagged with: phantomjs
has comment: http://stackoverflow.com/comment/40230134
has answer: http://stackoverflow.com/a/25740011
has body: I would like to use PhantomJS inside a Tomcat WebApp. For this I found Ghost Driver which I successfully integrate to my app. I added the dependency to Selenium: selenium-server-standalone-2.42.2.jar It works but there are some conflicts with the jar of Tomcat: [exec] INFO: validateJarFile(/Users/charles/Pidoco/Editor/dev/webapps/rabbit/WEB-INF/lib/selenium-server-standalone-2.42.2.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class Why does it work when Tomcat say "jar not loaded"? Does Tomcat loaded a part of the jar? Is it possible to get Ghost Driver working with Tomcat?
has comment: http://stackoverflow.com/comment/40345782
accepted answer: http://stackoverflow.com/a/25740011
score: 0

http://stackoverflow.com/comment/40387233
has text: What are you doing that makes java's built in date parsing not good enough?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25817269
score: 0

http://stackoverflow.com/q/25868860
has title: Strange rendering SVG elements in SplitPanel components
type: AnsweredQuestion
tagged with: http://stackoverflow.com/tag/svg
tagged with: java
tagged with: vaadin
type: Question
accepted answer: http://stackoverflow.com/a/25875211
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25875211
tagged with: d3.js
tagged with: vaadin7
has body: I have problem with rendering svg elements in Horizontal/Vertical SplitPanel components. My vaadin project includes javascript component, which is used for rendering network graph. The javascript component uses d3.js library and network graph is rendered as svg element in parent div element. In source code below is the main layout of window. I used VerticalLayout component, then I used Label component as a div element in which svg element is created and rendered. Process of creating svg element (network graph) is written in javascript, where svg element is rendered in div element with css class ".v-splitpanel-first-container". @SuppressWarnings("serial") public class MyVaadinUI extends UI { final Graph graph = new Graph(); @Override protected void init(VaadinRequest request) { final VerticalLayout layout = new VerticalLayout(); layout.setSizeFull(); setContent(layout); Label div = new Label(); div.setStyleName("v-splitpanel-first-container"); div.setHeight(100, Sizeable.UNITS_PERCENTAGE); div.setWidth(100, Sizeable.UNITS_PERCENTAGE); layout.addComponent(div); layout.addComponent(graph); layout.setExpandRatio(div, 1); } } Adding svg element (graph variable in source code) to VerticalLayout component I got expected result: Then I tried to add svg element to VerticalSplitPanel component instead of VerticalLayout component: @SuppressWarnings("serial") public class MyVaadinUI extends UI { final Graph graph = new Graph(); public static final String brownFox = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps …

http://stackoverflow.com/a/25719444
answers question: http://stackoverflow.com/q/25719208
has body: You can use interceptor for it : &lt;mvc:interceptor&gt; &lt;mvc:mapping path="/foo/**"/&gt; &lt;bean class="com.interceptors.AuthorizationInterceptor" /&gt; &lt;/mvc:interceptor&gt; suppose we want to check session then you can write code in AuthorizationInterceptor like : if(UserSession.isSessionValid()){ System.out.println("ready to enter"); return true; }else{ System.out.println("not logged in...redirecting to login"); response.sendRedirect("/in_development_page"); return false; } here UserSession is my class that have session variables. if you just want to redirect then you can remove code of if &amp; only pass response.sendRedirect(). in parameter pass the page URL of under development. full class code : public class AuthorizationInterceptor extends HandlerInterceptorAdapter { @Autowired private IUserSession UserSession; @Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { System.out.println("interceptor called for " + request.getRequestURI()); if(UserSession.isSessionValid()){ System.out.println("ready to enter"); return true; }else{ System.out.println("not logged in...redirecting to login"); response.sendRedirect("/in_development_page"); return false; } } } here class will extend HandlerInterceptorAdapter spring class.
has comment: http://stackoverflow.com/comment/40207134
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/40207061
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/40207397
accepted answer of: http://stackoverflow.com/q/25719208
downvote count: 0

http://stackoverflow.com/a/25803281
answers question: http://stackoverflow.com/q/25802970
has body: Seems you are missing the "encodeHexString" method - instead of including the whole jar, use any easy implementation around... for example: private final static char[] hexArray = "0123456789abcdef".toCharArray(); private static String encodeHexString(byte[] bytes) { char[] hexChars = new char[bytes.length * 2]; int v; for (int j = 0; j &lt; bytes.length; j++) { v = bytes[j] &amp; 0xFF; hexChars[j * 2] = hexArray[v &gt;&gt;&gt; 4]; hexChars[j * 2 + 1] = hexArray[v &amp; 0x0F]; } return new String(hexChars); }
type: Answer
score: 0

http://stackoverflow.com/q/25792722
tagged with: android
has answer: http://stackoverflow.com/a/25792805
downvote count: 0
has body: I'm trying to figure out what is the most efficient way to pass an object from one activity to another in android. I read I can extend an object as Parcelable or Serializable, and it seems like Parcelable is the clear winner in terms of performance. Now I just thought of a different way. Instead of extending any class, I'll put all my data variables into a bundle, pass those data, and reconstruct the object. For example: public class myObject { // Data Variables private String str1; private String str2; private boolean bool1; // Constructor public myObject(String str1, String str2, boolean bool1){ this.str1 = str1; this.str2 = str2; this.bool1 = bool1; } } Now I'll just pass the variables: Intent i = new Intent(); i.setClass(ActOne.this, ActTwo.class); Bundle bundle = new Bundle(); bundle.putString("KEY_STR1", str1); bundle.putString("KEY_STR2", str2); bundle.putBoolean("KEY_BOOL1", bool1); startActivity(i); In the ActTwo class, I'll get the data from the intent and reconstruct my object: myObject newObjHolder = new myObject(str1, str2, bool1); How does this way compare to passing a Parcelable? Faster? Slower? Barely any difference?
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40341563
has title: Passing Parcelable/Serializable vs Passing object's data members
tagged with: parcelable
upvote count: 1
has comment: http://stackoverflow.com/comment/40341609
has comment: http://stackoverflow.com/comment/40341592
answer count: 1
tagged with: bundle
has comment: http://stackoverflow.com/comment/40341706
favorite count: 0
tagged with: serialization
type: UnansweredQuestion

http://stackoverflow.com/a/25744359
answers question: http://stackoverflow.com/q/25741025
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40254637
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40253585
has body: I don't think you could get an ocr framework to recognize the letter in this image without considerable preprocessing of the image. Here's a rough idea for some preprocessing that you might try (It's a lot of work and requires a lot of tweaking with threshold values etc. and even then I can't guarantee that it will work): For each dot calculate the density of dots surrounding it and filter out all dots situated in places where the dot density is low. Then do one of the following: a) Use morphology to try to make one object out of it. b) Try to find the contours of the letter and then fill it in using watershed algorithm. Now run the OCR as you did before.

http://stackoverflow.com/comment/40448606
score: 1
has text: Dear Friend, the questions are shown to users on the basis of tags, not the capitalism. If you have included the tag Java, it will be visible to all the users who are more active in Java field. There is technically no need of writing it in all caps to make more visible. And why I commented is because, if you come for an interview to me for Java programmer and you have written JAVA in your resume, I will just kick you a$$. You should know how to write. ALVARO.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25844721

http://stackoverflow.com/a/25879945
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25800083
has comment: http://stackoverflow.com/comment/40550088
upvote count: 2
score: 2
has body: There is a known limitation in Spring Boot and an open issue related to using JSPs with embedded containers. Long story short, it's not currently supported. However, the Spring Boot reference documentation links to a GitHub example project they claim gets it working.

http://stackoverflow.com/q/25816134
has answer: http://stackoverflow.com/a/25816242
has comment: http://stackoverflow.com/comment/40385214
favorite count: 0
has title: How to "append" new field/data into an object without creating a new class nor modifying the class?
has comment: http://stackoverflow.com/comment/40385064
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/25816241
has comment: http://stackoverflow.com/comment/40385024
has comment: http://stackoverflow.com/comment/40384950
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40384994
type: Question
has answer: http://stackoverflow.com/a/25816259
downvote count: 0
has body: I have a method which calculates an integer for every row in a bean MyPeriod. I don't want to change the class MyPeriod, to create a new class or to have two lists but I need to return some list which contains the list of MyPeriod with a new column. What is the ways to deal with this issue? public ??? bindNewColumn (List&lt;MyPeriod&gt; periods) { List&lt;Integer&gt; newList = new ArrayList&lt;&gt;(); for (MyPeriod period : periods) { newList.add(calculation(period)); } return ???; }
has answer: http://stackoverflow.com/a/25816221
has comment: http://stackoverflow.com/comment/40385159
has comment: http://stackoverflow.com/comment/40385029
has comment: http://stackoverflow.com/comment/40384999
answer count: 4

http://stackoverflow.com/a/28358590
has comment: http://stackoverflow.com/comment/97441682
has body: I am not sure if this will help your situation (that is if it stills exists), however, after scouring the web for a similar issue. I was creating a native query from a persistence EntityManager to perform an update. Query query = entityManager.createNativeQuery(queryString); I was receiving the following error: caused by: javax.persistence.TransactionRequiredException: Executing an update/delete query Many solutions suggest adding @Transactional to your method. Just doing this did not change the error. Some solutions suggest asking the EntityManager for a EntityTransaction so that you can call begin and commit yourself. This throws another error: caused by: java.lang.IllegalStateException: Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT instead I then tried a method which most sites say is for use application managed entity managers and not container managed (which I believe Spring is) and that was joinTransaction(). Having @Transactional decorating the method and then calling joinTransaction() on EntityManager object just prior to calling query.executeUpdate() and my native query update worked.
score: 135
downvote count: 0
answers question: http://stackoverflow.com/q/25821579
has comment: http://stackoverflow.com/comment/115214769
type: Answer
upvote count: 135
has comment: http://stackoverflow.com/comment/97441412
has comment: http://stackoverflow.com/comment/121326845
has comment: http://stackoverflow.com/comment/105960244
has comment: http://stackoverflow.com/comment/47237180
has comment: http://stackoverflow.com/comment/137441330

http://stackoverflow.com/q/25821103
has answer: http://stackoverflow.com/a/25821702
linked to: http://stackoverflow.com/q/16377754
linked to: http://stackoverflow.com/q/20163578
score: 0
has body: I have this data in my text file. Obj1= { "AA" : "sasa", "BB" : "fdsfsf", "CC" : "sfsdf", "DD" : "kmdksmd", "EE" : "dsnjsdn" }; Obj2= { "DD" : "ndjsdnsjd", "MM" : "jskdjskadn" }; This data is in a single text file. How do I convert this to two different objects in JAVA
answer count: 1
has comment: http://stackoverflow.com/comment/40395051
has comment: http://stackoverflow.com/comment/40394187
type: UnansweredQuestion
has title: Forming Json from txt file
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/q/25724545
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25724985
tagged with: web-services
tagged with: spring
tagged with: java
tagged with: hibernate
downvote count: 2
has title: when disc is full the web service dont respond
type: Question
tagged with: jakarta-ee
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/40216359
has body: i have a web service, it create an image for a captcha, it send and image to another server in bytes, then this server ( the receiver ), create an image with that bytes, and then render the image with an action of struts2. i've noted that when the log is full, ( when i dont have space in disk ),the web service is not sending the bytes of the captcha, why i say this, because, after delete the logs and free some space of the web service, it works normaly, but i dont know why its happening im using: Struts2 spring hibernate the web service its RESTFUL i hope, i explain myself
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25720548
has answer: http://stackoverflow.com/a/25721831
type: Question
answer count: 2
has body: I have 2 different classes which contain considerable number of the same public methods. public class HorizontalPackageSelector extends HorizontalScrollView { // skipped public void method1() { doSomething1(); doSomething2(); } } and public class VerticalPackageSelector extends ScrollView { // skipped public void method1() { doSomething1(); doSomething2(); } } And several other methods (about 200 lines in both classes). I see only one way to avoid duplication: public class PackageSelectorHelper { // skipped public void method1() { doSomething1(); doSomething2(); } } public class HorizontalPackageSelector extends HorizontalScrollView { private final PackageSelectorHelper helper = new PackageSelectorHelper(this); // skipped public void method1() { helper.method1(); } } public class VerticalPackageSelector extends ScrollView { private final PackageSelectorHelper helper = new PackageSelectorHelper(this); // skipped public void method1() { helper.method1(); } } But this is not easy to do if a number of identical methods is too big.
has title: Removing code duplication in an identical public methods of 2 not related classes
downvote count: 0
has comment: http://stackoverflow.com/comment/40210735
has comment: http://stackoverflow.com/comment/40236805
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/25721298
has comment: http://stackoverflow.com/comment/40213249
has comment: http://stackoverflow.com/comment/40210239
score: 1
tagged with: java
tagged with: code-duplication

http://stackoverflow.com/q/25739721
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
has title: draw icon from database
downvote count: 0
has body: ok i try to draw icon from database in a map... but i have null pointer exception.. i do this .. public enum icon { lake } [....] public class POI implements Serializable { private static final long serialVersionUID = -8618762943599351669L; private long id; private String name; private double longitude; private double latitude; private boolean visible = true; public static String icon; private String info; public POI(long id, String name, double longitude, double latitude, boolean visible, String icon, String info) { this(id, name, longitude, latitude, visible, icon, info, true); } public POI(long id, String name, double longitude, double latitude, boolean visible, String icon, String info, boolean b) { this.id = id; this.name = name; this.longitude = longitude; this.latitude = latitude; this.visible = visible; POI.icon = icon; this.info = info; } void initOverlays() { Map&lt;icon, Bitmap&gt; markersIcons = new HashMap&lt;icon, Bitmap&gt;(); Bitmap posMarker = BitmapFactory.decodeResource(getResources(), R.drawable.marker); Bitmap pathMarker = BitmapFactory.decodeResource(getResources(), R.drawable.dest); Bitmap church = BitmapFactory.decodeResource(getResources(), R.drawable.church); TilesManager tilesManager = mapView.getTilesManager(); tracksOverlay = new TracksOverlay(this, tilesManager); positionMarkerOverlay = new PositionMarkerOverlay(tilesManager, posMarker); markersIcons.put(icon.church, church); poiOverlay = new POIOverlay(tilesManager, this, markersIcons); pathOverlay = new PathOverlay(tilesManager, pathMarker); mapView.addOverlay(tracksOverlay); mapView.addOverlay(poiOverlay); mapView.addOverlay(positionMarkerOverlay); mapView.addOverlay(pathOverlay); StateManager.restoreTracksOverlayState(this, tracksOverlay); StateManager.restorePOIOverlayState(this, poiOverlay); StateManager.restorePathOverlayState(this, pathOverlay); } after i draw icon from database i get in "lake" in colums of icon.. public POIOverlay(TilesManager tilesManager, Context context,Map&…
favorite count: 0
type: UnansweredQuestion
tagged with: android
answer count: 0

http://stackoverflow.com/q/25768495
type: Question
has title: how to print String one after another in java
has comment: http://stackoverflow.com/comment/40297480
has comment: http://stackoverflow.com/comment/40297487
linked to: http://stackoverflow.com/q/7939802
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40298025
has answer: http://stackoverflow.com/a/25768651
has answer: http://stackoverflow.com/a/25768601
has body: I want to know that I want to print string one after another but in a particular time interval. Everything is fine. I want to know that when second string print override the first one and third override the second and so on.. How can I do this? This is my code : public class StringTest { public static void main(String args[]) { String arr[] = { "mahtab", "hussain", "yasir", "azmi", "saif" }; int l = arr.length; for (int i = 0; i &lt; arr.length; i++) { System.out.print(arr[i]); try { Thread.sleep(5 * 1000); } catch (InterruptedException e) { e.printStackTrace(); } } } }
has comment: http://stackoverflow.com/comment/40297340
has comment: http://stackoverflow.com/comment/40297428
has comment: http://stackoverflow.com/comment/40297345
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25768635
tagged with: string
has comment: http://stackoverflow.com/comment/40297334
has comment: http://stackoverflow.com/comment/40321230

http://stackoverflow.com/comment/40351935
comment on: http://stackoverflow.com/q/25798033
has text: Are you running in a CI framework like Jenkins? I imagine that has options to send results, rather than baking the complexity into your build system itself.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25841360
tagged with: java
type: Question
has title: Quickbooks Online Integration , Authentication Strategy
tagged with: quickbooks
score: 0
answer count: 1
tagged with: quickbooks-online
linked to: http://stackoverflow.com/q/25418764
has answer: http://stackoverflow.com/a/25849826
has body: I want to integrate a core java application (middleware) to Quickbooks online , which will post invoices to it . canu suggest me the integration stategy to follow , as Quickbooks provides two basic authentication methods , Namely : 1 : SSO Management API 2 : OAuth Management API Also in OAuth Management API , the documents says : "An authorized access token expires after 180 days. When this occurs, responses to calls to QuickBooks Data Services and the QuickBooks Online API indicate that the access token is invalid." which requires A Reconnect api to be called, but i can see no example, or proper documentation for Reconnect Please help !!
has comment: http://stackoverflow.com/comment/40443230
type: UnansweredQuestion

http://stackoverflow.com/comment/40351843
score: 0
comment on: http://stackoverflow.com/q/25796584
type: Comment
type: QuestionComment
has text: There isn't any way to ensure that there is only one object of this model at all times?

jira
tags question: http://stackoverflow.com/q/25744472
tag name: jira
tags question: http://stackoverflow.com/q/25719484
tags question: http://stackoverflow.com/q/25745777
tags question: http://stackoverflow.com/q/25873158
type: Tag
tags question: http://stackoverflow.com/q/25749427

http://stackoverflow.com/q/25729954
tagged with: java
tagged with: eclipse
has body: I have just completed my first java program. It's sitting in Eclipse pretty as a newborn (which really isn't all that pretty). Anyway, I need to have an icon on the desktop that allows users to click and run the code. I found an example of how to make a .jar from the project in Eclipse, but nothing happens when I click on it. There are a LOT of options in Eclipse so I'm guessing I need to select/deselect something, but the examples online are very few and far between. Since I'm sure I'm not the first person who has done this, I'm assuming I lack the vocabulary to find an answer. Could someone please give me a little direction to find help? I have tried "compiling" but that's running the code. Anything with .java just tells me how to install Java. There have been too many searches to list them here. Suffice it to say I need a push in the right direction, please.
linked to: http://stackoverflow.com/q/423938
has comment: http://stackoverflow.com/comment/40226474
has comment: http://stackoverflow.com/comment/40226475
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40226521
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40227126
has title: What to do with java code when done
has answer: http://stackoverflow.com/a/25730951
type: UnansweredQuestion
upvote count: 1
type: Question

http://stackoverflow.com/comment/40289620
type: QuestionComment
has text: this code of yours should do it if you added this adapter to your listview
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25764327

http://stackoverflow.com/comment/40369400
comment on: http://stackoverflow.com/q/25792764
score: 0
type: QuestionComment
has text: Why do you test `isInStandByMode()`? This is most likely going to be always false since you are within a running job. Remove that check first.
type: Comment

http://stackoverflow.com/comment/40203588
type: Comment
type: QuestionComment
has text: so whats the problem? what is test.list_pegawai();?
score: 0
comment on: http://stackoverflow.com/q/25717637

http://stackoverflow.com/comment/40274782
type: QuestionComment
comment on: http://stackoverflow.com/q/25754714
has text: i'm sorry but could you please help me edit the code and use the read/write methods, i'm getting some complications in doing it thank you
score: 0
type: Comment

http://stackoverflow.com/a/25767205
type: Answer
answers question: http://stackoverflow.com/q/25766671
has body: Java's URLEncoder.encode() uses the same encoding standards as PHP's urlencode() function. Therefore, to decode a string that has been encoded using Java's URLEncoder.encode(), you can use PHP's urldecode() function. e.g. $username_encoded = $_COOKIE["username"]; $username_decoded = urldecode($username_encoded);
score: 0

http://stackoverflow.com/q/25867726
score: 0
has body: First of all, I must mention that I don't know java. I'm php developer. But I got a task where I need to download validator written on JAVA. Should be compiled and added as a separate YII module with php-wrapper. Source is here. I have no idea how to do this, and I couldn't find anything that helps. Also when I try to compile this validator I get an error BUILD FAILED ${env.CATALINA_HOME}/lib does not exist. I try to compile it with ant build as it says in manual. So, can anybody please help me with this? Thanks in advance EDIT: I managed to build. Problem was in path for CATALINA_HOME. So that's solved. Anybody has any idea about wrapping this to PHP?
accepted answer: http://stackoverflow.com/a/25869059
answer count: 1
tagged with: yii
has title: Compile java app to php plugin
has answer: http://stackoverflow.com/a/25869059
tagged with: php
type: Question
type: AnsweredQuestion
tagged with: ant
tagged with: java

http://stackoverflow.com/comment/40374380
has text: create an ant task for doing this. run the ant script with the same jre as workspace.
type: QuestionComment
comment on: http://stackoverflow.com/q/25810093
score: 0
type: Comment

http://stackoverflow.com/comment/40388581
has text: What does `load` do? What happens when you call it twice? Why would calling it more than one result in a different object being read?
comment on: http://stackoverflow.com/q/25817953
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40477804
comment on: http://stackoverflow.com/q/25849605
type: Comment
type: QuestionComment
has text: Yup. As I mentioned earlier it looks like your POJO is not proper one. Check getter setter for your User Pojo with field id.
score: 0

http://stackoverflow.com/a/25734073
score: 1
answers question: http://stackoverflow.com/q/25734047
has body: Consider your standard fare for loop: for (int i = 0; i &lt; someValue; i++) { // loop body } This is useful as a shorthand notation for i += 1, or i = i + 1. In your case, you are incrementing the value at getArray()[ index = 3], not the index variable. I doubt this does what you want (considering it would be null).
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/a/25823671
has comment: http://stackoverflow.com/comment/40398738
answers question: http://stackoverflow.com/q/25823279
type: Answer
has comment: http://stackoverflow.com/comment/40439215
has comment: http://stackoverflow.com/comment/40430113
has comment: http://stackoverflow.com/comment/40435415
has comment: http://stackoverflow.com/comment/40439026
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25823279
has body: Try this way,hope this will help you to solve your problem. public class VoteListAdapter extends BaseAdapter { private final String TAG = "*** VoteListAdapter ***"; private Context context; private ArrayList&lt;Vote&gt; votes; public VoteListAdapter(Context context,ArrayList&lt;Vote&gt; votes) { this.context =context; this.votes =votes; } @Override public int getCount() { return votes.size(); } @Override public Object getItem(int position) { return votes.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, View convertView, ViewGroup parent) { final ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = LayoutInflater.from(context).inflate(R.layout.row, null); holder.tvName = (TextView) convertView.findViewById(R.id.tvName); holder.tvComment = (TextView) convertView.findViewById(R.id.tvComment); holder.tvDate = (TextView) convertView.findViewById(R.id.tvDate); holder.ratingBar = (RatingBar)convertView.findViewById(R.id.ratingBar); holder.sharebtn = (Button) convertView.findViewById(R.id.sharebtn); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.tvName.setText(votes.get(position).getName()); holder.tvComment.setText(votes.get(position).getComment()); holder.tvDate.setText(getFormatedDate(votes.get(position).getPublishDate())); holder.ratingBar.setRating(Integer.parseInt(votes.get(position).getRate())); holder.sharebtn.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_TEXT,votes.get(position).getComment()); try { context.startActivity(Intent.createChooser(i, "Share")); } catch (android.content.ActivityNotFoundException ex) { ex.printStackTrace(); } } }); return convertView; } private String getFormatedDate(String date) { String myDate = null; try { Date oldDate = new SimpleDateFormat("yy-mm-d…

http://stackoverflow.com/a/25748930
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40262214
answers question: http://stackoverflow.com/q/25748868
has body: I suspect it's because primitive public static final fields are actually inlined by the compiler when referenced from another class. If you have to load the other class for it to receive a value, the compiler can't do this. I only found this implicitly in the JLS unfortunately: Note that static fields that are constant variables (§4.12.4) are initialized before other static fields (§12.4.2). This also applies in interfaces (§9.3.1). Such fields will never be observed to have their default initial values (§4.12.5), even by devious programs. Clearly if they have to be initialized before other static fields, they can't be initialized in static blocks.
has comment: http://stackoverflow.com/comment/40262991
has comment: http://stackoverflow.com/comment/40262540
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25748868

http://stackoverflow.com/q/25853530
answer count: 1
favorite count: 0
has body: I am trying to write a program that forms a random 2 character word and then asks the user to guess the word. After the user inputs a guess, the program should check the guess with the answer. The program should then give the user a hint depending on their guess in the form nAkB where nA is the right letters in the right position and kB is the right letters but in the wrong position. My problem is that my program won't show the hint when their are right letters but in the wrong position (say the answer is aD and the user guesses Dc) the output should be "Hint: 0A1B". Here is my code for the getHint Method: public static String getHint(String guess, String answer){ String hint = "No"; if(guess.charAt(0) == answer.charAt(0) &amp;&amp; guess.charAt(1) == answer.charAt(1)){ hint = "You win!"; } else if(guess.charAt(0) == answer.charAt(0) &amp;&amp; guess.charAt(1) != answer.charAt(1)){ hint = "Hint: 1A0B"; } else if(guess.charAt(0) != answer.charAt(0) &amp;&amp; guess.charAt(1) == answer.charAt(1)){ hint = "Hint: 1A0B"; } else if(guess.charAt(0) == answer.indexOf(guess.charAt(0)) &amp;&amp; guess.charAt(1) == answer.indexOf(guess.charAt(1))){ hint = "Hint: 0A2B"; } else if(guess.charAt(0) == answer.charAt(0) &amp;&amp; guess.charAt(1) == answer.indexOf(guess.charAt(1)) &amp;&amp; guess.charAt(1) != answer.charAt(1)){ hint = "Hint: 1A1B"; } else if(guess.charAt(1) == answer.charAt(1) &amp;&amp; guess.charAt(0) == answer.indexOf(guess.charAt(0)) &amp;&amp; guess.charAt(0) != answer.charAt(0)){ hint = "Hint: 1A1B"; } else if(guess.charAt(0) == answer.indexOf(guess.charAt(0)) &amp;&amp; guess.charAt(0) != answer.charAt(0) &amp;&amp; guess.charAt(1) != answer.indexOf(guess.charAt(1)) &amp;&amp; guess.charAt(1) != answer.charAt(1)){ hint = "Hint: 0A1B"; } else if(guess.charAt(1) == answer.indexOf(guess.charAt(1)) &amp;&amp; guess.charAt(1) != answer.charAt(1) &amp;&amp; guess.charAt(0) == answer.indexOf(guess.charAt(0)) &amp;&amp; guess.charAt(0) != answer.charAt(0)){ hint = …
has title: Multiple if/else statements not producing the desired output
type: AnsweredQuestion
score: -4
accepted answer: http://stackoverflow.com/a/25853646
type: Question
tagged with: if-statement
tagged with: java
has answer: http://stackoverflow.com/a/25853646
downvote count: 4
upvote count: 0

http://stackoverflow.com/a/25759558
type: Answer
has comment: http://stackoverflow.com/comment/40281550
score: 4
has body: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project helloworld: Fatal error compiling: invalid target release: 1.7 -> [Help 1] If you look at the error, its complaining about an JDK7. Make sure you are using correct version of Java to be able to compile the application. You need atleast jdk1.7 (or higher). As the question is tagged for eclipse, you can also set the available java compilers in the 'installeded JREs' option inside eclipse Apart from that, you can also set the compliance level inside the pom of the project as below maven-compiler-plugin 3.1 1.7 1.7
has comment: http://stackoverflow.com/comment/40281461
has comment: http://stackoverflow.com/comment/40281416
has comment: http://stackoverflow.com/comment/40316513
upvote count: 4
has comment: http://stackoverflow.com/comment/40282738
accepted answer of: http://stackoverflow.com/q/25759471
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25759471

http://stackoverflow.com/comment/40462847
type: QuestionComment
comment on: http://stackoverflow.com/q/25858792
score: 0
has text: @ElliottFrisch - Why shouldn't s/he use a StringTokenizer?
type: Comment

http://stackoverflow.com/q/25793400
has answer: http://stackoverflow.com/a/25793534
type: UnansweredQuestion
score: -3
answer count: 4
duplicate of: http://stackoverflow.com/q/2056221
has answer: http://stackoverflow.com/a/25793643
tagged with: java
downvote count: 3
has title: Passing multiple text files in java for the purpose of parsing
type: Question
has comment: http://stackoverflow.com/comment/40342851
upvote count: 0
has comment: http://stackoverflow.com/comment/40342891
has body: I am trying to build a parser which would take up each file from a given path which contains 100's of text files , parse each and save each files extracted data into a different document in memory. My doubt is how do I specify to Java to pick up each text file from the given location and parse it. I want to kind of construct a loop that would check through all the folders inside the given path pick up a text file process it and move to the next location.
linked to: http://stackoverflow.com/q/2056221
has answer: http://stackoverflow.com/a/25793672
has answer: http://stackoverflow.com/a/25793539
tagged with: regex
favorite count: 0

http://stackoverflow.com/comment/40275003
has text: Please post a fully reproducible example. I don't know what you are trying to demonstrate with the code you've posted. I don't think your issue is with `volatile` at all.
comment on: http://stackoverflow.com/q/25753982
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/105063019
comment on: http://stackoverflow.com/a/59439447
type: AnswerComment
score: 1
has text: see the explanation in the answer
type: Comment

http://stackoverflow.com/comment/40489182
score: 0
comment on: http://stackoverflow.com/q/25872769
has text: ok thank you) but I am getting an error now , the version of the application is not configured for billing ...
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25743261
answer count: 0
tagged with: frontend
has body: Hi I am developing a web page which will be placed in two different servers - back end and front end. Back end project has single entities module and multiple modules with beans and remotes. Entities and remote files are needed in front end. So I just want to give these classes to front end. I've added dependency to entities module in front end. BUT when I launch front end it executes entities module and makes you able to connect to DB in front end(which is back ends job). I can solve it by exporting entities folder to jar and adding it to front end, but you will have to do it every time you change something in entities. So I am looking for a better solution - like maven dependency. I am adding entities dependency this way: back-end back-end-entities 0.0.1-SNAPSHOT
tagged with: java
tagged with: backend
type: Question
has comment: http://stackoverflow.com/comment/40251320
tagged with: entity
score: 0
has title: How to add dependency to maven and not to execute it?
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/40253100

http://stackoverflow.com/comment/40221282
has text: Thanks I will try this. But: I'm using `MapJobRepositoryFactoryBean, MapJobExplorerFactoryBean, SimpleJobLauncher` (similar do `DefaultBatchConfigurer`. Where do I have to pass my custom metadata-db? because non of them takes a `DataSource` as argument...
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25727110
type: Comment

http://stackoverflow.com/q/25774019
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40308136
has comment: http://stackoverflow.com/comment/40308022
tagged with: shiva3d
has comment: http://stackoverflow.com/comment/40308285
has comment: http://stackoverflow.com/comment/40308350
has comment: http://stackoverflow.com/comment/40308011
tagged with: google-play-games
has comment: http://stackoverflow.com/comment/40308393
has comment: http://stackoverflow.com/comment/40307899
has comment: http://stackoverflow.com/comment/40308102
type: UnansweredQuestion
has title: How to find root cause of NullPointerException / RuntimeException
has comment: http://stackoverflow.com/comment/40307846
tagged with: android
has answer: http://stackoverflow.com/a/25832219
has answer: http://stackoverflow.com/a/25774456
has comment: http://stackoverflow.com/comment/40308121
has comment: http://stackoverflow.com/comment/40307981
tagged with: java
has comment: http://stackoverflow.com/comment/40308078
has comment: http://stackoverflow.com/comment/40308175
type: Question
has comment: http://stackoverflow.com/comment/40308250
has comment: http://stackoverflow.com/comment/40307792
has comment: http://stackoverflow.com/comment/40308106
tagged with: debugging
has comment: http://stackoverflow.com/comment/40307808
has comment: http://stackoverflow.com/comment/40308205
has comment: http://stackoverflow.com/comment/40308054
has body: Google Play Games Services crashses my game when I log out and back in (using GameHelper). I've been through every line of code and I cannot find a single problem (There is no crash when I'm NOT using Google Game Services). But when I run my game, with BaseGameUtils library, and using GameHelper to log out, when I log back in the Android app crashes everytime with this error: I've been troubleshooting this crash for 3 days and I'm at a complete loss. Any advice how to troubleshoot or debug this error is appreciated. 09-10 13:51:03.419: E/AndroidRuntime(9463): FATAL EXCEPTION: main 09-10 13:51:03.419: E/AndroidRuntime(9463): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nurfacegames.testgame07/com.nurfacegames.testgame07.TestGame07}: java.lang.NullPointerException 09-10 13:51:03.419: E/AndroidRuntime(9463): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1696) 09-10 13:51:03.419: E/AndroidRuntime(9463): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1716) 09-10 13:51:03.419: E/AndroidRuntime(9463): at android.app.ActivityThread.access$1500(ActivityThread.java:124) 09-10 13:51:03.419: E/AndroidRuntime(9463): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:968) 09-10 13:51:03.419: E/AndroidRuntime(9463): at android.os.Handler.dispatchMessage(Handler.java:99) 09-10 13:51:03.419: E/AndroidRuntime(9463): at android.os.Looper.loop(Looper.java:130) 09-10 13:51:03.419: E/AndroidRuntime(9463): at android.app.ActivityThread.main(ActivityThread.java:3806) 09-10 13:51:03.419: E/AndroidRuntime(9463): at java.lang.reflect.Method.invokeNative(Native Method) 09-10 13:51:03.419: E/AndroidRuntime(9463): at java.lang.reflect.Method.invoke(Method.java:507) 09-10 13:51:03.419: E/AndroidRuntime(9463): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 09-10 13:51:03.419: E/AndroidRuntime(9463): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 09-10 13:5…
has comment: http://stackoverflow.com/comment/40307787

http://stackoverflow.com/comment/40236754
has text: For example, 15:00:00 in Server, and 12:00:00 in my laptop. Then there is 3 hour difference. So, I want to get some message from server at 14:00:00. Then, I can set up timer 17:00:00 on Server.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25734931
type: AnswerComment

http://stackoverflow.com/comment/40308285
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25774019
has text: No, I have the exact same XML files as I did before, in a previous version of Google Play Game Services, when it work flawlessly. This error is since the API has been updated.

http://stackoverflow.com/q/25830067
type: Question
answer count: 2
tagged with: jsp
tagged with: servlets
score: 0
has body: I want to include lines of jsp code into another jsp file, where the servlet only sees appended lines of code from both files. I wan it to build the file all at once, rather than included page first and then the parent page. What I've done: I had server errors when I used include file. It built the included page first when I used the include page. Tried templating with tags but I kept getting the error shown below, but all the code was copied and pasted from another stackoverflow answer. HTTP Status 500 - /web/templateTest.jsp (line: 4, column: 0) No tag "genericpage" defined in tag library imported with prefix "t" I mostly just want my question answered, that being whether or not there is a way to include files so that they are read as a whole. However it would be nice to know what i'm doing wrong with the tags if someone can identify it. this is my templateTest.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@taglib prefix="t" tagdir="/WEB-INF/tags" %> <t:genericpage> <jsp:attribute name="header"> Welcome </jsp:attribute> <jsp:attribute name="footer"> Copyright 1927, Future Bits When There Be Bits Inc. </jsp:attribute> <jsp:body> Hi I'm the heart of the message </jsp:body> </t:genericpage> below is my genericpage.tag file in the WEB-INF/tags folder <%@tag description="Overall Page template" pageEncoding="UTF-8"%> <%@attribute name="header" fragment="true" %> <%@attribute name="footer" fragment="true" %> <jsp:invoke fragment="header"/> <jsp:doBody/> <jsp:invoke fragment="footer"/> I'll say it again, I mostly just want my question answered, that being whether or not there is a way to include files so that they are read as a whole. However it would be nice to know what I'm doing wrong with the tags if someone can identify it.
has answer: http://stackoverflow.com/a/25830257
type: UnansweredQuestion
has title: add jsp file to another jsp file and have the servlet read it as a whole,
has comment: http://stackoverflow.com/comment/40410111
has answer: http://stackoverflow.com/a/25831156
tagged with: java

http://stackoverflow.com/comment/40536874
has text: So, the issue isn't the driver waiting on the Click. The issue is the next statement. There is no element to which you can Send Keys. You could try using a separate Input simulator to press the Escape key.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25879993

http://stackoverflow.com/comment/40196660
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25713884
has text: @m4rtin - i just included the publicationVo class. And yes the transient variable has a getter method
type: Comment

http://stackoverflow.com/comment/40264484
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25746846
has text: @user3135761: Please have a look at [example5](http://stackoverflow.com/a/25627775/1057230), on this link. Use [Action](http://docs.oracle.com/javase/tutorial/uiswing/misc/action.html) instead of `ActionListener` Hopefully it might will help somewhat.

http://stackoverflow.com/q/25774736
score: -1
has body: I have a class with day,month. I insert random dates and after I sorted it looks like that? Why? 1/9 2/9 3/9 7/9 9/9 10/9 5/9 11/9 I getting the "time" by getting it from database and i return the data as ArrayList Code: public ArrayList&lt;ClockModel&gt; getDay(String workName){ try { open(); ArrayList&lt;ClockModel&gt; list = new ArrayList&lt;ClockModel&gt;(); Cursor c = null; c = myDb.query(TABLE_DAY, null,"workName = ?", new String[] {workName}, null, null, null); while (c.moveToNext()) { Clock clock = new Clock( c.getInt(0), //id c.getString(1),//workName c.getInt(2), //dateDay c.getInt(3),//dateMouth c.getInt(4),//dateYear ); Collections.sort(list,dateCompare); list.add(clock); } return list; } catch (Exception e) { return null; }finally{ close(); } } Comparator&lt;ClockModel&gt; dateCompare = new Comparator&lt;ClockModel&gt;() { @Override public int compare(ClockModel o1, ClockModel o2) { int dd1 = o1.getDateDay(); int mm1 = o1.getDateMonth(); int dd2 = o2.getDateDay(); int mm2 = o2.getDateMonth(); if (mm1 &gt; mm2) { return 1; } else if (mm1 &lt; mm2) { return -1; } else { // == if (dd1 &gt; dd2) { return 1; } else if (dd1 &lt; dd2) { return -1; } else { return 0; } } } };
has answer: http://stackoverflow.com/a/25775062
upvote count: 0
answer count: 1
tagged with: sorting
favorite count: 0
has comment: http://stackoverflow.com/comment/40309609
tagged with: android
accepted answer: http://stackoverflow.com/a/25775062
downvote count: 1
type: Question
type: AnsweredQuestion
has title: Comparator not sorted my class with dates
tagged with: java

http://stackoverflow.com/comment/40236161
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25734828
has text: The following code (par of the program) searches for a single number by binary search.
score: 0

http://stackoverflow.com/q/25872563
accepted answer: http://stackoverflow.com/a/26005050
type: Question
has title: App oddities when the app is cleared from the cache
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
tagged with: android-studio
has answer: http://stackoverflow.com/a/26005050
upvote count: 1
has body: Hello all and thanks for reading. This question is kind of a follow on question from my original post here. https://stackoverflow.com/questions/25828412/main-activity-progress-bars-and-strike-through-text-reset-after-a-period-of-app. However, I've now worked out what's going on but still need some advice on how to solve it. Just to recap... Basically I have written a media player app that uses a number of standard progress bars which are created programmatically underneath each track title in the playlist. Each progress bar tracks the progress of the song its sits underneath in the playlist. I also use the following code in my manifest to make sure the app always returns to the same main activity. android:alwaysRetainTaskState="true" android:launchMode="singleTask" Now the problem I have is that when the user returns to the home screen and then relaunches the app after a period of 30 to 60 minutes although everything else is as it was - if the progress bar was only partially full (i.e. the track has been paused or stopped halfway through) all of a sudden its jumped to 100%. I discovered that this happens when the apps cached process is bumped off the end of the list by other apps. I.e. I can recreate the issue straight away by pausing the app and then opening loads of other apps and then going back to it. I also noticed that when it no longer appears in the cached process list "oncreate" also gets called so it looks like the app has been closed and its essentially recreating the activity. However, what is odd is that the progress bars that have previously been set to some value suddenly get recreated with progress set to 100%. Progress Now if they are being recreated surely their progress should default to 0? I even tried setting the progress when they are created to 0 (i.e. myprogbar.setProgress=(0) but this seemed to make no difference. How can I... a. Ensure that the progress bars are set to 0 when they are created? b. Check during oncreate if the app is already …
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/40492217
comment on: http://stackoverflow.com/q/25873131
has text: Please edit your question to include a [short, complete example](http://stackoverflow.com/help/mcve) that shows your current approach.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25741538
has body: I have problem with flicker images.how to get all images in flicker to my android app via api through or any other please help me.i am make a simple app in flicker to android please help me thanks in advance.
type: UnansweredQuestion
tagged with: flicker
tagged with: java
has title: How to get picture from flicker to android app?
type: Question
has answer: http://stackoverflow.com/a/25741639
answer count: 1
score: 0
tagged with: android

http://stackoverflow.com/comment/40213604
type: Comment
has text: It solved my problem . Just add one more line before creating connection. connection.setAutoCommit(false); Thanks a lot.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25720667

http://stackoverflow.com/a/25839319
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/25839303
answers question: http://stackoverflow.com/q/25839303
has body: Swing is a single threaded environment. This means that if anything should block this thread, Swing will be unable to respond to new events, including paint requests and it will appear that you UI has been frozen...because it has... Take a look at Concurrency in Swing The simplest solution might be to spawn a new thread and run your loop within it... Start by writing a Runnable that handels the work you want done... public class MouseRunner implements Runnable { @Override public void run() { try { Robot robot = new Robot(); while (go) { robot.mouseMove(500, 500); robot.delay(1000); robot.mouseMove(500, 400); } } catch (AWTException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } Then when the user first clicks the button, create a Thread and start it... jb.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { go = !go; if (go) { jb.setText("Stop!"); Thread t = new Thread(new MouseRunner()); t.start(); } else { jb.setText("Start!"); } } }); Beware, your go variable is likely going to need to made volatile
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/38476765
upvote count: 2
type: Answer
has body: I know that this question is old, but I searched for an answer and have not found very much about this topic. I think you can rethrow the exception if you like to do so. Here is the sample code: public class Main extends Application { @Override public void start(Stage stage) { Task&lt;Void&gt; task = new Task&lt;Void&gt;() { @Override protected Void call() throws Exception { throw new IndexOutOfBoundsException(); } }; task.setOnSucceeded(evt -&gt; System.out.println("Task succeeded!")); task.setOnCancelled(evt -&gt; System.out.println("Task cancelled!")); task.setOnFailed(evt -&gt; { System.out.println("Task failed!"); if (task.getException() instanceof IndexOutOfBoundsException) { System.out.println("...with an IndexOutOfBoundsException"); } else if (task.getException() instanceof NumberFormatException) { System.out.println("...with a NumberFormatException"); } else { System.out.println("...with another, unexpected execption"); } }); VBox box = new VBox(); Scene scene = new Scene(box, 200, 200); stage.setScene(scene); stage.setTitle("Thread Example"); stage.show(); new Thread(task).start(); } public static void main(String[] args) { launch(args); } } Console-Output: Task failed! ...with a IndexOutOfBoundsException If an exception is thrown inside a task, then the task ends up in the state 'failed'. In the setOnFailed method you can handle the failure of the task. All code inside this method is on the application thread of JavaFX but you can rely on the exception of the task by task.getException(). Besides, this code only works with JavaFX (I tried to get the same output in a normal java app, but it did not work out).
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25863480
has comment: http://stackoverflow.com/comment/70053885

http://stackoverflow.com/comment/40327689
score: 1
comment on: http://stackoverflow.com/q/25785129
has text: Are you using Java 8?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40273718
type: QuestionComment
comment on: http://stackoverflow.com/q/25754732
has text: I haven't written enough Ant (though I've maintained it -- or Maven, I'm not absolutely sure which), but I presume that as in Make the answer is essentially what you've done -- depend upon the results of the previous step rather than on its execution per se. In Make, you'd set up the dependency so that the target was built if its output was absent or if the input dependencies were newer than the output.
score: 0
type: Comment

http://stackoverflow.com/comment/70697817
comment on: http://stackoverflow.com/a/25783312
has text: Did you manage to have success on that? We're creating a dev env with Docker and will be good to automatise the change of the Target Platform with our needs. Thanks
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25802010
has body: Here is template for how to setup the methods such that the algorithm can be worked on in a more clear and isolated manner (note how the task states for "several methods"). This will prevent some issues in the posted code such as the incorrect usage of curr (which did not related to characters at all) in the inner loop. The usage of the array for the letters makes the task itself more logical to focus on without needing to perform slicing and concatenation. static void scrambleAllWords(List&lt;String&gt; words) { // Iterate through the list of word applying the scramble // function and replacing the original item with the result. for (int i = 0; i &lt; words.size(); i++) { String scrambled = scrambleWord(words.get(i)); words.set(i, scrambled); } } static String scrambleWord(String word) { // Get the letters that make up the word char[] letters = word.toCharArray(); // Perform the algorithm on the letters // for (int i = 0; i &lt; .. // Create a new string from the now-scrambled letters return new String(letters); } The algorithm itself is rather simple and can be read as the following pseudo-code, which should be trivial to apply to letters as it is now an array clearly separated from the other cruft. for i in the range [0, the number of letters in the word - 1) if the letter at i is an 'A' and the following letter at i+1 is not an 'A' then swap the letter at i with the letter at i+1 and skip the next letter by advancing i by 1 (so that the current-now-next 'A' letter cannot be swapped again) otherwise do nothing
answers question: http://stackoverflow.com/q/25801823
score: 1
has comment: http://stackoverflow.com/comment/40385569
downvote count: 0
has comment: http://stackoverflow.com/comment/40376879
type: Answer
upvote count: 1

http://stackoverflow.com/comment/40472360
type: QuestionComment
has text: It seems that it's possible to change the dire where test report is generated in gradle v. `2.1`. Navigate to `$GRADLE_HOME/samples/testing/testReport` and there You can find example how it can be done.
score: 1
comment on: http://stackoverflow.com/q/25860528
type: Comment

http://stackoverflow.com/q/25782925
has comment: http://stackoverflow.com/comment/40325820
upvote count: 3
accepted answer: http://stackoverflow.com/a/27843858
tagged with: apache-spark
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/40328436
has body: I 'm using spark to read data of all files from HDFS in a single RDD from a directory and it's sub directories as well. I could not find any efficient method to do that. So I tried to write some customized code as shown below: public Object fetch(String source,String sink) { //reading data boolean isDir=new File(source).isDirectory(); System.out.println("isDir="+isDir); JavaRDD&lt;String&gt; lines; if(isDir) { lines=readFiles(new File(source).listFiles(), null); } else lines= sc.textFile(source); lines.saveAsTextFile(sink); return true; } public static JavaRDD&lt;String&gt; readFiles(File[] files,JavaRDD&lt;String&gt; lines) { for (File file : files) { if (file.isDirectory()) { readFiles(file.listFiles(),lines); // Calls same method again. } else { if(lines==null) lines=sc.textFile(file.getPath()); else { JavaRDD&lt;String&gt; r=sc.textFile(file.getPath()); lines.union(r); } } } return lines; } but this is not doing my expected job as isDir contains false telling that it's not a directory. Please can u guide me about what's wrong? and is there some efficient way to do this job? Thanks alot
has answer: http://stackoverflow.com/a/25785677
has answer: http://stackoverflow.com/a/27843858
has title: reading all files from HDFS recursively in spark java api
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/40220633
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/40220633
type: Question
tagged with: hadoop
tagged with: hdfs

http://stackoverflow.com/q/25808133
linked to: http://stackoverflow.com/q/25526833
has title: How to load large text file in JTextArea
duplicate of: http://stackoverflow.com/q/25526833
has comment: http://stackoverflow.com/comment/40373027
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40369546
type: UnansweredQuestion
tagged with: swing
has body: I want to load large text file quickly in a JTextArea using Swing components. I tried to load a 100MB file, and it loads within seconds. But when I try to load more than a 200MB file, it takes more than 5 minutes. How can I load large data files? For reading I use a BufferedReader and to display I use the setText() method from JTextArea.
has comment: http://stackoverflow.com/comment/40369414
tagged with: large-files
answer count: 0
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40391407
has comment: http://stackoverflow.com/comment/40369456
type: Question

http://stackoverflow.com/a/25741991
upvote count: 1
answers question: http://stackoverflow.com/q/25740680
type: Answer
downvote count: 0
score: 1
has body: In your example, the timeZoneFormatter is not formatting calendar1's timezone, but rather the timezone of an anonymous Date that was returned by calendar1.getTime(). It is this Date object that is being formatted. As a Date doesn't have a timezone, it is formatted according to the timezone of the formatter, which in this case is the default timezone.

http://stackoverflow.com/comment/40409429
score: 0
type: QuestionComment
type: Comment
has text: code-apprentice: tried with debugger, but couldn't come up with a solution.
comment on: http://stackoverflow.com/q/25829683

http://stackoverflow.com/q/25852092
has title: Liferay; Pass other param to jQuery UI aotocompleter
tagged with: java
type: Question
tagged with: liferay
tagged with: jquery
has answer: http://stackoverflow.com/a/25857462
score: 0
has body: I have a liferay portlet application and I have some jQuery autocompleters. This works fine, but I would like to pass some extra params. I know the names so I created a resourceURL with the params: &lt;portlet:resourceURL id="street" var="jsonStreetResourceUrl"&gt; &lt;portlet:param name="controller" value="true"/&gt; &lt;portlet:param name="term" value="termValue"/&gt; &lt;portlet:param name="userTerm" value="userTermValue"/&gt; &lt;/portlet:resourceURL&gt; and my page.tag has some simple autocompleter code $(document).ready(function() { $("#${comp}\\.targetField").each(function() { var that = this; $(that).autocomplete({ source: function(request, response) { $.ajax({ url : "${controllerURL}", dataType : "json", data : { term : request.term, userTerm: ???????? }, success : function(data) { response($.map(data.members, function(item) { return { label: item.name, value: item.name } })) } }) }, }); }); }); Is it possible to pass any userTerm to my controller? When I trying to get the params in contoller I always get userTermValue. String term = PortletRequestUtils.getStringParameter(request, "term"); // user defined value String userTerm= PortletRequestUtils.getStringParameter(request, "userTerm"); // =userTermValue I would like to use something like: userTerm: $("#${comp}\\.infoHolder").val() I read some articles and I found out that I cannot have dynamic number of params but si it possible to have dynamic value of a param?
answer count: 1
tagged with: jquery-autocomplete
type: UnansweredQuestion

string
tags question: http://stackoverflow.com/q/25818992
tags question: http://stackoverflow.com/q/25715535
tags question: http://stackoverflow.com/q/25715696
tags question: http://stackoverflow.com/q/25799212
tags question: http://stackoverflow.com/q/25757030
tags question: http://stackoverflow.com/q/25743753
tags question: http://stackoverflow.com/q/25813455
tags question: http://stackoverflow.com/q/25736486
tags question: http://stackoverflow.com/q/25789020
tags question: http://stackoverflow.com/q/25824706
tags question: http://stackoverflow.com/q/25852961
tags question: http://stackoverflow.com/q/25729872
tags question: http://stackoverflow.com/q/25841575
tags question: http://stackoverflow.com/q/25748992
tags question: http://stackoverflow.com/q/25826447
tags question: http://stackoverflow.com/q/25736467
tags question: http://stackoverflow.com/q/25722948
tags question: http://stackoverflow.com/q/25839740
tags question: http://stackoverflow.com/q/25721266
tags question: http://stackoverflow.com/q/25778086
tags question: http://stackoverflow.com/q/25747769
tags question: http://stackoverflow.com/q/25768927
tags question: http://stackoverflow.com/q/25831611
tags question: http://stackoverflow.com/q/25830822
tags question: http://stackoverflow.com/q/25858545
tags question: http://stackoverflow.com/q/25766736
tags question: http://stackoverflow.com/q/25718059
tags question: http://stackoverflow.com/q/25798422
tags question: http://stackoverflow.com/q/25824641
tags question: http://stackoverflow.com/q/25726425
tags question: http://stackoverflow.com/q/25768495
tags question: http://stackoverflow.com/q/25799242
tags question: http://stackoverflow.com/q/25805385
tags question: http://stackoverflow.com/q/25789477
tags question: http://stackoverflow.com/q/25856607
tags question: http://stackoverflow.com/q/25821886
tags question: http://stackoverflow.com/q/25720998
tags question: http://stackoverflow.com/q/25716179
tag name: string
tags question: http://stackoverflow.com/q/25737365
tags question: http://stackoverflow.com/q/25816333
tags question: http://stackoverflow.com/q/25840762
tags question: http://stackoverflow.com/q/25853393
tags question: http://stackoverflow.com/q/25854729
tags question: http://stackoverflow.com/q/25788242
tags question: http://stackoverflow.com/q/25828722
tags question: http://stackoverflow.com/q/25832445
tags question: http://stackoverflow.com/q/25787073
tags question: http://stackoverflow.com/q/25796111
tags question: http://stackoverflow.com/q/25859470
tags question: http://stackoverflow.com/q/25755862
tags question: http://stackoverflow.com/q/25731219
tags question: http://stackoverflow.com/q/25816429
tags question: http://stackoverflow.com/q/25748590
tags question: http://stackoverflow.com/q/25842777
tags question: http://stackoverflow.com/q/25821678
tags question: http://stackoverflow.com/q/25867154
tags question: http://stackoverflow.com/q/25818834
tags question: http://stackoverflow.com/q/25867350
tags question: http://stackoverflow.com/q/25714060
tags question: http://stackoverflow.com/q/25865228
type: Tag
tags question: http://stackoverflow.com/q/25817422
tags question: http://stackoverflow.com/q/25840850
tags question: http://stackoverflow.com/q/25794908
tags question: http://stackoverflow.com/q/25770561
tags question: http://stackoverflow.com/q/25747500
tags question: http://stackoverflow.com/q/25823125
tags question: http://stackoverflow.com/q/25821268
tags question: http://stackoverflow.com/q/25758085
tags question: http://stackoverflow.com/q/25761905
tags question: http://stackoverflow.com/q/25776665
tags question: http://stackoverflow.com/q/25791406
tags question: http://stackoverflow.com/q/25718799
tags question: http://stackoverflow.com/q/25870630
tags question: http://stackoverflow.com/q/25716422
tags question: http://stackoverflow.com/q/25754469
tags question: http://stackoverflow.com/q/25777561
tags question: http://stackoverflow.com/q/25861296
tags question: http://stackoverflow.com/q/25773308

http://stackoverflow.com/comment/40430035
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25840718
has text: `break` out of your for loop inside the if statement

http://stackoverflow.com/comment/40213250
type: AnswerComment
has text: Although you are correct, `trim()` only fixes the problem after the fact. IMHO it is better to **fix** `removeChar()` so that it doesn't return extraneous trailing characters.
type: Comment
comment on: http://stackoverflow.com/a/25722242
score: 0

http://stackoverflow.com/comment/40501512
comment on: http://stackoverflow.com/q/25867282
score: 0
type: Comment
type: QuestionComment
has text: Do you use hibernate or any other JPA like library? These libraries greatly slow down web app boot up time.

http://stackoverflow.com/comment/40425061
has text: Before the message containing "Enter four indices" add `for (int i = 0; i < 4; i++) {...}` or a `while` loop.
comment on: http://stackoverflow.com/q/25838125
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/68085206
score: 0
type: Comment
type: QuestionComment
has text: I have empty password in Java code. When I insert token to USB for first time and run Java application, popup window from token middleware is displayed and private key is accesible. But when I run application second and more times, application freezes. I must remove and insert token again.
comment on: http://stackoverflow.com/q/25774149

http://stackoverflow.com/q/25767169
tagged with: java
tagged with: jaxb
has answer: http://stackoverflow.com/a/25771135
type: Question
linked to: http://stackoverflow.com/q/23664516
downvote count: 0
has title: How to make JAXB call the setter AFTER adding Elements to an List?
answer count: 1
accepted answer: http://stackoverflow.com/a/25771135
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 3
has body: I have some data in an XML-file which i want to unmarshal with JAXB into MyHashMap. MyObject has an String name, which is the key in my HashMap. To prevent writing the key/name information twice into my XML-File (once as the name of MyObject and once as the key of MyHashMap), so i added setter and getter for an ArrayList, which add/read the data into/out of MyHashMap. @XmlRootElement public class MyHashMap extends HashMap&lt;String, MyObject&gt; implements Serializable { public MyHashMap() { super(); } @XmlElement(name = "MyObject") public void setMyObjectsArrayList(ArrayList&lt;MyObject&gt; MyObjectList) { for (MyObject myObject : MyObjectList) { this.put(myObject.getName(), myObject); } } public ArrayList&lt;MyObject&gt; getMyObjectsArrayList() { if (this.isEmpty()) { // Added this to get my setter called return null; } ArrayList&lt;MyObject&gt; MyObjectList = new ArrayList&lt;MyObject&gt;(); MyObjectList.addAll(this.values()); return MyObjectList; } } It worked fine in Java 7 (according to the andswer of this because of a bug ), but doesnt in Java 8. In Java 8 JAXB gets the ListObject and adds the Elemts instead of using the setter. So i added a "return null" if the list is empty. Apparently JAXB then sets an empty list and adds the Elements afterwards which obviously does not work with my code. Is there a possibility to tell JAXB to add the Elements to the list and call the setter only then?
upvote count: 3

http://stackoverflow.com/a/25843245
upvote count: 1
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25797966
has body: I have similar tasks like yours, but in XLSX format. Maybe my approach can help you: about a) you can use the code exception_handling logic (expected behavior, error codes) about b) and c) you can combine your code to validate a checksum (see here and here) of the files In my case I have report_generator which prints such results as execution_flow, regression etc. So as bottom line - yes this definitely must be put into the realm of test automation Cheers

http://stackoverflow.com/a/36701496
has body: As of version 1.6.0, class PorterStemmer is public and available for use. Enjoy!
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25815381
downvote count: 0
score: 1

preferences
tags question: http://stackoverflow.com/q/25822178
tags question: http://stackoverflow.com/q/25782956
tags question: http://stackoverflow.com/q/25739892
type: Tag
tag name: preferences
tags question: http://stackoverflow.com/q/25847609

http://stackoverflow.com/a/25766504
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
has body: Managed to fix the problem. My handheld device had the following in its build.gradle file: compile 'com.google.android.gms:play-services:5.+' I replaced this line with compile 'com.google.android.gms:play-services-wearable:+' and then it worked.
accepted answer of: http://stackoverflow.com/q/25763670
type: Answer
answers question: http://stackoverflow.com/q/25763670

http://stackoverflow.com/q/25872151
score: 1
tagged with: java
tagged with: itext
upvote count: 1
type: Question
downvote count: 0
has body: My goal is to take out the second page of a pdf and put the contents of another pdf inside of it. I have taken a look at other answers and I have written the code to delete the template page(page 2.) However, when I copy the other pages into a new book with the first set I get all sorts of insane cropping. It doesn't come out right. I tried to use the setpagesize option but it still doesn't seem like it is working. Am I going about this in the wrong fashion? package com.protocase.itexthelper; import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.pdf.PdfContentByte; import com.itextpdf.text.pdf.PdfImportedPage; import com.itextpdf.text.pdf.PdfReader; import com.itextpdf.text.pdf.PdfStamper; import com.itextpdf.text.pdf.PdfWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author davidh */ public class ITextHelper { public static void deletePage(String fileToPrune, int pageToDelete, String newFilePath) { PdfReader pdfReader = null; try { pdfReader = new PdfReader(fileToPrune); } catch (IOException ex) { Logger.getLogger(ITextHelper.class.getName()).log(Level.SEVERE, null, ex); } if (pdfReader != null) { List&lt;Integer&gt; pagesToKeep = new ArrayList&lt;Integer&gt;(); //pdfReader.getPages for (int i = 1; i &lt;= pdfReader.getNumberOfPages(); i++) { if (i != pageToDelete) { pagesToKeep.add(i); } } pdfReader.selectPages(pagesToKeep); } PdfStamper pdfStamper = null; try { pdfStamper = new PdfStamper(pdfReader, new FileOutputStream(newFilePath)); } catch (FileNotFoundException ex) { Logger.getLogger(ITextHelper.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException | IOException ex) { Logger.getLogger(ITextHelper.class.…
has comment: http://stackoverflow.com/comment/40508456
has title: How do I copy a pdf into another without losing page sizes and meta information?
answer count: 1
has answer: http://stackoverflow.com/a/25898084
linked to: http://stackoverflow.com/q/16471673
favorite count: 0
has comment: http://stackoverflow.com/comment/40498070
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25898084

http://stackoverflow.com/comment/40347769
has text: Thanks. Editing the properties using the Configuration object worked. I just had to handle a bundle start order issue.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25776472
type: AnswerComment

http://stackoverflow.com/comment/40214950
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25721354
has text: @CatalinaIsland I mean I don't know what property in Look&Feel need to change the centering tabs

http://stackoverflow.com/comment/40219991
type: Comment
type: QuestionComment
has text: No I'm not confused :). I stand corrected about 1.7 being 1.6 your link threw me off guard. I could swear that I have seen commits in Spring 4.1 regarding `ConstructorProperties` and data binding (but I must have dreamt that couldn't find them back). Although I can imagine that that would be problematic especially with complex objects/nested paths.
comment on: http://stackoverflow.com/q/25720135
score: 0

http://stackoverflow.com/q/25746349
downvote count: 0
answer count: 1
tagged with: baseadapter
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/25746768
has body: I'm learning Android SDK and I need some advices. I have custom ListView with BaseAdapter and I want to implement some new feature - Favorite Button. What I want to do is, when I press the Favorite Button, ListItem goes to the beginning of the list, Favorite image change and all that stuff will be saved in the SharedPrefs. Someone tell me what I need to do, to make it works? my existing code: row.xml: <?xml version="1.0" encoding="utf-8"?> <TextView android:id="@+id/label" android:paddingTop="20dp" android:layout_gravity="center_vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_weight="1" android:textAlignment="center" android:text="RadioName" android:textColor="@color/color1" android:textSize="30dp" /> <TextView android:id="@+id/label2" android:layout_gravity="center_vertical" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="fill_parent" android:textAlignment="center" android:text="Description.." android:textColor="@color/color1" android:textSize="15dp" /> BaseAdapter class: public class RadioAdapter extends BaseAdapter { ArrayList<RadioStation> myList = new ArrayList<RadioStation>(); LayoutInflater inflater; Context context; public RadioAdapter(Context context, ArrayList<RadioStation> myList) { this.myList = myList; this.context = context; inflater = LayoutInflater.from(this.context); } @Override public int getCount() { return myList.size(); } @Override public RadioStation getItem(int position) { return myList.get(position); } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { MyViewHolder mViewHolder; if(convertView == null) { convertView = inflater.inflate(R.layout.activity_menu_row, null); mViewHolder = new MyViewHolder(); convertView.setTag(mViewHolder); } else { mViewHolder = (MyViewHolder) convertView.getTag(); } mViewHolder.tvTitle = detail(convertView, R.id.label, myList.get(position).ge…
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: How to implement Favorite Button to my BaseAdapter ListView?
tagged with: android-layout
accepted answer: http://stackoverflow.com/a/25746768
tagged with: android-listview

http://stackoverflow.com/q/25760989
tagged with: runtime
has answer: http://stackoverflow.com/a/25761042
downvote count: 0
score: 1
favorite count: 0
tagged with: classloader
accepted answer: http://stackoverflow.com/a/25761042
has answer: http://stackoverflow.com/a/25761076
has answer: http://stackoverflow.com/a/25761050
answer count: 4
type: AnsweredQuestion
has body: Assume there are two jars, both contain same class file with same fully qualified name. Now how JRE sees them, will it throw runtime exception? which I couldn't see in my testing. How it picks up the class/which will be loaded and which one will be neglected?
possible better answer: http://stackoverflow.com/a/25761050
tagged with: java
upvote count: 1
type: Question
has title: How JRE picks up the duplicate classes
has answer: http://stackoverflow.com/a/25761051

http://stackoverflow.com/comment/40229517
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25725991
has text: Sorry, I edited the question and added the stacktrace

http://stackoverflow.com/comment/40263396
score: 0
type: Comment
type: QuestionComment
has text: Instead of using alpha blending you could try using stencil testing. You would render the cutout shapes first into the stencil buffer and then draw the black square with stencil testing enabled so that only the parts that don't have a cutout shape already drawn appear black.
comment on: http://stackoverflow.com/q/25735363

http://stackoverflow.com/comment/122322812
score: 0
has text: In COR, if the request cannot be handled by a component then only it goes to next in command. But in this case, OP wants it to pass through all the components. So, a pipeline or state pattern might be well suited.
comment on: http://stackoverflow.com/a/25723149
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25729204
downvote count: 0
possible better answer: http://stackoverflow.com/a/32476058
has comment: http://stackoverflow.com/comment/40799227
has body: I'm experimenting with deriving sentiment from Twitter using Stanford's CoreNLP library, a la https://www.openshift.com/blogs/day-20-stanford-corenlp-performing-sentiment-analysis-of-twitter-using-java - so see here for the code that I'm implementing. I am getting results, but I've noticed that there appears to be a bias towards 'negative' results, both in my target dataset and another dataset I use with ground truth - the Sanders Analytics Twitter Sentiment Corpus http://www.sananalytics.com/lab/twitter-sentiment/ - even though the ground truth data do not have this bias. I'm posting this question on the off chance that someone else has experienced this and/or may know if this is the result of something I've done or some bug in the CoreNLP code. (edit - sorry it took me so long to respond) I am posting links to plots showing what I mean. I don't have enough reputation to post the images, and can only include two links in this post, so I'll add the links in the comments.
has answer: http://stackoverflow.com/a/32476058
favorite count: 0
type: Question
tagged with: sentiment-analysis
tagged with: nlp
has answer: http://stackoverflow.com/a/27223793
answer count: 2
score: 5
has comment: http://stackoverflow.com/comment/40281649
has title: Bias towards negative sentiments from Stanford CoreNLP
upvote count: 5
tagged with: java
tagged with: twitter
accepted answer: http://stackoverflow.com/a/27223793
type: AnsweredQuestion
tagged with: stanford-nlp

http://stackoverflow.com/a/25815412
type: Answer
downvote count: 0
score: 1
has body: Loop over the characters in the array to ensure that each character class is contained within. Then, if it fails, just generate a new random string. This ensures that all are contained and will not fail to validate very often.
upvote count: 1
answers question: http://stackoverflow.com/q/25815318

http://stackoverflow.com/a/25920060
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25813974
downvote count: 0
has body: I apparently screwed up the project perhaps because of the project identifier. Now I copied exactly the one I had in Eclispe and at least now the errors are a bit friendlier. Of course I first had to add to build.gradle: dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.google.android.gms:play-services:+' compile 'com.android.support:appcompat-v7:20.+' } I will be back at you if I am not able to understand the reason for the new errors, now apparently mostly affecting the references to R resources and the GCMRegistrar. For tonight, anyway, I am happy enough.

http://stackoverflow.com/q/25728995
tagged with: http://stackoverflow.com/tag/c
has comment: http://stackoverflow.com/comment/40224856
tagged with: android-binder
has comment: http://stackoverflow.com/comment/40231632
has comment: http://stackoverflow.com/comment/40230704
has comment: http://stackoverflow.com/comment/40225593
has comment: http://stackoverflow.com/comment/114852323
favorite count: 0
has title: Android - "service list" vs "dumpsys activity services"
has comment: http://stackoverflow.com/comment/40230160
answer count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
has body: What are the differences between the services shown by these commands? How can I start a Service from normal Java classes and see it in "service list" to be able to access it from another native process to share data? I have a native (C/C++ Code) binary running on the device and want it to connect to a service started in java. I already used the binder interface to share things between two different native applications. But is there a way to go directly up to java? (JNI might not work cause the binary has other permissions and is running long ago when the Java-App starts. When the app starts the service, the native code will automatically connect and start sending data.) I have code where the native code starts a service and the Java part connects to. But in this case I do not have permissions to create services in the native part. But I can connect to an already running one.
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/40231081
type: Question
has comment: http://stackoverflow.com/comment/40225692
tagged with: ipc
downvote count: 0

http://stackoverflow.com/a/25817443
has comment: http://stackoverflow.com/comment/40405753
has comment: http://stackoverflow.com/comment/40389838
has body: Try such pattern: store all characters in set iterate over set and print characters that are common for all strings sample code (if I understand you properly) public static void main(String[] args) { List&lt;String&gt; x = new ArrayList&lt;String&gt;(); x.add("abcdef"); x.add("bcdefg"); x.add("bbccff"); Set&lt;Character&gt; all = new HashSet&lt;Character&gt;(); for (String s : x) { for (int i = 0; i &lt; s.length(); i++) { all.add(s.charAt(i)); } } for (Character c : all) { if (charIsCommon(c, x)) { System.out.println(c); } } } /* * return true only if each string in [list] contains character [c] */ private static boolean charIsCommon(char c, List&lt;String&gt; list) { for (String s : list) { if (s.indexOf(c) &lt; 0) { return false; } } return true; }
upvote count: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25817236
has comment: http://stackoverflow.com/comment/40388180
answers question: http://stackoverflow.com/q/25817236
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/q/25802459
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40360650
has comment: http://stackoverflow.com/comment/40360815
has comment: http://stackoverflow.com/comment/40360876
upvote count: 1
accepted answer: http://stackoverflow.com/a/25803132
tagged with: recursion
has comment: http://stackoverflow.com/comment/40359825
type: AnsweredQuestion
tagged with: math
tagged with: java
tagged with: probability
downvote count: 1
has title: Listing the total sum of all possible sums in a set with constraints
type: Question
has body: I am keen to find out the following: Given a set with N elements, my friend and I are playing a game.I always make the first move. We can only remove either the first or the last element with 50% chance each.We take alternate turns in the game.If only one element remains,we can remove it for sure.What is the expected sum that I can collect? For example:N=2 {10,20} Possible sets that I can collect are {10},{20}. So expected sum is 0.5*10+0.5*20=15. My approach: Since probability of getting a possible sum is equal in all cases,we only need to compute the sum of all possible sums and then multiply it by (0.5)^N/2. I tried to use recursion to compute the required sum: f(i,j)-computes the sum between i and j recursively f(i,j)=2*a[i]+func(i,j-2)+func(i+1,j-1)+func(i+1,j-1)+func(i+2,j)+2*a[j]); Initial call f(1,N) But the approach doesn't seem to work. What should I do? Complete function is below: class CandidateCode { static long v[][] = new long[1003][1003]; public static long func(int a[], int i, int j) { if (i == j) return v[i][j] = a[i]; if (v[i][j] != 0) return v[i][j]; else { if (i &gt; j - 2 &amp;&amp; i + 1 &gt; j - 1 &amp;&amp; i + 2 &gt; j) return (v[i][j] += 2 * a[i] + 2 * a[j]); else return (v[i][j] += 2 * a[i] + func(a, i, j - 2) + func(a, i + 1, j - 1) + func(a, i + 1, j - 1) + func(a, i + 2, j) + 2 * a[j]); } } public static void main(String args[]) { int n; int a[] = { 0, 6, 4, 2, 8 }; n = a.length - 1; System.out.println(func(a, 1, 4) / Math.pow(2, n / 2)); } }
has comment: http://stackoverflow.com/comment/40360810
tagged with: expectations
score: 0
has answer: http://stackoverflow.com/a/25803132

http://stackoverflow.com/comment/40323389
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25782407
has text: @Raghunandan, I've just updated my post, posting `activity_main.xml` and `list_item.xml`.
score: 0

http://stackoverflow.com/comment/40280295
type: Comment
comment on: http://stackoverflow.com/a/25758498
type: AnswerComment
has text: Is it in your war in the directory WEB-INF/lib ?
score: 0

http://stackoverflow.com/comment/40613073
type: QuestionComment
has text: @Thufir if your service really needs to be called remotely, try using REST or SOAP
score: 0
comment on: http://stackoverflow.com/q/25825075
type: Comment

http://stackoverflow.com/comment/40233645
comment on: http://stackoverflow.com/a/25731838
type: AnswerComment
score: 0
type: Comment
has text: @user3369920 is this awnser worked for you don't forget to accept it

http://stackoverflow.com/a/25801051
score: 1
has comment: http://stackoverflow.com/comment/40357938
accepted answer of: http://stackoverflow.com/q/25800955
has body: The first case prints out 1, 100 because it's getting the value of the VARIABLE Something like: Get the value of x in A and get the value of x in C Overriding happens only to METHODS not with VARIABLES. That's why in your second case it invokes the method inside the B1 instead of the A1 This is called Runtime Polymorphism. EDIT 2: Let me explain it further: When we are invoking a method, at runtime, instead of looking at the reference variable's type, the JVM looks at the object's type and run that method. But with variables, it's the other way around, instead of looking at the object's type, the JVM looks at the reference variable's type, and get that variable Given the following example: class Animal { String whatAmI = "An Animal"; public void sayHi() { System.out.println("Hi from Animal"); } } class Dog extends Animal { String whatAmI = "A Dog"; public void sayHi() { System.out.println("Hi from Dog"); } } Sample run: //Reference variable type //Object type Animal anAnimal = new Animal(); Dog aDog = new Dog(); Animal anotherDog = new Dog(); anAnimal.sayHi(); //Hi from Animal aDog.sayHi(); //Hi from Dog anotherDog.sayHi(); //Hi from Dog We get these output because the JVM invoked the sayHi() method on the Object's type not the Reference variable's type. But the thing is, it doesn't work the same way with variables. If we try something like: System.out.println(anAnimal.whatAmI); //An Animal System.out.println(aDog.whatAmI); //A Dog System.out.println(anotherDog.whatAmI); //An Animal We have these output because the JVM get the whatAmI variable from the Reference variable's type. A technique to remember this is to focus on the equal (=) sign. When invoking a method, invoke the method on the right side of the equal (=) sign. When getting a variable, get the variable on the left side of the equal (=) sign.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25800955
has comment: http://stackoverflow.com/comment/40357613
has comment: http://stackoverflow.com/comment/40357889
type: Answer
has comment: http://stackoverflow.com/comment/40358393
has comment: http://stackoverflow.com/comment/40360801
upvote count: 1

http://stackoverflow.com/comment/52414669
type: Comment
comment on: http://stackoverflow.com/a/25729338
has text: One other thing: we had a problem this week with this. Thought I'd give a heads up. I had dependency on SQL Server and MySQL jars; for our project it's an either or situation: we don't need both in any one client build. Having two did create a problem: I was getting no driver found errors: Having only one jar in the final shade fixed the problem.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40309502
type: AnswerComment
has text: it's how you got the pattern "For this specific S it turns out each number is just the sum of the preceding three numbers"
type: Comment
comment on: http://stackoverflow.com/a/25773380
score: 0

http://stackoverflow.com/a/25798721
has body: It's necessary to specify that you want to assign the value to the field, rather than the parameter or local variable: public void setFoo(Foo foo) { this.foo = foo; ^ ^ | \--- Take the value of the parameter \---- Assign to the field } If you just wrote: foo = foo; in the above, then it wouldn't do anything - it would be assigning the value of the parameter back to the parameter. Another option, however, is to use a different parameter name instead: public void setFoo(Foo newFoo) { foo = newFoo; } Now the field and the parameter have different names, so you don't need to find another way to differentiate between them.
answers question: http://stackoverflow.com/q/25798710
type: Answer
upvote count: 1
downvote count: 1
score: 0

http://stackoverflow.com/comment/40476015
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25866361
has text: About.class and your main activiy
score: 0

http://stackoverflow.com/comment/40312641
score: 0
type: Comment
has text: @KickButtowski you should tell me what input you think will cause this to fail.
type: AnswerComment
comment on: http://stackoverflow.com/a/25776383

http://stackoverflow.com/q/25761968
tagged with: ruby-on-rails
linked to: http://stackoverflow.com/q/4294229
type: Question
has comment: http://stackoverflow.com/comment/40285951
score: 1
tagged with: java
downvote count: 0
has body: I started to learn about how to make an Android application. I tried to connect my app to rails server by using httpclient, however I cannot understand how to connect between app and the remote server. Here is part of my code, and I matched id form inside "BasicNameValuePair" with html id values. Please let me know how to check whether login is successful or not. class SendPost extends AsyncTask&lt;Void, Void, String&gt; { protected String doInBackground(Void... unused) { String content = executeClient(); return content; } protected void onPostExecute(String result) { } public String executeClient() { ArrayList&lt;NameValuePair&gt; post = new ArrayList&lt;NameValuePair&gt;(); post.add(new BasicNameValuePair("user_name", "SallyCook")); post.add(new BasicNameValuePair("user_email", "domain@ppls.kr")); post.add(new BasicNameValuePair("user_password", "add123456")); post.add(new BasicNameValuePair("user_password_confirmation", "add123456")); post.add(new BasicNameValuePair("user_phone", "01013089579")); HttpClient client = new DefaultHttpClient(); HttpParams params = client.getParams(); System.out.println(params); HttpConnectionParams.setConnectionTimeout(params, 5000); HttpConnectionParams.setSoTimeout(params, 5000); HttpPost httpPost = new HttpPost("http://www.ppls.kr/users/sign_up"); try { UrlEncodedFormEntity entity = new UrlEncodedFormEntity(post, "UTF-8"); httpPost.setEntity(entity); HttpResponse responsePost = client.execute(httpPost); System.out.println(responsePost.getStatusLine()); HttpEntity resEntity=responsePost.getEntity(); if (resEntity != null) { Log.w("RESPONSE", EntityUtils.toString(resEntity)); } return EntityUtils.getContentCharSet(entity); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } }
favorite count: 0
tagged with: android
has title: Android httpclient login to Rails server
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/40345638
comment on: http://stackoverflow.com/q/25794733
type: Comment
has text: By full example, what do you mean? There are many more implementations of Item which I have. Its basically a normal POJO. No magic
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40211583
type: QuestionComment
comment on: http://stackoverflow.com/q/25721899
has text: try `panel.setPreferredSize( new Dimension( 600, 30*x ) );` where x is num of rows
score: 0
type: Comment

http://stackoverflow.com/a/25863329
answers question: http://stackoverflow.com/q/25863249
has comment: http://stackoverflow.com/comment/40472420
score: 0
has body: If you use the anchors ^, $ in your code, you need to include the multiline (?m) modifier or DOTALL (?s) modifier. String str = "ER430;000000000;\n" + "ADR03;000000020;\n" + "RID01;000000000;\n" + "RID02;000000000;"; System.out.println(str.replaceAll("(?s)(?&lt;=\n|^)[^R][^;\n]*?;[^;\n]*;(\n|$)", "")); Output: RID01;000000000; RID02;000000000; OR System.out.println(str.replaceAll("(?m)(?&lt;=\n|^)[^R][^;\n]*?;[^;\n]*;(\n|$)", ""));
type: Answer

http://stackoverflow.com/comment/40498326
type: QuestionComment
score: 0
has text: The logs say your request is not authenticated. Probably because you didn't authenticate the request. Either you didn't install the client credentials token endpoint filter (best not to - use Basic auth like it recommends in the spec), or your authentication manager doesn't know if it relates to clients or users (why did you add 2 user details services? only one is going to count).
comment on: http://stackoverflow.com/q/25860198
type: Comment

http://stackoverflow.com/a/25768019
downvote count: 1
has comment: http://stackoverflow.com/comment/40297441
has comment: http://stackoverflow.com/comment/40296913
score: -1
has comment: http://stackoverflow.com/comment/40327707
has body: That's not a supported way of launching a JavaFX Application. (I can't tell you the exact details of why it is failing without the stack trace.) The launch method will instantiate a new instance of your Application class for you, start the JavaFX subsystem, and execute the start(...) method. You should consider the start(...) method the entry point in your application (in fact, in Java 8, you can launch an Application subclass from the command line even if it has no main(...) method at all). If you want to make your Charts class reusable, so it can be launched from a variety of places, either make it a subclass of something that can be placed in a Scene, or give it an accessor method for such an object. Subclasses of Application have a specific function as the "startup class" of a JavaFX application. E.g. public class Charts { private Parent content ; public Charts() { final NumberAxis xAxis = new NumberAxis(); final NumberAxis yAxis = new NumberAxis(); xAxis.setLabel("Number of Month"); // ... etc etc series.getData().add(new XYChart.Data(12, 25)); content = new StackPane(); content.getChildren().add(lineChart); } public Parent getContent() { return content ; } } And then you can create application classes which use this with public class MyChartApp extends Application { @Override public void start(Stage primaryStage) { primaryStage.setTitle("My chart app"); Charts c = new Charts(); Scene scene = new Scene(c.getContent(), 800, 600); primaryStage.setScene(scene); primaryStage.show(); } } You could add some utility methods such as public Scene createScene() { return new Scene(content, 800, 600); } and public void configureStage(Stage stage) { stage.setScene(createScene()); } to the Charts class if you want/need. Then (of course) your start(...) method could be reduced to public void start(Stage primaryStage) { new Charts().configureStage(primaryStage); primaryStage.show(); }
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25767221
has comment: http://stackoverflow.com/comment/40325847

http://stackoverflow.com/q/25869428
has answer: http://stackoverflow.com/a/47127155
has answer: http://stackoverflow.com/a/71051362
has answer: http://stackoverflow.com/a/64113385
has answer: http://stackoverflow.com/a/31579156
has answer: http://stackoverflow.com/a/60395682
has answer: http://stackoverflow.com/a/71018931
has body: Having this problem both in Spring Boot 1.1.5 and 1.1.6 - I'm loading a classpath resource using an @Value annotation, which works just fine when I run the application from within STS (3.6.0, Windows). However, when I run a mvn package and then try to run the jar, I get FileNotFound exceptions. The resource, message.txt, is in src/main/resources. I've inspected the jar and verified that it contains the file "message.txt" at the top level (same level as application.properties). Here's the application: @Configuration @ComponentScan @EnableAutoConfiguration public class Application implements CommandLineRunner { private static final Logger logger = Logger.getLogger(Application.class); @Value("${message.file}") private Resource messageResource; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @Override public void run(String... arg0) throws Exception { // both of these work when running as Spring boot app from STS, but // fail after mvn package, and then running as java -jar testResource(new ClassPathResource("message.txt")); testResource(this.messageResource); } private void testResource(Resource resource) { try { resource.getFile(); logger.debug("Found the resource " + resource.getFilename()); } catch (IOException ex) { logger.error(ex.toString()); } } } The exception: c:\Users\glyoder\Documents\workspace-sts-3.5.1.RELEASE\classpath-resource-proble m\target&gt;java -jar demo-0.0.1-SNAPSHOT.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v1.1.5.RELEASE) 2014-09-16 08:46:34.635 INFO 5976 --- [ main] demo.Application : Starting Application on 8W59XV1 with PID 5976 (C:\Users\glyo der\Documents\workspace-sts-3.5.1.RELEASE\classpath-resource-problem\target\demo -0.0.1-SNAPSHOT.jar started by glyoder in c:\Users\glyoder\Documents\workspace-s ts-3…
type: Question
upvote count: 211
possible better answer: http://stackoverflow.com/a/36548873
answer count: 17
has answer: http://stackoverflow.com/a/36548873
favorite count: 0
has answer: http://stackoverflow.com/a/42370282
has answer: http://stackoverflow.com/a/70190446
has title: Classpath resource not found when running as jar
has answer: http://stackoverflow.com/a/38548566
score: 211
downvote count: 0
has answer: http://stackoverflow.com/a/77369055
has answer: http://stackoverflow.com/a/48764657
has answer: http://stackoverflow.com/a/63592519
type: AnsweredQuestion
tagged with: spring-boot
has answer: http://stackoverflow.com/a/25873705
has answer: http://stackoverflow.com/a/37202824
has answer: http://stackoverflow.com/a/74235286
accepted answer: http://stackoverflow.com/a/25873705
has answer: http://stackoverflow.com/a/61079784
tagged with: java

http://stackoverflow.com/q/25733591
upvote count: 14
tagged with: java
tagged with: hibernate
type: Question
has body: I don't know what else to try, I've updated to Jackson 2, changed to Lazy, used @JsonIgnore... but nothing worked out. Any idea what can it be? Environment Spring MVC 3.2.5 Jackson 2.2 Hibernate 3.5.4 ERROR Estado HTTP 500 - Could not write JSON: failed to lazily initialize a collection of role: com.javalabs.web.dao.Task.actions, no session or session was closed (through reference chain: java.util.HashMap["actions"]->java.util.ArrayList[0]->com.javalabs.web.dao.TaskAction["task"]->com.javalabs.web.dao.Task["actions"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: failed to lazily initialize a collection of role: com.javalabs.web.dao.Task.actions, no session or session was closed (through reference chain: java.util.HashMap["actions"]->java.util.ArrayList[0]->com.javalabs.web.dao.TaskAction["task"]->com.javalabs.web.dao.Task["actions"]) Error trace org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: failed to lazily initialize a collection of role: com.javalabs.web.dao.Task.actions, no session or session was closed (through reference chain: java.util.HashMap["actions"]-&gt;java.util.ArrayList[0]-&gt;com.javalabs.web.dao.TaskAction["task"]-&gt;com.javalabs.web.dao.Task["actions"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: failed to lazily initialize a collection of role: com.javalabs.web.dao.Task.actions, no session or session was closed (through reference chain: java.util.HashMap["actions"]-&gt;java.util.ArrayList[0]-&gt;com.javalabs.web.dao.TaskAction["task"]-&gt;com.javalabs.web.dao.Task["actions"]) org.springframework.http.converter.json.MappingJackson2HttpMessageConverter.writeInternal(MappingJackson2HttpMessageConverter.java:207) org.springframework.http.converter.AbstractHttpMessageConverter.write(AbstractHttpMessageConverter.java:179) org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor.writeWithMessageConverters(AbstractMes…
has title: Failed to lazily initialize a collection.. no session or session was closed
tagged with: session
possible better answer: http://stackoverflow.com/a/35655149
tagged with: jackson
has comment: http://stackoverflow.com/comment/40234094
has answer: http://stackoverflow.com/a/35655149
has answer: http://stackoverflow.com/a/25733784
downvote count: 0
has answer: http://stackoverflow.com/a/25752684
favorite count: 0
linked to: http://stackoverflow.com/q/10065002
has comment: http://stackoverflow.com/comment/40234170
answer count: 5
has answer: http://stackoverflow.com/a/48753052
has answer: http://stackoverflow.com/a/31968042
tagged with: spring
score: 14
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25733784

http://stackoverflow.com/comment/40495586
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25834245
has text: For reference purposes I've printscreened that section from the book and paste it here (as google books seems to change its preview pages now and then): http://imgur.com/zYnwEWc

http://stackoverflow.com/q/25716058
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: bitmap
has body: I'm attempting to read JSON files from a web server and translate them into bitmap images for a listview. The problem is I'm tried this example, but trying to create a file system directory: "resolveUri failed on bad bitmap uri" when putting image on ListView ; This may be an incorrect path/technique? I receive a malformedURI Execption and when I try to just use the regular JSON string for the image, I receive the badURI Exception. Any ideas as to how to get the JSON feed to decode it properly would be appreciated. The JSON feed is here: http://shipstudent.com/complaint_desk/androidcentralwall.php if you want to see the profile picture tag. Please let me know if you need more information. public void updateJSONdata() { mCommentList = new ArrayList<HashMap<String, String>>(); JSONParser jParser = new JSONParser(); JSONObject json = jParser.getJSONFromUrl(READ_COMMENTS_URL); try { allPosts = json.getJSONArray(TAG_POSTS); // looping through all posts according to the json object returned for (int i = 0; i < allPosts.length(); i++) { JSONObject c = allPosts.getJSONObject(i); // gets the content of each tag String title = c.getString(TAG_TITLE); String content = c.getString(TAG_MESSAGE); String username = c.getString(TAG_USERNAME); File sdCard = Environment.getExternalStorageDirectory(); String profile_picture = c.getString(loadImageFromWebOperations(TAG_PROFILE_PICTURE,sdCard.getAbsolutePath() + "/dir1/dir2")); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); map.put(TAG_TITLE, title); map.put(TAG_MESSAGE, content); map.put(TAG_USERNAME, username); map.put(TAG_PROFILE_PICTURE, profile_picture); // adding HashList to ArrayList mCommentList.add(map); } } catch (JSONException e) { e.printStackTrace(); } } @SuppressWarnings("resource") public static String loadImageFromWebOperations(String url, String path) { try { InputStream is = (InputStream) new URL(url).getContent(); System.out.println(path); File f = new File(path); f.createNewFile(…
type: Question
has title: Android Simple Bitmap Reading
tagged with: image
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/5095676
has answer: http://stackoverflow.com/a/25717109
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40201355
tagged with: android
has comment: http://stackoverflow.com/comment/40201078

http://stackoverflow.com/q/25797359
tagged with: jvm
tagged with: serialization
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25797381
has body: public class Employee implements java.io.Serializable { public String name = "Tom"; public void mailCheck() { String address = SomeClass.ItsStaticField(name); //call to static System.out.println("Mailing a check to " + name + " " + address); } } public class SomeClass() { // Static Map of &lt;Name, Address&gt; private static Map&lt;String, String&gt; NameAddressMap= new HashMap&lt;String, String&gt;(); string address; Static ItsStaticField(name) { if (NameAddressMap.containsKey(name){ address = NameAddressMap.get(name); } else{ // address =...make a webservice call ... get address for name NameAddressMap.put(name, address); } return address; } } What happens when an object of the above is serialized? And deserialized on another node in a distributed environment? When is 'SomeClass.ItsStaticField()' invoked? Is the 'address' field's value calculated before serialization and then bundled into bytes as part of the serialization process? Update: Apologize for taking the liberty to add some more info. Added sample code for 'SomeClass'. I have the above code in a distributed environment (specifically Hadoop). I understand this is a bad thing because there are going to be multiple web-service calls, and the intended 'caching mechanism' doesn't really work as expected. What I want to understand is, when and how many times the web-service call would be invoked? And how many instances of the static map 'NameAddressMap' is created on all nodes and when? Thanks much!
has answer: http://stackoverflow.com/a/25797404
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25797401
tagged with: static-members
score: 0
answer count: 3
has title: How are calls to static members of another class handled in Java Object Serialization?
tagged with: distributed-system

http://stackoverflow.com/q/25725552
answer count: 3
linked to: http://stackoverflow.com/q/3636493
tagged with: maven-module
downvote count: 0
has body: I am developing a Java web application, using a multi-module maven project. The project setup is the following: pom.xml Main maven project, that includes the following modules: persistence: Entity classes and DAOs business: Service definition and implementation webapp: Apache wicket web application The dependency hierarchy is the following: webapp depends on business, which depends on persistence. I am also using the Jetty Maven Plugin to run the web application locally using mvn -pl webapp jetty:run inside the directory with the main pom.xml. When developing the application, When making code changes, I want the jetty server to restart and reload the modified code files automatically. This works fine when I am modifying files inside the webapp module, but does not work when I am modifying a file inside another module, such persistence or business. The Maven Jetty Plugin is configured inside webapp/pom.xml as follows: org.eclipse.jetty jetty-maven-plugin 9.2.2.v20140723 <configuration> automatic 1 ../business/target/classes/;../persistence/target/classes/ ../business/target/classes ../persistence/target/classes I followed the instructions of this answer. The tags work fine, since jetty gets restarted when I modify a file inside business or persistence. However, the does not work since the modified files are not loaded by jetty. The linked answer uses the <webAppConfig> tag. However, I am using the tag as specified in the documentation of the plugin (I also tried the old <webAppConfig> tag, which lead to the same results). My question is: How to configure the Jetty Maven Plugin for a multi-module project, such that it reloads modified files from other modules?
favorite count: 0
has answer: http://stackoverflow.com/a/25733214
tagged with: maven-jetty-plugin
possible better answer: http://stackoverflow.com/a/26042875
tagged with: jetty
has answer: http://stackoverflow.com/a/26042875
has title: Maven jetty plugin - automatic reload using a multi-module project
type: AnsweredQuestion
tagged with: java
tagged with: maven
type: Question
score: 9
accepted answer: http://stackoverflow.com/a/25733214
has answer: http://stackoverflow.com/a/25727322
upvote count: 9
linked to: http://stackoverflow.com/q/18669345

http://stackoverflow.com/comment/40272236
has text: Thank you very much, your solution was fantastic also thanks to all the guys that help me with their answer and their time :)
comment on: http://stackoverflow.com/a/25752657
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25858516
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25858574
has body: import java.util.Scanner; public class FantahunKeburAlmostIsoscelesRightTriangle{ public static void main (String []args){ Scanner s = new Scanner(System.in); System.out.println("Enter the longest side: "); double longest = s.nextDouble(); System.out.println("Enter 2nd side: "); double second = s.nextDouble(); System.out.println("Enter 3rd side: "); double third = s.nextDouble(); double longsq = longest*longest; double secondsq = second*second; double thirdsq = third*third; double secthirdsq = secondsq*thirdsq; if (secthirdsq==longsq) { System.out.println("This triangle is an almost-Isosceles right triangle. "); } else if (secthirdsq!=longsq) { System.out.println("This triangle is not a right triangle. "); }} Here is the error I'm getting this>> .java:31: error: 'else' without 'if' else if (secthirdsq!=longsq); ^ 1 error I need it to print the first statement after the if not the one after else if Edit: I changed it and now I am not able to get the first print line to print even when the first if-statement is true
type: Question
has title: Why does the code execute the second line when the first if statement is true?
has comment: http://stackoverflow.com/comment/40462295
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25858522
favorite count: 0
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/q/25824408
upvote count: 5
has comment: http://stackoverflow.com/comment/56957059
has answer: http://stackoverflow.com/a/25824446
answer count: 3
has comment: http://stackoverflow.com/comment/61421592
favorite count: 0
linked to: http://stackoverflow.com/q/5222164
type: UnansweredQuestion
tagged with: android
has body: I'm trying to convert the latitude and longitude to address. When I use the WIFI I'm getting the right answer. But when I try it with 3G/LTE I'm getting the error: Timed out waiting for response from server. I found this with the Debug Mode. But why? I'm using the same Information (Lat, Long). How can I fix it? Heres my Function public void convert_adresses (double lat , double lng) throws IOException { addresses = geocoder.getFromLocation(lat, lng, 1); address = addresses.get(0).getAddressLine(0); city = addresses.get(0).getAddressLine(1); country = addresses.get(0).getAddressLine(2); txt_street.setText(address); txt_city.setText(city); txt_country.setText(country); } And Im calling it like this : try { convert_adresses(latitude,longtitude); } catch (IOException e) { e.printStackTrace(); } Someone got a Idea ?
has title: Geocoder "Timed out waiting for response from server"
score: 4
tagged with: java
has answer: http://stackoverflow.com/a/61912813
linked to: http://stackoverflow.com/q/23638067
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/40023692

http://stackoverflow.com/q/25751814
downvote count: 0
has answer: http://stackoverflow.com/a/25751842
favorite count: 0
has body: I am trying to write a code that returns the area of a rectangle after the user inputs a length and width. Java keeps finding an error in the line: public static void main(String[] args); It says "missing method body or declare abstract," but when i delete the semicolon at the end, it says "';' expected". What's wrong? Here is the rest of the code. There are probably other errors. Thanks. public class Rectangle { public static void main(String[] args) private static double length; private static double width; public Rectangle() { length = 1; width = 1; } public Rectangle(double g, double w) { length = g; width = w; } public double FindArea() { double area; area = length*width; return area; } }
accepted answer: http://stackoverflow.com/a/25751887
answer count: 4
has answer: http://stackoverflow.com/a/25751836
score: 1
has title: Rectangle Area Program: trouble accepting public static void main(String[] args);
has answer: http://stackoverflow.com/a/25751847
has comment: http://stackoverflow.com/comment/40267421
upvote count: 1
has answer: http://stackoverflow.com/a/25751887
has comment: http://stackoverflow.com/comment/40267376
type: AnsweredQuestion
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25751836

http://stackoverflow.com/q/25759985
upvote count: 1
has answer: http://stackoverflow.com/a/25760278
tagged with: java
possible better answer: http://stackoverflow.com/a/25760278
tagged with: lucene
has answer: http://stackoverflow.com/a/25864405
type: AnsweredQuestion
tagged with: analyzer
has title: Remove Space Character from Lucene Standard Analyzer
downvote count: 0
score: 1
favorite count: 0
type: Question
has body: StandardAnalyzer consider space-character as a token, I want StandardAnalyzer to not to make tokens using space-character as a token. So how can I override the tokenizer of StandardAnalyzer. If NOT the please suggest any other Analyzer with example that does not use the space-character as a token.
linked to: http://stackoverflow.com/q/17071300
accepted answer: http://stackoverflow.com/a/25864405
answer count: 2

http://stackoverflow.com/comment/40416640
type: AnswerComment
type: Comment
has text: But you shouldn't run in auto-commit. Hibernate should control the transaction commit or rollback.
score: 2
comment on: http://stackoverflow.com/a/25830441

http://stackoverflow.com/a/25781678
answers question: http://stackoverflow.com/q/25775058
downvote count: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25775058
score: 3
upvote count: 3
has body: GridGain always writes log to file by default (and additionally to console if verbose mode is enabled). If you haven't done any changes to configuration, log files will be stored in $GRIDGAIN_HOME/work/log folder. Note that when nodes are started using ggstart.{sh|bat} script, $GRIDGAIN_HOME will be automatically resolved to your GridGain distribution root directory if it's not set via system property or environment variable. In case $GRIDGAIN_HOME is unknown (e.g., you're running a node in embedded mode inside Web container), log files will be stored in $TMP_DIR/gridgain/work/log folder, where $TMP_DIR is the temporary directory in your OS. Your can override this behavior via GridConfiguration.setWorkDirectory() configuration property. Work directory provided here will be used by different GridGain components including logger, which will create log subfolder for log files. There is also an option to manually configure one of GridLogger implementations available out of the box, or even provide your own. GridLogger instance can be set via GridConfiguration.setLogger() property. By default GridGain uses Java logger configured with java.util.logging.properties file included in distribution. If you want to switch to log4j, you will need to enable gridgain-log4j module - logger will be changed automatically and will be configured with gridgain-log4j.xml. For more information on how to enable/disable modules refer to readme.txt file located in libs folder of GridGain distribution.

http://stackoverflow.com/q/25791361
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/44897587
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/28277309
tagged with: macos
has title: Java exception error for parpool in matlab
downvote count: 0
type: UnansweredQuestion
tagged with: matlab
type: Question
tagged with: parallel-processing
has body: I try to run parpool on my macbook pro from 2013 with matlab 2014a. I get the following error: Error using parpool (line 99) Java exception occurred: java.net.UnknownHostException: **********: nodename nor servname provided, or not known at java.net.InetAddress.getLocalHost(InetAddress.java:1473) ...... I have tried the two solutions from this http://www.mathworks.com/matlabcentral/answers/139968-parpool-java-exception-occurred-2014a-mac-only-when-wifi-at-home-turned-on Turning off wifi or editing the hosts-file does not help.
score: 1

numbers
tags question: http://stackoverflow.com/q/25777223
tags question: http://stackoverflow.com/q/25779208
tags question: http://stackoverflow.com/q/25751327
tags question: http://stackoverflow.com/q/25787036
tags question: http://stackoverflow.com/q/25851786
tags question: http://stackoverflow.com/q/25779680
tags question: http://stackoverflow.com/q/25776844
tags question: http://stackoverflow.com/q/25824762
tags question: http://stackoverflow.com/q/25838820
type: Tag
tag name: numbers

http://stackoverflow.com/comment/64690152
comment on: http://stackoverflow.com/a/31943138
score: 0
type: Comment
has text: Not working for me even in Eclipse. The exception is "java.net.BindException: Address already in use"
type: AnswerComment

http://stackoverflow.com/q/25769798
has title: recursion in java with unexpected output
accepted answer: http://stackoverflow.com/a/25769842
has answer: http://stackoverflow.com/a/25770037
has comment: http://stackoverflow.com/comment/40299775
type: AnsweredQuestion
has body: public class testing { public static void printnum(int a) { System.out.println( a); if(a &lt;= 3) { System.out.println("recursed"); printnum(a+1); } System.out.println( a); } public static void main(String...s) { printnum(1); } } output: 1 2 3 3 2 1 I expected the program to end at last 3 but I do not understand where are the next '2' and '1' coming from? How and why is it decrementing?
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25770004
has answer: http://stackoverflow.com/a/25769842
has answer: http://stackoverflow.com/a/25770004
has comment: http://stackoverflow.com/comment/40301517
score: 0
answer count: 3

http://stackoverflow.com/a/26229273
type: Answer
has body: In jBPM Version 5 we should use artifact name jbpm-bam as jbpm-audit was introduced in version 6.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25759883
answers question: http://stackoverflow.com/q/25759883
score: 0

http://stackoverflow.com/comment/40453710
type: Comment
comment on: http://stackoverflow.com/q/25853905
has text: `The problem is the listener is not responding to the click`. A correctly added ActionListener won't fire when you click on the JTextField. It will fire when the focus is in the JTextField, then hit ENTER. Perhaps you want to add the listener to a JButton instead?
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40300477
has text: I really wonder what people think the `// TODO Auto-generated method stub` comment that their IDE generates is for. Are they afraid that if they take it out, the code will break? Do they just not see it?
score: 0
comment on: http://stackoverflow.com/q/25769740
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25785658
answers question: http://stackoverflow.com/q/25785291
upvote count: 1
has body: This is fairly straightforward: There are log(N) + 1 iterations of the outer loop (logarithm is base 4). Let x be the outer loop iteration number. The inner loop iterates 4^x times. Hence the total runtime is Sum(4 ^ x) for x in [0..c], where c is log(N) This is a geometric series, and it's sum is easily calculated using the formula from the wiki: Sum(4 ^ x) for x in [1..c] = (1 - 4^c)/(1 - 4) = (4 ^ c)/3. Now c is log(N) in base 4, hence 4^c = N. The total answer is hence N with some constant factors.
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/q/25732053
tagged with: excel
has body: I am using Apache poi to parse through Excel 2010 files. I have a csv file that has the same content as one of my excel files. I opened my csv file in excel and saved it as an Excel workbook thinking that it should work in the program that I wrote but I keep getting null pointer exceptions. These happen on the lines of code that look up cells in the file when given a row number and a column number. I havent been able to find the cause for these null pointers and it works completely fine on my regular excel file. Is it just that the file was previously a csv file? I am using the XSSF Usermodel This is where it fails RPCManager rpc = new RPCManager( sheet.getRow(row).getCell(indexes.name).toString(), sheet.getRow(row).getCell(indexes.status).toString(), sheet.getRow(row).getCell(indexes.customer).toString(), sheet.getRow(row).getCell(indexes.site).toString(), sheet.getRow(row).getCell(indexes.suite).toString(), sheet.getRow(row).getCell(indexes.pod).toString(), sheet.getRow(row).getCell(indexes.amps).toString(), sheet.getRow(row).getCell(indexes.pp1).toString(), ** sheet.getRow(row).getCell(indexes.pp2).toString(), ** sheet.getRow(row).getCell(indexes.pp3).toString(), sheet.getRow(row).getCell(indexes.cab).toString(), sheet.getRow(row).getCell(indexes.rpcNum).toString(), sheet.getRow(row).getCell(indexes.rpcPan).toString(), sheet.getRow(row).getCell(indexes.rpcBr).toString(), row); "indexes.whatever" is just the index of the column and row is the row This is a small part of the program that takes information in an excel file and writes an XML file. The Excel file has 2500-3000 rows and spits out around 70 XML files. The code above saves the needed information from the excel file to a class. This part of code is called around 2500 times. I'm guessing it broke on its first time around. It only gives the null pointer exception and the location where it happened which is on the line with the asterisks above. Sorry I am kind of new to programming so I am pretty clueless
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25733169
type: Question
has comment: http://stackoverflow.com/comment/40232720
has comment: http://stackoverflow.com/comment/40231558
tagged with: apache
has comment: http://stackoverflow.com/comment/40231231
has comment: http://stackoverflow.com/comment/40231076
score: 0
has comment: http://stackoverflow.com/comment/40231442
tagged with: http://stackoverflow.com/tag/csv
has title: Apache POI and Null Pointer... csv converted to xlsx
answer count: 1
accepted answer: http://stackoverflow.com/a/25733169
has comment: http://stackoverflow.com/comment/40231479
favorite count: 0
tagged with: apache-poi
has comment: http://stackoverflow.com/comment/40230695
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40232325

http://stackoverflow.com/q/25785687
has title: Select column and hide from other selects
downvote count: 0
has answer: http://stackoverflow.com/a/25785787
favorite count: 0
type: Question
tagged with: sql
tagged with: jdbc
score: 1
upvote count: 1
answer count: 1
tagged with: java
tagged with: database
type: UnansweredQuestion
has body: I'm dealing with a kind of message queue implemented in oracle 11.2 table. I know, it's wrong, still I have it. Table consists of id, message, date and status. All new messages are inserted with status NEW. I'm developing java (jdbc) reader, that picks oldest new messages: select * from messages where status = NEW and rownum &lt;= 1 order by date asc Than reader processes message and sets it's status to DONE. It works good, while we have single reader. The problem with multiple readers is that, they all select same message. I'm trying to solve this problem by updating status to WORKING. Is following pseudocode correct? //autocommit is on id = query(select … for update) query(update messsages set status = WORKING where id = :id) …do some processing in reader… query(update messsages set status = DONE where id = :id) Would it work for multiple concurrent readers? Would readers wait on locks most of the time? Or they will just get next not locked row?
tagged with: oracle11g

http://stackoverflow.com/comment/40427044
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25833544
has text: @Dici you are right, I didn't thought about that enough. Thanks, edited.

http://stackoverflow.com/comment/40448283
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25850645
has text: I use Java 8 and Play 2.3, I can't find copy method.
type: AnswerComment

http://stackoverflow.com/comment/40462189
type: QuestionComment
has text: I attempted to do that as an object but netbeans wouldn't let me call any methods. Ill post code now
comment on: http://stackoverflow.com/q/25858487
score: 0
type: Comment

http://stackoverflow.com/q/25862249
tagged with: directory
has comment: http://stackoverflow.com/comment/40480473
has comment: http://stackoverflow.com/comment/40469037
favorite count: 0
type: AnsweredQuestion
score: 1
has body: I am new to Java, I tried to practice some example but I am facing issue in the file handling topic. Following is the example that what I am trying. T1--&gt; T2--&gt; T3--&gt; T4--&gt; Gan--&gt; q.txt | --&gt; Lin--&gt;Img--&gt;s.png | --&gt; p.txt This is the folder structure. And I want output in the following format. p.txt Lin/Img/s.png Gen/q.txt That means when the first file is getting in any directory, after that next file will be printed with the path from first file is got. The above directory structure is not fixed. It may change. Now following are code that I have did but I am not getting proper output: import java.io.File; import java.util.ArrayList; import java.util.Iterator; class FileProgram { private ArrayList&lt;File&gt; listOfDirectories = new ArrayList&lt;File&gt;(); private ArrayList&lt;File&gt; rawFiles = new ArrayList&lt;File&gt;(); private ArrayList&lt;String&gt; parentDir = new ArrayList&lt;String&gt;(); private ArrayList&lt;String&gt; filesToDisplay = new ArrayList&lt;String&gt;(); private Iterator i, listDir; private boolean firstFile = false; private String parents = ""; public void getDetails(File file) { try { if (file.exists()) { File directoies[] = file.listFiles(); if (!rawFiles.isEmpty()) { rawFiles.clear(); } for (File f : directoies) { rawFiles.add(f); } i = rawFiles.iterator(); while (i.hasNext()) { File isFile = (File) i.next(); if (isFile.isFile()) { displayFiles(isFile); } if (isFile.isDirectory()) { listOfDirectories.add(isFile); } } iterateInnerDirectories(); } else { System.out.println("Invalid File Path"); } } catch (Exception e) { e.printStackTrace(); } } public static void main(String args[]) { FileProgram ray = new FileProgram(); ray.getDetails(new File("D:\\Temp")); } private void iterateInnerDirectories() { listDir = listOfDirectories.iterator(); while (listDir.hasNext()) { File isFile = (File) listDir.next(); File f = isFile; listOfDirectories.remove(isFile); getDetails(isFile); } } private void displayFiles(File file)…
has answer: http://stackoverflow.com/a/25862425
tagged with: java
upvote count: 1
tagged with: collections
type: Question
tagged with: filesystems
has title: display path of all files in the folder relative to the first file encountered in that folder
accepted answer: http://stackoverflow.com/a/25862425
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/40327727
comment on: http://stackoverflow.com/a/25764680
type: Comment
has text: Thanks this work well but, now if i edit again the text no cursor will be show, beacouse obviusly i have to setCursorVisible to true, how can i catch the onClick event on the edittext field?
score: 1
type: AnswerComment

http://stackoverflow.com/a/25824731
has body: Intra-thread semantics only refers to variables that are not shared between threads. Therefore the output is consistent with the Java Memory Model (JMM). On another note, your program is not properly synchronized because you have two threads writing to the same static variable (sync) and therefore the program can produce both the output (6, 2) as well as (2, 2) and still fulfill the JMM.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25824604
upvote count: 1

http://stackoverflow.com/comment/40432480
score: 0
comment on: http://stackoverflow.com/q/25841867
has text: Untagged [tag:postgresql] as this is a JSP / form processing issue.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40458521
score: 0
type: Comment
has text: thank you - I will check my logic again - I load the maps at startup time but I have seen this on the client after hours later. I have to dig more to find out why
comment on: http://stackoverflow.com/a/25856000
type: AnswerComment

http://stackoverflow.com/comment/40377782
has text: that is because you have specified simpledateformat to parse this `yyyy-MM-dd` type of String and your input is 01/01/2013(dd/MM/yyyy) type change it in the simpledateformat argument
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25811839

http://stackoverflow.com/comment/40266620
has text: I think, you might have an empty line at the end of the input file, which can not convert to `int`, hence throwing the exception. Remove any empty lines from the file or you read them as strings and check if they are blanks or remove any trailing spaces and then do an `Integer.parseInt()`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25751376
score: 0

gmail-api
tags question: http://stackoverflow.com/q/25732107
tag name: gmail-api
type: Tag

http://stackoverflow.com/a/25813431
has body: Everything works fine in my local web server but when I run the JSP in Red Hat the archivo.delete(); doesn't work. This is because the file system changes when you switch to different OS and the way of accessing the file will also change you cannot access files on different OS if you hardcode path like this
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25813115
type: Answer

http://stackoverflow.com/comment/40404073
score: 3
comment on: http://stackoverflow.com/q/25826782
type: Comment
has text: Use two variables to store the previous Fibonacci numbers.
type: QuestionComment

http://stackoverflow.com/comment/40194906
type: Comment
comment on: http://stackoverflow.com/a/25712983
type: AnswerComment
has text: but html only work with a one long sentence right? because my code it not a sentence?
score: 0

http://stackoverflow.com/a/25744283
has body: When you deserialize a serialized object, the same class has to be present in order to construct an instance of that class. The serialVersionUID is to tell whether the same version of the class is present in terms of the serialization process. If the class that is present has a different serialVersionUID value (compared to the value read from the binary data/stream of the serialized object), deserialization will be aborted by throwing an InvalidClassException. 1)Is it mandatory to have Student class at the time of deserialization? Yes. 2)As per serialization definition, to transfer the java objects as stream of bytes through network we are performing serialization.So if an object is transferred through network ,how the Student class is available in other side. You have to take care of that. You have to distribute the Student class prior to deserializing a serialized Student. Deserialization can only happen if the same version (determined by the serialVersionUID value) exists of the serialized class. Serializing instances of the standard lib is not a problem, because those are present in all JRE's (although different versions might be present with different serialVersionUID fields!), so you can "transfer" such objects between different JRE's. If an instance of a custom class is transferred, the same class file must be made available at the destination prior to the deserialization process. Edit: You wrote that your "web application exists on different servers". Your web application includes your class files which implicitly means that the class files will be available on all servers. So a serialized object from one server can be deserialized on another.
has comment: http://stackoverflow.com/comment/40254302
has comment: http://stackoverflow.com/comment/40254217
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25744224
type: Answer
has comment: http://stackoverflow.com/comment/40253061
has comment: http://stackoverflow.com/comment/40254248
score: 1
has comment: http://stackoverflow.com/comment/40253719
upvote count: 1
has comment: http://stackoverflow.com/comment/40253272
has comment: http://stackoverflow.com/comment/40254342
has comment: http://stackoverflow.com/comment/40253371
has comment: http://stackoverflow.com/comment/40254182
has comment: http://stackoverflow.com/comment/40253154
accepted answer of: http://stackoverflow.com/q/25744224

http://stackoverflow.com/q/25741728
favorite count: 0
type: Question
tagged with: maven
tagged with: java
upvote count: 1
answer count: 1
tagged with: jodatime
type: UnansweredQuestion
has body: I have a maven project that uses Vert.x library - http://vertx.io/ (but I doubt this has any meaning). When I try run my app by using vert.x command: vertx runzip target/service-1.0.0-mod.zip -conf config.json I'm getting following stacktrace: Exception in Java verticle java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.mycompany.myproject.vertx.Verticle.createConfig(Verticle.java:116) ... Caused by: java.lang.NoSuchMethodError: org.joda.time.format.DateTimeFormatter.withZoneUTC()Lorg/joda/time/format/DateTimeFormatter; at com.mycompany.myproject.mypackage.dao.MyDAO.<clinit>(MyDAO.java:30) ... JodaTime part of pom.xml: joda-time joda-time 2.3 compile I tried running: mvn dependency:tree -Dverbose -Dincludes=joda-time to see if an old version of JodaTime library is loaded as a dependency but all looks OK: [INFO] --- maven-dependency-plugin:2.7:tree (default-cli) @ matching-service --- [INFO] com.mycompany.myproject:service:jar:1.0.0 [INFO] \- joda-time:joda-time:jar:2.3:compile
tagged with: vert.x
downvote count: 0
score: 1
has title: Maven, Vert.x and JodaTime library - NoSuchMethodError
has answer: http://stackoverflow.com/a/25742006

http://stackoverflow.com/q/25758113
has body: Is it possible to use same JNI Method in Two Different Java Files ? For Example, I have a method add() in c. i have written addJNI() in JNI File. now it possible to call addJNI() in two different file a.java and b.java Hope that i am clear. Thanks.
tagged with: java-native-interface
tagged with: http://stackoverflow.com/tag/c
has answer: http://stackoverflow.com/a/25759085
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25759076
favorite count: 0
possible better answer: http://stackoverflow.com/a/25758197
type: Question
has answer: http://stackoverflow.com/a/25758197
tagged with: android
has title: Same JNI Method in Two Different Java Files
upvote count: 3
tagged with: java
answer count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/25759076

spring-data
tags question: http://stackoverflow.com/q/25770043
tags question: http://stackoverflow.com/q/25771693
tags question: http://stackoverflow.com/q/25832317
tags question: http://stackoverflow.com/q/25809769
tags question: http://stackoverflow.com/q/25736139
tags question: http://stackoverflow.com/q/25869520
tags question: http://stackoverflow.com/q/25788569
tags question: http://stackoverflow.com/q/25771654
tags question: http://stackoverflow.com/q/25782390
tags question: http://stackoverflow.com/q/25740161
tags question: http://stackoverflow.com/q/25798596
type: Tag
tags question: http://stackoverflow.com/q/25851029
tags question: http://stackoverflow.com/q/25764823
tags question: http://stackoverflow.com/q/25760156
tags question: http://stackoverflow.com/q/25750815
tags question: http://stackoverflow.com/q/25872637
tags question: http://stackoverflow.com/q/25774061
tags question: http://stackoverflow.com/q/25804840
tags question: http://stackoverflow.com/q/25794031
tag name: spring-data

ebean
tags question: http://stackoverflow.com/q/25796584
tags question: http://stackoverflow.com/q/25739105
type: Tag
tags question: http://stackoverflow.com/q/25772383
tags question: http://stackoverflow.com/q/25760516
tag name: ebean

http://stackoverflow.com/q/25831000
has body: I have a very simple model class. @Entity @Table(name="reach") public class Reach { @Id @Column(name = "uid") private Long uId; @Column(name = "reach_30") private Integer reach30; ... getters, setters.. } And here is my meta model @StaticMetamodel(Reach.class) public class Reach_ { public static volatile SingularAttribute&lt;Reach, Long&gt; uId; public static volatile SingularAttribute&lt;Reach, Integer&gt; reach30; } And when i print following System.out.println("==============="+(Reach_.uId)); System.out.println("==============="+(Reach_.reach30)); I get object value for uId BUT NULL for reach30. Any idea whats going on here. Thankx
tagged with: jpa
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/26101645
type: UnansweredQuestion
type: Question
tagged with: metamodel
tagged with: java
has title: Why MetaModel parameter is null

http://stackoverflow.com/comment/40288765
type: QuestionComment
score: 0
has text: No it doesn't - I'm pressing exactly Step Into button. Also the weird thing is that it finds the Throwable.class when I'm trying to pop an item from empty stack - it goes inside throwable and do everything, but not inside the pop function
comment on: http://stackoverflow.com/q/25761865
type: Comment

http://stackoverflow.com/q/25822720
tagged with: java
has comment: http://stackoverflow.com/comment/40396764
tagged with: multithreading
has answer: http://stackoverflow.com/a/25822756
type: Question
accepted answer: http://stackoverflow.com/a/25822756
has title: why try-catch is not required here in public void run()?
has body: I have a simple program for splash screen. In which I have created a class that impements Runnable and overrides run() method. class mysplash implements Runnable { @Override public void run() { try { Intent i = new Intent(getApplicationContext(), MainActivity.class); startActivity(i); finish(); } catch (InterruptedException e) { System.out.println("exception"); } } } If I write following code , Eclipse shows an error: Remove catch clause I have a prior experience in Java and AFAIK we should write the content of run() method in try - catch block to avoid interruptedexception for thread. I am a newbie in Android. Can anyone explain why exception handling is required for run() method in Java but not in Android?
has comment: http://stackoverflow.com/comment/40396880
upvote count: 2
tagged with: runnable
has comment: http://stackoverflow.com/comment/40396815
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40396856
favorite count: 0
tagged with: exception
tagged with: android
has comment: http://stackoverflow.com/comment/40396780
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/40345665
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25794733
has text: A full example would be a complete example we can run word for word and reproduce the exception you got.
type: Comment

http://stackoverflow.com/q/25856564
tagged with: netlogo
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25856591
has title: how to replace sublist in LogoList
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25856591
type: Question
has answer: http://stackoverflow.com/a/25860050
accepted answer: http://stackoverflow.com/a/25860050
has body: I have a logolist like: [[(turtle 0) 91.21412595730608] [(turtle 1) 76.89996795823208] [(turtle 2) 72.61621123351073] [(turtle 3) 71.23366936658486] [(turtle 5) 69.5448418866364]] I need to replace one of the sublist with a new LogoList, say I have to replace: [(turtle 0) 91.21412595730608] with: [(turtle 0) 43.4323424] I am attempting to make the change with this code: private LogoList replaceItem(LogoList euclideanDistance, LogoListBuilder innerEuclDist, Turtle s) { ListIterator&lt;Object&gt; listIterator = euclideanDistance.listIterator(); int idx = 0; while (listIterator.hasNext()) { LogoList next = (LogoList) listIterator.next(); Turtle get = (Turtle) next.get(0); if (get.equals(s)) { return euclideanDistance.replaceItem(idx, innerEuclDist.toLogoList()); } idx += 1; } return null; } but I am wondering if there is some more clever / fast solutions.

http://stackoverflow.com/a/25838232
downvote count: 0
has comment: http://stackoverflow.com/comment/40451492
has comment: http://stackoverflow.com/comment/40452504
type: Answer
has body: You need to declare the prefixes One, you need to include the necessary prefixes in your SPARQL query. That is, you'll need to write prefix dbpedia-owl: &lt;http://dbpedia.org/ontology/&gt; and the rest at the beginning of your query. The predefined prefixes only get applied to queries you make with the browser-based web interface, as far as I know. You need to use some spaces or newlines When you're constructing queries from strings, you need to be very careful with newlines and spaces and the like. For instance, the Java lines "rdfs:label ?label"+ "filter langMatches( lang(?label), 'en' )"+ end up giving you a query string containing rdfs:label ?labelfilter langMatches( lang(?label), 'en' ) You end up with an invalid query. Add some spaces or newlines to your strings. You need to write a proper query Your query doesn't end correctly. You have "filter langMatches( lang(?label), 'en' )"+ "limit 10"+ "}"; which will give you (once you add some newlines and spaces): filter … limit 10 } That's not the right syntax. You need to have filter … } limit 10 Print and check your queries if you don't get useful error messages I'm surprised that DBpedia didn't give you a more useful error message (or maybe it did; you didn't show us the stacktrace, after all). You can test your queries at sparql.org's query validator, too. Also, if you used one of Jena's ParameterizedSparqlStrings, you could have parsed the query beforehand, which should have caught the syntax error.
has comment: http://stackoverflow.com/comment/40441161
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/40451603
accepted answer of: http://stackoverflow.com/q/25835640
answers question: http://stackoverflow.com/q/25835640
type: AcceptedAnswer

http://stackoverflow.com/a/25871867
has body: You can add an entry in server.xml to point to the static content. <Context docBase="/home/stuff" path="/static" /> Full explanation http://www.moreofless.co.uk/static-content-web-pages-images-tomcat-outside-war/ (snippet taken from this site).
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25871726
downvote count: 0

http://stackoverflow.com/a/25830547
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25830388
answers question: http://stackoverflow.com/q/25830388
has body: Try this. I have given comments. Feel free to ask any doubts public class MyThread extends Thread { private String name, msg; private int interval; // to specify the period to be used to take lock. Main thread needs to do it for every iteration whereas childthread should do it for 2 iterations private static Object lock = new Object(); // to use wait and notify mechanism to get the desired output private static boolean done = false; // to make sure that if the child thread is done with its tasks then main thread need not wait public MyThread(String name, int interval) { this.name = name; this.interval = interval; } public void run() { int count = 0; synchronized (lock) { System.out.println(name+" Thread : starts its execution"); for (int i = 5; i &gt; 0; i--) { System.out.println(name + " says: " +i); try { Thread.sleep(200); } catch (InterruptedException ie) {} // Main thread waits for every iteration // Child thread waits for every 2 iterations if(!done &amp;&amp; ++count % interval == 0) { lock.notifyAll(); try { lock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } // Once child thread is done with its iterations, main thread need not wait anymore hence set done to true done = true; // to make sure that if the main thread is waiting then give it a signal to finish its tasks with no more waiting lock.notifyAll(); System.out.println(name + " finished execution"); } } public static void main(String[] args) { MyThread mt1 = new MyThread("Main Thread",1); MyThread mt2 = new MyThread("Child Thread",2); mt1.start(); mt2.start(); } }

http://stackoverflow.com/q/25776363
has comment: http://stackoverflow.com/comment/40313114
type: Question
has answer: http://stackoverflow.com/a/25776388
tagged with: java
tagged with: jstl
answer count: 1
tagged with: jsp
score: 0
has comment: http://stackoverflow.com/comment/40334772
has title: Foreach in jstl c tag
has body: I´m using jstl in jsp, creating a object result from a DTO, when I use it in this way: &lt;c:if test="${not empty result.billedConsumptionActive}"&gt; &lt;p&gt;&lt;c:out value="${result.billedConsumptionActive}"&gt;&lt;/c:out&gt;&lt;/p&gt; &lt;/c:if&gt; This return and print: ConsumptionDTO [consumptionHour00=37.6, consumptionHour01=null, consumptionHour02=null, consumptionHour03=50, consumptionHour04=null, consumptionHour05=null, consumptionHour06=12.5, consumptionHour07=null] But when I try to use it in a foreach statement: &lt;c:if test="${not empty result.billedConsumptionActive}"&gt; &lt;c:forEach var="window" items="${result}"&gt; &lt;td&gt;&lt;c:out value="${result.billedConsumptionActive}"/&gt;&lt;/td&gt; &lt;/c:forEach&gt; &lt;/c:if&gt; I got an error, and I cant explain why. There's another way to call items="${result}??
type: UnansweredQuestion

http://stackoverflow.com/q/25842690
type: Question
has title: Android:how to play music and record from the mic at the same time need a source code?
score: 0
has comment: http://stackoverflow.com/comment/40433981
tagged with: audio-player
answer count: 1
has body: I'm trying to make application can record my voice from mic built-in and music from android device at the same time. while playing song it should display lyrics also please help me out i need to add in my app.! it should show me lyrics while playing song. thank you for your replay in advance.
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25843017
tagged with: java
has comment: http://stackoverflow.com/comment/40433868
downvote count: 2
tagged with: android-music-player

http://stackoverflow.com/a/25782597
answers question: http://stackoverflow.com/q/25782404
type: Answer
has body: You have trouble with list view and adapter. Adapter in getView method reuse "old" item view. And you must setup all content again I mean: if you use viewHolder.imageViewIconItem.setVisibility(ImageView.INVISIBLE); at one case you must use viewHolder.imageViewIconItem.setVisibility(ImageView.VISIBLE); at second case here some code which can help you: if(navDrawerItems.get(position).getHeaderVisibility()) { viewHolder.textViewTitleItem.setVisibility(TextView.INVISIBLE); viewHolder.imageViewIconItem.setVisibility(ImageView.INVISIBLE); viewHolder.textViewHeaderItem.setVisibility(TextView.VISIBLE); viewHolder.dividerViewItem.setVisibility(View.VISIBLE); viewHolder.textViewHeaderItem.setText(navDrawerItems.get(position).getHeader()); Log.d("NavDrawerAdapter: ", "3a"); } else { viewHolder.textViewHeaderItem.setVisibility(TextView.INVISIBLE); viewHolder.dividerViewItem.setVisibility(View.INVISIBLE); viewHolder.textViewTitleItem.setVisibility(TextView.VISIBLE); viewHolder.imageViewIconItem.setVisibility(ImageView.VISIBLE); viewHolder.imageViewIconItem.setImageResource(navDrawerItems.get(position).getIcon()); viewHolder.textViewTitleItem.setText(navDrawerItems.get(position).getTitle()); Log.d("NavDrawerAdapter: ", "3b"); }
score: 1
has comment: http://stackoverflow.com/comment/40358725
upvote count: 1
has comment: http://stackoverflow.com/comment/40323755
has comment: http://stackoverflow.com/comment/40335732
has comment: http://stackoverflow.com/comment/40384791
downvote count: 0

http://stackoverflow.com/comment/40486302
type: Comment
has text: *configuracion.set("Configuration.NoPermissionsMessage", "&cYou don't have permissions to do that");*
type: AnswerComment
comment on: http://stackoverflow.com/a/25860902
score: 0

http://stackoverflow.com/comment/40510098
has text: @TheShahin: Fair enough. I'll be looking out for jOOQ questions here on Stack Overflow, so if it pops up again, feel free to ask another one.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25870351

http://stackoverflow.com/comment/40375411
type: QuestionComment
has text: What happens if you leave jdbc.password out of the properties file completely? Just don't specify it at all?
comment on: http://stackoverflow.com/q/25811182
score: 0
type: Comment

http://stackoverflow.com/q/25789785
has comment: http://stackoverflow.com/comment/40337844
has body: we have server with the TCP socket. There is no problem if client(mobile phone) connects with the Wi-Fi connection. But if client tries to connect to the socket with the 3G connection, it doesn’t connect anywise. The code in the client side: mikrofon = new Socket(); SocketAddress address = new InetSocketAddress(serverip, port); mikrofon.connect(address); Note: If client pings the server with telnet via 3G connection, it gets response. But inside our application we could not connect, it throws timeout exception. we set timeout unlimited, still does not connect.
score: 0
tagged with: sockets
has title: Why does not client connect to tcp server by 3G?
answer count: 0
tagged with: tcp
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40336304
has comment: http://stackoverflow.com/comment/40340092
type: Question
has comment: http://stackoverflow.com/comment/40337381
has comment: http://stackoverflow.com/comment/40337261
tagged with: java
has comment: http://stackoverflow.com/comment/40336444

http://stackoverflow.com/q/25761231
tagged with: eclipse
has title: JDK 1.8 on RHEL 6.5 : Can't import JTable
has comment: http://stackoverflow.com/comment/40284309
answer count: 2
has comment: http://stackoverflow.com/comment/41406001
has body: I'm using Eclipse as IDE on RHEL 6.5 with JDK 1.8 When I try to declare some object of JTable, it doesn't find appropriate import package/class. When I manually try to write import statement, it only shows up to javax.swing, but it doesn't show JTable there after. import javax.swing.JTable; public class JTableTest { public static void main(String args[]) { JTable obj1 = new JTable(); } } it only happens when using JTable other imports are not affected...
downvote count: 0
has comment: http://stackoverflow.com/comment/40284798
has answer: http://stackoverflow.com/a/26007629
tagged with: rhel6
favorite count: 0
has answer: http://stackoverflow.com/a/26036466
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40287568
has comment: http://stackoverflow.com/comment/40284714
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40284683
tagged with: swing
has comment: http://stackoverflow.com/comment/40284467
type: Question
tagged with: java

http://stackoverflow.com/comment/40513185
has text: Then i guess it should depend on my custom filter...Thank you for replying @Tim B :)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25871440
score: 0

http://stackoverflow.com/comment/40244060
type: Comment
comment on: http://stackoverflow.com/q/25736671
type: QuestionComment
score: 0
has text: I cannot reproduce that here. Can you check if you get the same behavior with the "samples/hello.install4j" project and the "Hello GUI" launcher?

http://stackoverflow.com/q/25827950
has body: I am trying to learn MapReduce from the official documentation. To make a jar file for WordCount class, the documentation says to run the following command: javac -classpath ${HADOOP_HOME}/hadoop-${HADOOP_VERSION}-core.jar -d wordcount_classes WordCount.java But, I found that my Hadoop directory has no core.jar present. I suppose my Hadoop installation is alright as I can execute the Hadoop shell script from the Bin folder.
tagged with: apache
downvote count: 0
has comment: http://stackoverflow.com/comment/40411964
possible better answer: http://stackoverflow.com/a/25853889
has answer: http://stackoverflow.com/a/25846385
favorite count: 0
has answer: http://stackoverflow.com/a/25853889
has title: MapReduce: executing WordCount v1.0
accepted answer: http://stackoverflow.com/a/25846385
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
answer count: 2

http://stackoverflow.com/a/25817510
has body: You aren't utilizing your 'import' correctly. 'Import' does not allow you to freely reference methods in the imported files, it allows you to instantiate classes from the imported files (or use static methods from those files, but you still need to specify the class). Meaning, you need to say EasyPrinting.inPrint("hello"); (like RehanZahoor wrote), not just call the method directly.
answers question: http://stackoverflow.com/q/25817035
score: 0
type: Answer

http://stackoverflow.com/comment/40278870
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25758106
has text: quick question: you are providing `MethodName` as argument to the function but haven't you used it anywhere?

http://stackoverflow.com/comment/40201540
comment on: http://stackoverflow.com/q/25716511
has text: Sure, that's fine. To make your code more readable, you could define a constant `NO_BALL = -1` or something, and assign that instead of just `-1`.
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/comment/40229771
type: Comment
has text: @Takendarkk So would i insert a getData method before Node? Like maybe under public DoublyLinkedList()? and what would the getData return?
comment on: http://stackoverflow.com/q/25730843
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40224856
type: QuestionComment
has text: so you can bind to already started service, cannot you? you will then get a IBinder to talk to the service
comment on: http://stackoverflow.com/q/25728995
score: 0
type: Comment

http://stackoverflow.com/q/25791256
has comment: http://stackoverflow.com/comment/40338935
has title: Libgdx show score and add 1 to score every second
tagged with: android
has body: I want to increment the score by 1 point every second but I am struggling to get it to work properly. e.g. (pseudo code): int score = 0f // on create updateEverySecond() { score += 1; displayScore() } I would also like to know how to display the score at the top of my screen and centred. My Full Source Code: package com.ryanwarren.dodge.game; import com.badlogic.gdx.ApplicationAdapter; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Input.Keys; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; public class libgdxGame extends ApplicationAdapter { SpriteBatch batch; Texture player; Vector2 position; float time = 0f; @Override public void create () { batch = new SpriteBatch(); player = new Texture(Gdx.files.internal("player.png")); position = new Vector2((Gdx.graphics.getWidth()/2 - (player.getWidth()/2)),50); } @Override public void dispose() { } @Override public void render () { Gdx.gl.glClearColor(1, 1, 1, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); if(Gdx.input.isKeyPressed(Keys.W)) { position.y += 1f; } if((Gdx.input.isKeyPressed(Keys.A)) &amp;&amp; (position.x &gt; 0)) { position.x -= 2f; } if(Gdx.input.isKeyPressed(Keys.S)) { position.y -= 1f; } if((Gdx.input.isKeyPressed(Keys.D)) &amp;&amp; (position.x &lt; Gdx.graphics.getWidth() - player.getWidth())) { position.x += 2f; } if(Gdx.input.isTouched()) { System.out.println("application clicked"); } if((Gdx.input.getAccelerometerX() &gt;= 0) &amp;&amp; (position.x &gt; 0)) { position.x -= 2f; } else if((Gdx.input.getAccelerometerX() &lt; 0) &amp;&amp; (position.x &lt; Gdx.graphics.getWidth() - player.getWidth())) { position.x += 2f; } System.out.println("Rotation: " + Gdx.input.getAccelerometerX()); batch.begin(); batch.draw(player, position.x, position.y); batch.end(); } @Override public void resize(int width, int height) { } @Override public void pause() { } @Override public void resume() …
has answer: http://stackoverflow.com/a/25795351
score: 0
upvote count: 1
downvote count: 1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25795351
tagged with: libgdx
tagged with: java
type: Question
tagged with: scoring
answer count: 1
has comment: http://stackoverflow.com/comment/40340986
favorite count: 0
tagged with: timer

http://stackoverflow.com/comment/40233045
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25727322
has text: I tried the exactly same configuration (i.e. version of the jetty plugin) and it did not work. However, because I new this configuration did work for you, I tried calling `mvn jetty:run` inside the `webapp` directory (see my answer). +1 and thanks for helping me find a solution :)

http://stackoverflow.com/q/25734251
tagged with: random
upvote count: 0
answer count: 1
tagged with: variables
favorite count: 0
has body: I am having trouble with an assignment. I have to declare and initialize 9 double variables to 0.0. This means double A1 = 0.0; double A2 = 0.0; double A3 = 0.0; double A4 = 0.0; double A5 = 0.0; double A6 = 0.0; double A7 = 0.0; double A8 = 0.0; double A9 = 0.0; right? After that, it says with these 9 variables, make up a random number using a random number generator. With that new random number, I have to: gather the random number cutoff at the 3rd decimal gather the random number rounded at the 3rd decimal gather the random number cutoff at the 4th decimal gather the random number rounded at the 4th decimal gather the random number cutoff at the 5th decimal gather the random number rounded at the 5th decimal gather the random number cutoff at the 6th decimal gather the random number rounded at the 6th decimal. Can someone explain to me how to make up a random number using those 9 variables? Thanks in advance.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25734292
tagged with: output
downvote count: 1
has title: Using double variables to create random number and cuttoffs
tagged with: java
score: -1
type: Question

http://stackoverflow.com/comment/40257033
has text: Super. You can always "chain" run configurations via the "Before Launch:" -> "Run another Configuration" feature
type: Comment
comment on: http://stackoverflow.com/a/25742323
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40258565
type: Comment
has text: +1 for the thorough explanation, however I like @laalto 's answer better because it's simpler and resumes all the docs. Thanks for linking all the official docs !
comment on: http://stackoverflow.com/a/25746215
type: AnswerComment
score: 0

http://stackoverflow.com/q/25715535
linked to: http://stackoverflow.com/q/5585779
downvote count: 0
has answer: http://stackoverflow.com/a/25715989
has comment: http://stackoverflow.com/comment/40199829
has body: So the question asked is: To change the characters of a string with 3 characters ahead of them so lets say the string is "AB cd" it would be changed to: "DE fg". I am not good at programing but I have tried my best and come up with this: import java.util.*; public class encrypt{ public static void main(String[] args){ Scanner reader = new Scanner(System.in); System.out.println("Enter a message to encrypt: "); String message = reader.nextLine(); List&lt;Character&gt; Lowercase = Arrays.asList('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'); List&lt;Character&gt; Uppercase = Arrays.asList('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'); for ( int i = 0; i &lt; message.length(); i++ ) { char c = message.charAt( i ); if( c == ' '){ continue; } else if (c != ' '){ for ( int i = 0; i &lt; Lowercase.size(); i++ ) { char b = Lowercase.indexOf(i); if(c == b){ message.charAt(i)=Lowercase.indexOf(i+3); } } } for ( int i = 0; i &lt; Uppercase.size(); i++ ) { char j = Uppercase.indexOf(i); if(c == j){ message.charAt(i)=Uppercase.indexOf(i+3); } } } } } I have been getting errors like : Problem1.java:20: error: variable i is already defined in method main(String[]) for ( int i = 0; i &lt; Lowercase.size(); i++ ) { ^ Problem1.java:21: error: possible loss of precision char b = Lowercase.indexOf(i); ^ required: char found: int Problem1.java:23: error: unexpected type message.charAt(i)=Lowercase.indexOf(i+3); ^ required: variable found: value Problem1.java:27: error: variable i is already defined in method main(String[]) any help would be appreciated :) thanks.
has answer: http://stackoverflow.com/a/25717044
accepted answer: http://stackoverflow.com/a/25717044
linked to: http://stackoverflow.com/q/3784518
type: AnsweredQuestion
score: 3
possible better answer: http://stackoverflow.com/a/25715989
has comment: http://stackoverflow.com/comment/40199889
has comment: http://stackoverflow.com/comment/40200211
tagged with: string
favorite count: 0
has title: Having trouble changing characters in strings
type: Question
has comment: http://stackoverflow.com/comment/40200157
has comment: http://stackoverflow.com/comment/40199896
has comment: http://stackoverflow.com/comment/40199831
upvote count: 3
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/25715683
has answer: http://stackoverflow.com/a/25715981
answer count: 4
tagged with: for-loop

http://stackoverflow.com/a/25727944
has body: At first, Java 3D is NOT dead as you can see here (please edit your question). Secondly, you can look at the Java documentation of the class ObjectFile. I advise you to use the flag "TRIANGULATE" to be sure to get a polygon array containing only convex polygons to ease your computations. The branch group of your Scene object contains one Shape3D object. This Shape3D object contains a Geometry object, it stores your polygons. The source code of ObjectFile is here. Look at this line. Edit.: You can get the BranchGroup of your scene by calling Scene.getSceneGroup(). You can see that the group is added into the scene here. Call Group.getAllChildren(), loop on all children, use instanceof to check whether a child is an instance of Shape3D. For each Shape3D, call getGeometry() or getAllGeometries(). The geometry should be a GeometryArray, maybe a TriangleArray. getCoordRefBuffer() might not work exactly in the same way in Java 3D 1.6 because we removed J3DBuffer, use getCoordRefDouble(), getCoordRefFloat() or any variant of getCoordinate() or getCoordinates(). Please ensure that you use Java 3D 1.6 so that we are talking about the same code and the same version. Older versions are obsolete and unmaintained. Edit.2: Rather call getInterleavedVertices() as its name implies if the vertices are interleaved. Keep in mind that it might contain the normals too (in first position), not only the vertex coordinates (in second position): nx ny nz vx vy vz
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40265977
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40229881
score: 1
has comment: http://stackoverflow.com/comment/40250273
upvote count: 1
has comment: http://stackoverflow.com/comment/40261054
answers question: http://stackoverflow.com/q/25714777
accepted answer of: http://stackoverflow.com/q/25714777
has comment: http://stackoverflow.com/comment/40246611

http://stackoverflow.com/q/25775856
downvote count: 0
has answer: http://stackoverflow.com/a/25776762
accepted answer: http://stackoverflow.com/a/25776762
tagged with: android-imageview
type: AnsweredQuestion
score: 3
tagged with: java
type: Question
tagged with: android-viewpager
has comment: http://stackoverflow.com/comment/96446063
answer count: 1
favorite count: 0
has body: I have developed an app that is suppose to display images located in the drawable folder. I used imageview/viewpager for it. However, I would like to display frame shown below.On the top of the image so that image appears more fancy.. Also, the frame should swipe along with the image...so that it looks more beautiful... I was thinking of creating it permanently on the image...through photoshop... But I didn't like that idea ..So I thought may be android have something for it....I am android beginner...So any code help along with explanation will be appreciated..Following are my codes.. Mainactivity.java import android.app.Activity; import android.media.MediaPlayer; import android.os.Bundle; import android.support.v4.view.ViewPager; import android.support.v4.view.ViewPager.OnPageChangeListener; public class MainActivity extends Activity { MediaPlayer oursong; ViewPager viewPager; ImageAdapter adapter; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); oursong = MediaPlayer.create(MainActivity.this, R.raw.a); oursong.seekTo(0); oursong.start(); viewPager = (ViewPager) findViewById(R.id.view_pager); adapter = new ImageAdapter(this); viewPager.setAdapter(adapter); viewPager.setOnPageChangeListener(MyViewPagerListener); } private int pos = 0; @Override protected void onPause() { super.onPause(); if(oursong != null){ pos = oursong.getCurrentPosition(); oursong.release(); oursong = null; } } @Override protected void onResume(){ super.onResume(); oursong = MediaPlayer.create(MainActivity.this, R.raw.a); oursong.seekTo(pos); // You will probably want to save an int to restore here oursong.start(); } private final OnPageChangeListener MyViewPagerListener = new OnPageChangeListener() { @Override public void onPageSelected(int pos) { if (pos == adapter.getCount() - 1){ // adding null checks for safety if(oursong != null){ oursong.pause(); } } else if (!oursong.isPlaying()){ // adding null check…
upvote count: 3
tagged with: android
linked to: http://stackoverflow.com/q/2577221
has title: How to display fancy frame on the image in android viewpager/imageview?
linked to: http://stackoverflow.com/q/25794570

http://stackoverflow.com/q/25716292
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40204289
tagged with: line
has body: I have a series of unordered line segments. The line segments may be independent lines or part of one of several polygons. I'd like to go through the list and combine any line segments into a polygon and throw out any lines that do not form a closed polygon. This is not as trivial as I thought at first. Is this problem a classic problem that is solved already?
has comment: http://stackoverflow.com/comment/40201301
has answer: http://stackoverflow.com/a/25716460
tagged with: java
type: Question
has title: Combine a list of line segments into polygons
tagged with: polygon
tagged with: sorting
has comment: http://stackoverflow.com/comment/40201319
score: 0
has comment: http://stackoverflow.com/comment/40204313
answer count: 1

http://stackoverflow.com/q/25793526
upvote count: 2
tagged with: eclipse-luna
tagged with: java
tagged with: eclipse
type: Question
has title: Eclipse Luna GC Overhead & Java Heap space
has body: Yesterday I installed Eclipse Luna to develop for android... I installed the google SDK and everything seemed to work fine... but when im looking a Graphical Layout of a given activity Luna blows up and starts to give me a screen as SS below: To get around that i have to force quit eclipse and reopen... the problem is that XML is not a very good tool to build interfaces with... is there anything i can do to maybe increase the heap size?!? or something like that??? Extra Details: Running on MAC OS X latest version When the error happens im not under any kind of memory pressure situation... i have a 16gb set... So far my project has only 1 activity, so i dont know if this is happening with another screen This is my first android App
score: 2
has answer: http://stackoverflow.com/a/25793616
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25793616

http://stackoverflow.com/q/25829130
possible better answer: http://stackoverflow.com/a/25829332
type: AnsweredQuestion
tagged with: opensuse
score: 1
tagged with: java
has body: I have OpenSuse Linux 12.3, and I have a script file that runs every half hour. I know it runs because it generates a log file. The log file as as follows: myscript.sh I should say that this script runs fine from the command line. It also runs fine in Task Scheduler if I tell it to "run now", it does run, and does generate a log file, and the log file has the appropriate log data in it. I did change the script to chmod 777, so everything has access to it. I know the cron service is running on the system. I can see log files being generated, but there is nothing in the log. They are 0 byte size files. This is when the Task Scheduler goes to run something. So, again, here is the script: myscript.sh: datestr=$(date +%Y%m%d_%H%M%S) cd /home/tholmes/git/Tom_Utils/Tom_Utils mvn exec:java -Dexec.mainClass="com.tom.test.utils.fix.MyJavaApp" -Dexec.args="12" &gt; /home/tholmes/logs/my_java_app/12_$datestr.log So, I do know that all the commands in this script work perfectly? When I run the script in the Task Scheduler manually, it works fine, and a log is generated. But when the Task Scheduler auto-runs, it doesn't run... Can anyone help me what I did wrong? I did not expect this to be so difficult.
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25848825
accepted answer: http://stackoverflow.com/a/25848825
answer count: 2
tagged with: cron
has title: On Linux OpenSuse cron, scripts run, but generate only empty logs
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25829332
tagged with: linux

http://stackoverflow.com/comment/48268903
type: Comment
comment on: http://stackoverflow.com/a/25899763
score: 3
has text: that link is dead. is the content available somewhere else?
type: AnswerComment

http://stackoverflow.com/q/25729664
has body: I want to delete records in namedCache in which "key" value ends with special string like key1AA-BB key2AA-BB key3AA-BB is there simple way to delete all records whose key value ends with "AA-BB"? in my expreriment I have found that there is Filters (LikeFilter ..etc) but these filters are appied into "value" rather than "key". Whay similar Filter logic cannot be appied based on key? I can iterate all keys and find macthed keys, but there should be more OO way Set set = cache.keySet(); Iterator iterator = set.iterator(); while (iterator.hasNext()) { System.out.println(iterator.next()); //match key cache.remove(key) } Using: Coherence 12
score: 0
answer count: 1
tagged with: oracle-coherence
has answer: http://stackoverflow.com/a/25739845
tagged with: java
accepted answer: http://stackoverflow.com/a/25739845
has title: Coherence Delete Entry with regular expression
type: AnsweredQuestion
type: Question

http://stackoverflow.com/comment/40435294
type: Comment
type: QuestionComment
has text: @SimY4 Well, this is the problem. You cannot create a generic array.
score: 2
comment on: http://stackoverflow.com/q/25843527

http://stackoverflow.com/comment/40237422
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25735475
type: AnswerComment
has text: Took a bit to understand the difference, but I'd agree with that assessment... +1

http://stackoverflow.com/q/25840733
tagged with: performance
has answer: http://stackoverflow.com/a/25845379
tagged with: concurrency
downvote count: 0
answer count: 1
linked to: http://stackoverflow.com/q/8381440
favorite count: 0
accepted answer: http://stackoverflow.com/a/25845379
upvote count: 6
tagged with: atomic
has title: Atomic Integer lazySet performance gains
has body: The article "Atomic*.lazySet is a performance win for single writers," goes over how lazySet is a weak volatile write (in the sense that it acts as a store-store and not a store-load fence). But I don't understand how leveraging semi-volatile writes improves concurrent queue performance. How exactly does it offer extra low latency as claimed by Menta-queue? I already read up on it's implementation and it's claims on the stack overflow question: "How is lazySet in Java's Atomic* classes implemented" and "Atomic Integer's lazySet vs set."
type: AnsweredQuestion
tagged with: java
tagged with: multithreading
score: 6
type: Question
linked to: http://stackoverflow.com/q/11105827

http://stackoverflow.com/a/25742301
type: Answer
has body: This is very much possible in Spring by making use of @Async task processing. First create a service which will perform the task asynchronously. Here make note of the @Async annotation, on performTask method, which will be scanned and marked by spring for asynchronous execution. import java.util.concurrent.Future; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.AsyncResult; import org.springframework.stereotype.Service; @Service public class AsyncTask { @Async public Future&lt;Result&gt; performTask(String someArgument) { // put the business logic here and collect the result below Result result = new Result(); // this is some custom bean holding your result return new AsyncResult&lt;Result&gt;(result); } } Next create a component (optional - can be from any other existing service as well) which will invoke the above service. import java.util.concurrent.Future; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component public class AsyncClass { @Autowired private AsyncTask asyncTask; public void doAsyncOperation() throws Exception { List&lt;Future&lt;Result&gt;&gt; futures = new ArrayList&lt;Future&lt;Result&gt;&gt;(); for (int i = 1; i &lt; 10; i++) { // Simulate multiple calls Future&lt;Result &gt; future = doAsync(String.valueOf(i)); futures.add(future); } for (Future&lt;Result &gt; future : futures) { // fetch the result Result result = future.get(); // process the result } } private Future&lt;Result&gt; doAsync(final String someArgument) { // this will immediately return with a placeholder Future object which // can be used later to fetch the result Future&lt;Result&gt; future = asyncTask.performAsync(someArgument); return future; } } The sample xml configuration required to enable async is as below (For annotation based config use @EnableAsync) &lt;task:annotation-driven executor="myExecutor" /&gt; &lt;task:executor id="myExecutor" pool-size=…
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25741262
downvote count: 0

http://stackoverflow.com/q/25726303
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/25730327
has body: I am trying to loop through a drop-down menu, I am able to get each and every listed element but when I use the .click() and .submit() commands, it selects the first one and does not continue any further. I am aware for it to continue any further, I need to reselect the drop-down arrow so the list becomes visible to selenium after every submit. I tried commenting to make it readable. ANY help is greatly appreciated. I wrote down the following, WebElement search = driver.findElement(By.id("search-form")); WebElement arrowDownButton = search.findElement(By.className("dropdown-toggle")); arrowDownButton.click(); WebElement menu = search.findElement(By.className("dropdown-menu")); List &lt;WebElement&gt; listOptions = menu.findElements(By.tagName(LI)); //selecting the listed elements , LI is "li" (declared previously) int numberOfCountries = listOptions.size(); log("We have " + numberOfCountries + " entires"); int i=0; //for looping //store into an array because web elements disappear WebElement []listOfCountries = new WebElement[listOptions.size()]; //making an array of size listed elements for (WebElement aOption : listOptions) { listOfCountries[i] = aOption; //saving the value into an array String dataValue = aOption.getAttribute("data-value"); // what country am I wanting click i++; } for(WebElement country : listOfCountries) { log(country.getText()); //log is a another function executing System.out.println country.click(); //clicking on the web element country.submit(); // submitting the element arrowDownButton.click(); //reselecting the drop-down menu -&gt; Why isn't this working? } } Here are some methods I have already tried: Instead of creating, saving and iterating through an array, I just directly tried to click the element. However, it also just clicks the first element. Here is the error I am receiving: Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: Element is not currently visible and so may not be interacted with arrowDownButto…
has comment: http://stackoverflow.com/comment/40223400
has comment: http://stackoverflow.com/comment/40220415
has comment: http://stackoverflow.com/comment/40221595
accepted answer: http://stackoverflow.com/a/25726476
has comment: http://stackoverflow.com/comment/40222391
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/25730327
tagged with: java
tagged with: selenium
has title: Selenium - Only able to select the first element in a list whereas able to print all elements
has answer: http://stackoverflow.com/a/25726476
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40221709
has comment: http://stackoverflow.com/comment/40219796
has comment: http://stackoverflow.com/comment/40219681
has comment: http://stackoverflow.com/comment/40221020

http://stackoverflow.com/q/25809004
has body: I'm having a problem with BO application which runs out of memory and i see the below error in the BO logs: PSPermGen reserved 196608K, committed 24640K, used 24587K [0x000000007fff0000, 0x0000000081800000, 0x000000008bff0000) object space 24640K, 99% used From the command java.exe -XX:+PrintFlagsFinal i see uintx MaxPermSize = 67108864 uintx MaxHeapSize := 268435456 {product} meanwhile from tocat configuration file setenv.bat i see: set JAVA_OPTS=%JAVA_OPTS% -Xmx2048m -XX:MaxPermSize=384m Could someone help me finding a solution. When app runs out of space some services stops. thank you
has answer: http://stackoverflow.com/a/25852345
has comment: http://stackoverflow.com/comment/40371693
favorite count: 0
has comment: http://stackoverflow.com/comment/40370982
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32501382
linked to: http://stackoverflow.com/q/3529482
tagged with: tomcat7
has title: PSPermGen getting full
score: 2
tagged with: java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/25863480
answer count: 4
favorite count: 0
possible better answer: http://stackoverflow.com/a/34337348
has body: Consider this code: Thread.setDefaultUncaughtExceptionHandler((Thread t, Throwable e) -&gt; { System.out.println("An exception occurred!"); }); // set the exception handler for the JavaFX application thread Thread.currentThread().setUncaughtExceptionHandler((Thread t, Throwable e) -&gt; { System.out.println("An exception occurred!"); }); Task&lt;?&gt; task = new Task() { @Override public Void call() throws Exception { throw new RuntimeException("foobar"); }; }; new Thread(task).start(); If we run the code the runtime exception never triggers the default exception handler but is instead consumed by the task. The only way to counteract this that I found is to rethrow the exception in task.setOnFailed: task.setOnFailed((WorkerStateEvent t) -&gt; { throw new RuntimeException(task.getException()); }); Since JavaFX 8 now has support for the UncaughtExceptionHandler why isn't the exception propagated to the exception handler?
type: AnsweredQuestion
tagged with: java
score: 23
type: Question
has answer: http://stackoverflow.com/a/39226625
has answer: http://stackoverflow.com/a/34337348
downvote count: 0
upvote count: 23
has answer: http://stackoverflow.com/a/25907658
accepted answer: http://stackoverflow.com/a/25907658
has answer: http://stackoverflow.com/a/38476765
tagged with: javafx-8
has title: JavaFX's task seem to consume exceptions. Is it a bug or a feature?

http://stackoverflow.com/a/62101096
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25819889
has body: Hate to bring this up after 6 years but I found another possible solution. Currently attending a coding bootcamp and had to solve a similar problem. We introduce booleans and change their values depending on the result of the try/catch blocks. We then check the booleans using simple if statements. You can omit the prints and input your code instead. Here's what it looks like: import java.io.IOException; import java.util.Scanner; public class DataTypeFinder { public static void main(String[] args) throws IOException { Scanner scan = new Scanner(System.in); String input = ""; while (true) { //so we can check multiple inputs (optional) input = scan.nextLine(); if ("END".equals(input)) { //a way to exit the loop break; } boolean isInt = true; //introduce boolean to check if input is of type Integer try { // surround with try/catch int integer = Integer.parseInt(input); //boolean is still true if it works } catch (NumberFormatException e) { isInt = false; //changed to false if it doesn't } boolean isDouble = true; //same story try { double dbl = Double.parseDouble(input); } catch (NumberFormatException e) { isDouble = false; } if (isInt) { System.out.printf("%s is integer type%n", input); } else if (isDouble) { System.out.printf("%s is floating point type%n", input); } else if (input.length() == 1) { //this could be useless depending on your case System.out.printf("%s is character type%n", input); } else if ("true".equals(input.toLowerCase()) || "false".equals(input.toLowerCase())) { System.out.printf("%s is boolean type%n", input); } else { System.out.printf("%s is string type%n", input); } } } }
upvote count: 1
type: Answer

http://stackoverflow.com/q/25735407
tagged with: date
type: Question
has answer: http://stackoverflow.com/a/25735601
tagged with: arrays
has comment: http://stackoverflow.com/comment/40237258
has answer: http://stackoverflow.com/a/25735817
score: 0
has body: I have a java program which will check for start date and end date of each item. Each Item must have their own specific start date and end date range. And this system will prompt error message if the range of new start date and end date fall within the older start date and end date. For example: Company: ABC Item_Number Start Date End Date Item 11A 01/08/2014 01/09/2014 Item 11B 02/09/2014 30/09/2014 Item 11C 18/08/2014 30/08/2014 The system will prompt error message when end user try to add item 11C. Any suggestion to resolve this issues? Thank you very much.
has answer: http://stackoverflow.com/a/25735454
answer count: 4
has title: Validate Item Fall Within Start Date And End Date
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25735833
tagged with: java

http://stackoverflow.com/comment/40382809
score: 0
comment on: http://stackoverflow.com/q/25814448
type: QuestionComment
type: Comment
has text: Yes. But how does it look then?

http://stackoverflow.com/comment/40627618
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25784281
has text: 1+ to this question which should help you get over your ban, but you'll want to improve the formatting of your posted code in future questions.
score: 0

http://stackoverflow.com/comment/40236443
has text: And would require that all boolean tests be preceded by an if-null block. Just don't recommend use of Boolean here. The OP is obviously asking an XY problem, and will be much better served if he avoids use of the wrapper class inappropriately.
comment on: http://stackoverflow.com/a/25734934
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40481148
comment on: http://stackoverflow.com/q/25869223
score: 0
has text: Read this http://docs.oracle.com/javase/tutorial/essential/concurrency/join.html . I hope this will help you.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25823293
accepted answer: http://stackoverflow.com/a/25825153
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/25823350
has answer: http://stackoverflow.com/a/25825153
has answer: http://stackoverflow.com/a/25823352
tagged with: anonymous-class
has title: Is there a way to access an anonymous class inside another anonymous class?
answer count: 3
has body: interface A { void show(); } public class Static { public static void main(String args[]) { A a = new A(){ public void show(){ System.out.println("In anonymous Class"); A b =new A(){ public void show(){ System.out.println("In nested Anonymous Class"); } }; } }; //a.show(); } } If I want the to print "In nested Anonymous Class", what should I use instead of a.show()? //EDITED LATER Thanks guys But unfortunately mis-typed the code....I didn't mean anonymous class inside a method...but inside the class itself. Sorry for the mistake. Here is the corrected code interface A { void show(); } public class Static { public static void main(String args[]) { A a = new A() { public void show() { System.out.println("In anonymous Class"); }; A b = new A() { public void show() { System.out.println("In nested Anonymous Class"); } }; }; a.show(); } }
favorite count: 0
has answer: http://stackoverflow.com/a/25823350
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java

http://stackoverflow.com/a/73464032
has body: Follow this below properties spring.jpa.properties.hibernate.format_sql=true #Turn Statics On spring.jpa.properties.hibernate.generate_statistics=true logging.level.org.hibernate.stat=debug #Show all queries spring.jpa.show-sql=true spring.jpa.properties.hibernate.format_sql=true logging.level.org.hibernate.type=trace
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25720396

http://stackoverflow.com/comment/40200343
comment on: http://stackoverflow.com/q/25715824
score: 0
type: Comment
has text: Define 'an object', 'not able', etc. It certainly has nothing to to do with the byte[].
type: QuestionComment

http://stackoverflow.com/q/25731679
favorite count: 0
has body: Which programming language is AWT ( Abstract Window Toolkit ) written in?
has comment: http://stackoverflow.com/comment/40230117
has comment: http://stackoverflow.com/comment/40231764
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25731937
has comment: http://stackoverflow.com/comment/40230325
accepted answer: http://stackoverflow.com/a/25731937
tagged with: java
has title: AWT ( Abstract Window Toolkit )
type: Question
score: -2
possible better answer: http://stackoverflow.com/a/62230575
has comment: http://stackoverflow.com/comment/40231963
tagged with: awt
answer count: 2
downvote count: 3
has comment: http://stackoverflow.com/comment/40229951
has answer: http://stackoverflow.com/a/62230575
upvote count: 1
tagged with: user-interface

http://stackoverflow.com/comment/40323202
has text: The question requires a single loop. I count three loops in your answer.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25781993

http://stackoverflow.com/q/25773589
has comment: http://stackoverflow.com/comment/41634028
has comment: http://stackoverflow.com/comment/40307008
favorite count: 0
type: Question
has body: To this question: The superqueen is a chess piece that can move like a queen, but also like a knight. What is the maximal number of superqueens on an 8X8 chessboard such that no one can capture an other? I want to write a brute force algorithm to find the maximum. Here's what I wrote: public class Main { public static boolean chess[][]; public static void main(String[] args) throws java.lang.Exception { chess = new boolean[8][8]; chess[0][0] = true; for (int i = 0; i &lt; 8; i++) { for (int j = 0; j &lt; 8; j++) { /*Loop to check various possibilities*/ if (!checkrow(i) &amp;&amp; !checkcolumn(j) &amp;&amp; !checkdiagonals(i, j) &amp;&amp; !checkknight(i, j)) { if (i != 0 || j != 0) { chess[i][j] = true; } } } }/*printing the array*/ for (int i = 0; i &lt; 8; i++) { for (int j = 0; j &lt; 8; j++) { System.out.print(((chess[i][j]) ? "T" : "x") + "|"); } System.out.println(); } } /*All working fine here*/ public static boolean checkrow(int a) { for (int i = 0; i &lt; 8; i++) { if (chess[a][i]) { return true; } } return false; } /*All working fine here*/ public static boolean checkcolumn(int a) { for (int i = 0; i &lt; 8; i++) { if (chess[i][a]) { return true; } } return false; } /*All working fine here*/ public static boolean checkdiagonals(int pi, int pj) { int i = pi - Math.min(pi, pj); int j = pj - Math.min(pi, pj); for (int k = i, l = j; k &lt; 8 &amp;&amp; l &lt; 8; k++, l++) { if (chess[k][l]) { return true; } } int i_2 = pi - Math.min(pi, pj); int j_2 = pj + Math.min(pi, pj); for (int k = i_2, l = j_2; k &lt; 8 &amp;&amp; l &gt; 1; k++, l--) { if (chess[k][l]) { return true; } } return false; } /*Not All working fine here try commenting out this method above so that that it doesn't run during the check*/ public static boolean checkknight(int pi, int pj) { for (int i = -1; i &lt;= 1; i++) { for (int j = -1; j &lt;= 1; j++) { if (0 &lt;= pi + 2 * i &amp;&amp; pi + 2 * i &lt;= 8 &amp;&amp; 0 &lt;= pj + j &amp;&amp; pj + j &lt;= 8) { if (chess[pi + 2 * i][pj + j]) …
has answer: http://stackoverflow.com/a/26433630
upvote count: 6
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/26433630
possible better answer: http://stackoverflow.com/a/26432791
tagged with: java
answer count: 3
has comment: http://stackoverflow.com/comment/41506886
has answer: http://stackoverflow.com/a/26432791
has comment: http://stackoverflow.com/comment/40307237
has answer: http://stackoverflow.com/a/26174769
has comment: http://stackoverflow.com/comment/40307166
downvote count: 0
score: 6
has title: Confused about writing a program for placing some modified queen-type pieces on an 8 x 8 board
has comment: http://stackoverflow.com/comment/40307414
type: AnsweredQuestion

http://stackoverflow.com/q/25810916
score: 3
has comment: http://stackoverflow.com/comment/40375159
has body: I use xsd schema like : &lt;xsd:element name="TrxIdRs" type="TrxIdRs_Type"/&gt; &lt;xsd:complexType name="TrxIdRs_Type"&gt; &lt;xsd:simpleContent&gt; &lt;xsd:extension base="xsd:int"&gt; &lt;xsd:attribute ref="trxStatusCode" use="required"/&gt; &lt;xsd:attribute ref="trxStatusDescr" use="required"/&gt; &lt;/xsd:extension&gt; &lt;/xsd:simpleContent&gt; &lt;/xsd:complexType&gt; &lt;xsd:attribute name="trxStatusCode" type="xsd:int"/&gt; &lt;xsd:attribute name="trxStatusDescr" type="xsd:string"/&gt; meaning XML like : &lt;TrxIdRs trxStatusCode="1" trxStatusDescr="descr"&gt; 111000111 &lt;/TrxIdRs&gt; But Castor generate only BigDecimal type for this schema : public abstract class TrxIdRs_Type implements java.io.Serializable { //--------------------------/ //- Class/Member Variables -/ //--------------------------/ /** * internal content storage */ private java.math.BigDecimal _content; /** * Field _trxStatusCode. */ private java.lang.Integer _trxStatusCode; Is there any other variants to write xsd or configure castor to have primitive type in generated bean?
has title: Castor generate BigDecimal type for integer type in xsd
tagged with: java
has comment: http://stackoverflow.com/comment/40374728
upvote count: 3
has comment: http://stackoverflow.com/comment/40374877
answer count: 1
has answer: http://stackoverflow.com/a/25811316
has comment: http://stackoverflow.com/comment/40375640
favorite count: 0
has comment: http://stackoverflow.com/comment/40375038
type: UnansweredQuestion
tagged with: xsd
has comment: http://stackoverflow.com/comment/40431843
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40381368
downvote count: 0
tagged with: castor
type: Question

http://stackoverflow.com/q/25760748
has answer: http://stackoverflow.com/a/25760903
tagged with: java
has answer: http://stackoverflow.com/a/25760853
has answer: http://stackoverflow.com/a/25760806
upvote count: 1
has comment: http://stackoverflow.com/comment/40283577
has answer: http://stackoverflow.com/a/25760836
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25760814
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25760827
has comment: http://stackoverflow.com/comment/40283476
has body: The code looks like public abstract class A { protected int a; public A() {} public A(int _a) { this.a = _a; } } public class B extends A { public B() {} public B(int _a) { super(_a + 1); } } public class C extends A { public C() {} public C(int _a) { super(_a); } public int getA() { return this.a; } } And what I did is to cast B to C, which didn't work for me: public class Main { public static void main(String[] args) { A b = new B(2); System.out.println(((C)b).getA()); } } Could I cast B to C if they extends the same abstract class?
answer count: 6
possible better answer: http://stackoverflow.com/a/25760814
score: 0
accepted answer: http://stackoverflow.com/a/25760836
favorite count: 0
has comment: http://stackoverflow.com/comment/40283542
has title: Can I cast B to C if B and C extends the same abstract class A?

http://stackoverflow.com/comment/40467963
comment on: http://stackoverflow.com/a/25861562
has text: I am getting below exception :Exception in thread "main" org.codehaus.jackson.map.JsonMappingException: Root name 'Values' does not match expected ('Value') for type [simple type, class com.domain.Value] at [Source: java.io.StringReader@e9a398d; line: 1, column: 2]
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25814344
has comment: http://stackoverflow.com/comment/40382424
score: 0
has comment: http://stackoverflow.com/comment/40389502
answer count: 1
tagged with: directory
type: UnansweredQuestion
has body: I am creating an inventory program for my dad's small business and I have a problem with accessing a folder. Before the rest of the program runs, it checks if a folder called "Dos Amantes Inventory" exists, and if not it will create it. Then it checks if there is an excel workbook in that folder, however, I run into an access denied error here trying to look inside that folder. How do I rectify this? I know it doesn't look pretty at all, and I'll clean up later, just want to get it working first, spent way too long on this already. Thanks in advance public static boolean goodToGo; //get user's desktop path public static String desktopPath = System.getProperty("user.home") + "/Desktop/Dos Amantes Inventory"; public static void main(String[] args) throws IOException{ if(!new File(desktopPath).exists()){ FileManager.createPath(); if(!new File(desktopPath + "/" + Ingredients.workbookName).exists()){ FileManager.createWorkbook(desktopPath); goodToGo = true; } else { goodToGo = true; } }else if(!new File(desktopPath + "/" + Ingredients.workbookName).exists()){ FileManager.createWorkbook(desktopPath); goodToGo = true; }else { goodToGo = true; } if(goodToGo){ start(); } } //methods from FileManager class public static void createPath(){ new File(Inventory.desktopPath + "/Dos Amantes Inventory").mkdirs(); } public static void createWorkbook(String filePath) throws IOException{ WritableWorkbook workbook; workbook = Workbook.createWorkbook(new File(filePath)); WritableSheet wsheet = workbook.createSheet(Ingredients.workbookName, 0); }
has answer: http://stackoverflow.com/a/25814406
tagged with: java
tagged with: excel
type: Question
has title: Cannont acces folder created in program

http://stackoverflow.com/q/25866708
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25866735
type: Question
has title: formatting date in Java?
tagged with: format
tagged with: java
possible better answer: http://stackoverflow.com/a/25866877
tagged with: date
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25866735
duplicate of: http://stackoverflow.com/q/4772425
has answer: http://stackoverflow.com/a/25866877
linked to: http://stackoverflow.com/q/4772425
has body: I need that the returned date string would have the format: "DD/MM/YYYY" i.e. 2 digits for day and month and 4 digits for year. Example: int day = 11; int month = 2; int year = 1997; be returned as "11/02/1997" Any suggestions?

http://stackoverflow.com/comment/40445773
type: AnswerComment
has text: MainApp app = new MainApp(); app.initializeAndShowStage(stage); this part contradicts the "only main can be called" part
type: Comment
comment on: http://stackoverflow.com/a/25790928
score: 0

http://stackoverflow.com/comment/135371451
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/32029297
has text: As written in the plugin documentation (https://maven.apache.org/surefire/maven-failsafe-plugin/integration-test-mojo.html#test), specifying it.test will override `excludes` and `includes`.

http://stackoverflow.com/q/25813993
has body: I have an java app that connects to a database. I have some computers connected in the same router and one of them is supposed to be the server. So in its localhost I created the database with the tables. Let's say that the db is in A, with IP 192.168.0.a and the app is in computer B with IP 192.168.0.b! To access the db from B I must do something like this jdbc:mysql://192.168.0.a:3306/dbName, but if I do not add a user in database with host 192.168.0.b, the app will not work. So the question is: Is there a way to tell the database to accept request from all computers without adding users manually? Thanks in advance!
has comment: http://stackoverflow.com/comment/40380720
type: Question
has answer: http://stackoverflow.com/a/25815166
has comment: http://stackoverflow.com/comment/40380813
tagged with: database
has comment: http://stackoverflow.com/comment/40380825
score: 0
answer count: 1
has title: Can't access mysql database from java application
has comment: http://stackoverflow.com/comment/40382785
has comment: http://stackoverflow.com/comment/40380793
linked to: http://stackoverflow.com/q/14779104
accepted answer: http://stackoverflow.com/a/25815166
type: AnsweredQuestion
tagged with: java
tagged with: mysql

http://stackoverflow.com/a/25815306
answers question: http://stackoverflow.com/q/25814671
has body: You can copy a class with byte-code manipulation libraries (Javassist, Asm, BCEL). With Javassist it would be along the lines of (haven't tried): ClassPool pool = ClassPool.getDefault(); CtClass cc = pool.get("ClassA"); cc.setName("ClassB"); cc.writeFile("ClassB.class");
type: Answer
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25814671

http://stackoverflow.com/comment/40327404
has text: Hmm what your model looks like ? Simple POJO with no annotation works in gwt-jackson. Even if it's in another package. You just have to be sure the package is included in your *.gwt.xml. If it is not, you won't be able to use the model class at all in GWT. If you use the TestModul you posted, you probably have to declare Dummy as static.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25769439

http://stackoverflow.com/q/25783242
has answer: http://stackoverflow.com/a/25788946
type: Question
has body: We're planning to use Infinispan 6.x in master/slave mode with all writes and reads directed to one node; other nodes only serving as backup using asynchronous replication. In ASYNC replication mode, Infinispan's local writes seem to be asynchronous as well, i.e. a put(x) immediately followed by get(x) on the same node, causes get() to return null. (see this discussion.) We have a use case in which a client forces a put(x) and then, in a subsequent request, a get(x). How can we ensure that by the time the second request arrives, the entry is in local data container (local map)? SYNC mode is out of the question for performance reasons.
tagged with: distributed
has title: Ensure local write with async Infinispan 6.x
answer count: 1
tagged with: infinispan
tagged with: redhat
score: 0
type: UnansweredQuestion
tagged with: nosql
tagged with: java

http://stackoverflow.com/comment/40212331
type: AnswerComment
score: 0
type: Comment
has text: no i guess, refer this [Time Class](http://developer.android.com/reference/android/text/format/Time.html)
comment on: http://stackoverflow.com/a/25721966

http://stackoverflow.com/a/25852864
has comment: http://stackoverflow.com/comment/40451646
score: 3
has body: That's not how you call main. If you don't specify any arguments, the args variable is not null; it's an empty array. Memman.main(new String[]{}); You could also use varargs instead of an array, then just call main with no arguments. Edit: As Holger pointed out, it looks like you're trying to use setSystemIn() to pass arguments into the main() method. That won't work. Instead, you should just pass them into the array: Memman.main(new String[]{"10", "32", "P1sampleInput.txt"}); This is the first result for googling "junit pass arguments to main": Passing command line arguments to JUnit in Eclipse
has comment: http://stackoverflow.com/comment/40452650
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/25852781
has comment: http://stackoverflow.com/comment/40451668
downvote count: 0

http://stackoverflow.com/q/25726174
has answer: http://stackoverflow.com/a/50636124
has comment: http://stackoverflow.com/comment/40219362
accepted answer: http://stackoverflow.com/a/25726284
tagged with: api
downvote count: 0
favorite count: 0
tagged with: io
upvote count: 1
has title: Add a paragraph in File
type: AnsweredQuestion
has body: I would like to write a paragraph using file. This is my code(my effort). import java.io.*; import java.util.Scanner; public class Test { public static void main (String [] args) { Scanner input = new Scanner(System.in); try { BufferedWriter out = new BufferedWriter(new FileWriter("C:/Users/Akram/Documents/akram.txt")) ; System.out.println("Write the Text in the File "); String str = input.nextLine(); out.write(str); out.close(); System.out.println("File created successfuly"); } catch (IOException e) { e.printStackTrace(); } } } With this code I can add just one word but I want to add a lot of word (paragraph).
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25726284
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/50636124

http://stackoverflow.com/comment/40443366
type: Comment
type: QuestionComment
score: 0
has text: Look at java.util.concurrent.ThreadPoolExecutor
comment on: http://stackoverflow.com/q/25836908

http://stackoverflow.com/q/25785026
has comment: http://stackoverflow.com/comment/40328930
has comment: http://stackoverflow.com/comment/40328998
has comment: http://stackoverflow.com/comment/40327640
has answer: http://stackoverflow.com/a/25785403
has title: Android, splitting a .csv by line break?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40327626
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40329988
type: Question
answer count: 1
accepted answer: http://stackoverflow.com/a/25785403
has body: Firstly, I'm crap at english. I hope it's okay; I have a small project to do: parsing a .csv file: Typical .csv file The recording starts at 2014,Sep,9,4:40:24 PM accX,accY,accZ,gX,gY,gZ, -0.3958511,0.014643669,10.037987,-13.17548,-2.3169785,-3.2103431, -0.29875562,0.014643669,10.037987,-53.558975,0.22515106,-36.11273, -0.29875562,0.014643669,10.23412,-50.653694,0.7335739,-32.481117, The recording ends at 2014,Sep,9,4:40:29 PM I tried OPENcsv library but I couldn't make it work. So I find an explaination on stackOverFlow, and I used it, it works well. Initially, it split the file with commas "," and it works. But I changed it to split it by line break, as you can see with line.split("\r?\n"). It doesn't work, it crash in fact. MainActivity.java File f = new File(path + "/" + "motionTracker/"); File f2 = new File(f + "/" + stringx); try { fis = new FileInputStream(f2.toString()); } catch (FileNotFoundException e1) { // handle exception } BufferedReader reader = new BufferedReader(new InputStreamReader(fis)); String date = "kek"; String value = "wow"; String line = "lel"; try { while ((line = reader.readLine()) != null) { String[] RowData = line.split("\\r?\\n"); date = RowData[0]; value = RowData[1]; } } catch (IOException ex) { // handle exception } finally { try { fis.close(); } catch (IOException e) { // handle exception } } Do you think the problem is because there are no line break in a .csv file? Or maybe I did something wrong with my code. Thanks.
score: 0
tagged with: http://stackoverflow.com/tag/csv
tagged with: android

http://stackoverflow.com/q/25844326
downvote count: 0
tagged with: javascript
favorite count: 0
has body: I have the below angularJS code to parse the JSON in .js file: $scope.updateAssociations = function() { $scope.productModel = angular.toJson($rootScope.relationShipModel); alert($scope.productModel); var requestObj = { "channelCode": $rootScope.userSelectedChannel, "modelTypeName" : $rootScope.selectedHierarchy.hier_name, "relationShips" : $scope.productModel, "associations" : $scope.selection, "relID" : $routeParams.relID, "prdCmptId" : $routeParams.prdCmpntId, "associationsModelTypeName" : $rootScope.associationsModelTypeName }; var result = $http.post('updateAssociations.do', requestObj); result.success( function(response) { } }); I am not getting the "relationShips" value in the Java class: ObjectMapper mapper=new ObjectMapper(); JsonNode node = mapper.readTree(requestBody); RelationshipType relations = mapper.readValue(node.get("relationShips"), RelationshipType.class); While the code try to retrieve value from mapper, I get the below exception: org.codehaus.jackson.map.JsonMappingException: Can not instantiate value of type [simple type, class com.cpc.as.bean.RelationshipType] from JSON String; no single-String constructor/factory method. My relationShips JSON is: [ { "chnl_code":"BMG Catalog", "rel_id":"59", "rel_type_name":"product collateral assignment", "entity_type_name":"generic feature", "entity_role":"parent", "related_to_entity":"collateral", "related_to_crdnlty":"m", "related_to_role":"child", "dsply_name":"Collateral", "hier_flag":null, "related_to_object_type":"product", "sub_role":null, "atrbt_ind":"n", "dpndnt_flag":"n", "rel_ind":"n", "dsply_model_type_name":null, "sub_dsply_name":null, "gen_new_flag":"y", "allowDefaultSearchFlag":false, "custom_price_type":null, "rls_type":null, "gradeMatrixRelated":false, "releaseDriven":false }, { "chnl_code":"BMG Catalog", "rel_id":"55", "rel_type_name":"feature family assignment", "entity_type_name":"generic feature", "entity_role":"parent", "related_to_entity":"feature family", "related_to_crdnlty":"m", "r…
tagged with: angularjs
has title: Can not instantiate value of type [simple type, class com.RelationshipType] from JSON String; no single-String constructor/factory method
answer count: 0
type: UnansweredQuestion
upvote count: 1
duplicate of: http://stackoverflow.com/q/11127376
type: Question
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/11127376

http://stackoverflow.com/q/25800465
tagged with: apk
has answer: http://stackoverflow.com/a/26259604
has answer: http://stackoverflow.com/a/25800781
score: 2
has comment: http://stackoverflow.com/comment/40356403
downvote count: 0
has body: I've just published an app of mine to the Google Play Store and it seems that it keeps force closing and crashing on the users. I am not asking for a solution as to why, but i am curious. On eclipse i have the Emulator and the target API of my app was Android-19 (it's 17 now because i'm changing that to see if it'll help). And while in eclipse and while running the emulator, with several devices (tablets, nexus one and such) , and the app works perfectly fine. My friend has sent me a screenshot and the message that comes up once they try to open the app is "Unfortunately, Data Tool has stopped." Any brainstorming ideas? -Colt THIS ISSUE IS NOW FIXED!
has title: Exported APK Not Working
type: Question
has comment: http://stackoverflow.com/comment/40356951
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40356652
has comment: http://stackoverflow.com/comment/40356407
tagged with: java
has comment: http://stackoverflow.com/comment/40356803
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/26259604
has comment: http://stackoverflow.com/comment/40356885
has comment: http://stackoverflow.com/comment/40356978
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/40356505
has comment: http://stackoverflow.com/comment/40356627
favorite count: 0
accepted answer: http://stackoverflow.com/a/25800781
tagged with: google-play
tagged with: android

http://stackoverflow.com/comment/40368038
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25806441
has text: If the data is too large to store in memory and you can't increase memory then your options are limited - either process as a stream, extracting what you need, or persisting the data somewhere for later access.

http://stackoverflow.com/comment/40270295
type: Comment
has text: The error message of the compiler tells you what the problem is. Read it. `ele` is of generic type T. T doesn't extend Comparable. Why would you be able to call compareTo?
comment on: http://stackoverflow.com/q/25753085
score: 0
type: QuestionComment

http://stackoverflow.com/a/25854507
type: AcceptedAnswer
downvote count: 0
score: 3
type: Answer
has body: Here is an initial approach please modify it accord to your need ... public static void permutationForAString(String str) { permutation("", str); } private static void permutation(String prefix, String str) { int n = str.length(); if (n == 0) System.out.println(prefix); else { for (int i = 0; i &lt; n; i++) permutation(prefix + str.charAt(i), str.substring(0, i) + str.substring(i+1, n)); } } Note this doesn't consider repetition ... permutationForAString("ABC"); will give output as ABC ACB BAC BCA CAB CBA
accepted answer of: http://stackoverflow.com/q/25854054
upvote count: 3
answers question: http://stackoverflow.com/q/25854054

http://stackoverflow.com/comment/58827912
score: 0
type: QuestionComment
type: Comment
has text: Did you manage to get around this issue? I faced a similar issue and still haven't managed to solve it [[link](http://stackoverflow.com/questions/35306866/file-length-is-0-when-recreating-file-from-uri-or-original-filepath-getexterna)]
comment on: http://stackoverflow.com/q/25851555

http://stackoverflow.com/comment/40198736
type: QuestionComment
has text: The error you reported below trying to debug, `Cannot connect to VM Socket closed`, strongly suggests you are *NOT* running the code. Q: Is the application an Android app? A web app? Or just a normal "Java application"?
score: 0
comment on: http://stackoverflow.com/q/25714048
type: Comment

http://stackoverflow.com/comment/40231817
comment on: http://stackoverflow.com/q/25732534
type: QuestionComment
has text: It looks like the simplest way to get a Seq from java is to use [JavaConversions][1] [1]: http://stackoverflow.com/questions/6784593/how-to-create-a-scala-collection-immutable-seq-from-a-java-list-in-java
type: Comment
score: 1

http://stackoverflow.com/q/25772908
tagged with: jgit
linked to: http://stackoverflow.com/q/29294910
tagged with: java
has body: I'm trying to crawl a GitHub Wiki with JGit. When I try it with one URL, it worked perfectly fine. Then I tried it with another random URL and got an error. Please see the extract of my code: import java.io.File; import java.io.IOException; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; public class Main { // with this URL I get an error String url = "https://github.com/radiant/radiant.wiki.git"; // this URL works // String url = "https://github.com/WardCunningham/Smallest-Federated-Wiki.wiki.git"; public static void main(String[] args) { Main m = new Main(); m.jgitTest(); System.out.println("Done!"); } public void jgitTest() { try { File localPath = File.createTempFile("TestGitRepository", ""); localPath.delete(); Git.cloneRepository().setURI(url).setDirectory(localPath).call(); } catch (IOException | GitAPIException e) { System.err.println("excepton: " + e.getMessage()); e.printStackTrace(); } } } This is the stack trace: Exception in thread "main" org.eclipse.jgit.dircache.InvalidPathException: Invalid path (contains separator ':'): How-To:-Create-an-Extension.textile at org.eclipse.jgit.dircache.DirCacheCheckout.checkValidPathSegment(DirCacheCheckout.java:1243) at org.eclipse.jgit.dircache.DirCacheCheckout.checkValidPathSegment(DirCacheCheckout.java:1225) at org.eclipse.jgit.dircache.DirCacheCheckout.checkValidPath(DirCacheCheckout.java:1185) at org.eclipse.jgit.dircache.DirCacheCheckout.processEntry(DirCacheCheckout.java:311) at org.eclipse.jgit.dircache.DirCacheCheckout.prescanOneTree(DirCacheCheckout.java:290) at org.eclipse.jgit.dircache.DirCacheCheckout.doCheckout(DirCacheCheckout.java:408) at org.eclipse.jgit.dircache.DirCacheCheckout.checkout(DirCacheCheckout.java:393) at org.eclipse.jgit.api.CloneCommand.checkout(CloneCommand.java:236) at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:127) at Main.jgitTest(Main.java:21) at Main.main(Main.java:13) If you visit the wiki page of the URL that doesn't work (http…
accepted answer: http://stackoverflow.com/a/25772968
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/35322067
tagged with: github
favorite count: 0
possible better answer: http://stackoverflow.com/a/35322067
has title: Crawling GitHub with JGit
has answer: http://stackoverflow.com/a/25772968
upvote count: 3
tagged with: git
type: Question
type: AnsweredQuestion
score: 3

http://stackoverflow.com/q/25786185
has answer: http://stackoverflow.com/a/25786667
type: Question
tagged with: configuration
has answer: http://stackoverflow.com/a/25787123
has answer: http://stackoverflow.com/a/25786410
score: 15
upvote count: 15
answer count: 3
possible better answer: http://stackoverflow.com/a/25787123
accepted answer: http://stackoverflow.com/a/25786667
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/5900434
tagged with: maven
has body: Using Eclipse that was being used prior on the project by another developer. Most things are flagged as red and broken. Seeing files in src/main/java/... and the same exact files over in java resources/src/main/java... Just confused over what is what, what is temp, what to keep to trash or how to fix the project environment. Any easy fix to this?
type: AnsweredQuestion
has title: What is the purpose for the resource folder in Maven?
tagged with: java

http://stackoverflow.com/a/25808859
score: 0
has comment: http://stackoverflow.com/comment/40370970
type: Answer
has comment: http://stackoverflow.com/comment/40370764
answers question: http://stackoverflow.com/q/25808766
has body: Once the connection has been established a boolean flag should be set to true which would denote that the connection to the server has been established. If the flag is found to be true then we will not test the connection any longer. Also I was wondering that if ur catching IOException in testConenction method then the Exception will not get propagated to the calling method.
has comment: http://stackoverflow.com/comment/40370925
has comment: http://stackoverflow.com/comment/40370703

http://stackoverflow.com/comment/40441715
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25847508
type: Comment
has text: You have assigned the `fileAppender` to a `Logger` named `fileLogger`. Unless you do `LogManager.getLogger("fileLogger")` you have not created this logger and nothing will be logger to the file.

http://stackoverflow.com/comment/40486329
type: Comment
type: QuestionComment
has text: for sure. if he says, the sky is not blue you should accept it cuz he is that great :)
comment on: http://stackoverflow.com/q/25862081
score: 0

http://stackoverflow.com/comment/40325978
type: QuestionComment
comment on: http://stackoverflow.com/q/25784141
score: 1
has text: AFAIK you can execute USSD codes for that. Take a look at http://stackoverflow.com/questions/7225100/how-to-run-ussd-commands-on-android and find the USSD to set/change the pin. I think it can work
type: Comment

epub
type: Tag
tags question: http://stackoverflow.com/q/25822541
tag name: epub

http://stackoverflow.com/comment/40422238
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25832120
has text: Do you leave out the border cells on purpose?
type: Comment

http://stackoverflow.com/a/28051541
has body: You can initialize Log4j2 programmatically. There is an example here on the Log4j2 website under the section 'Programatically Adding to the Current Configuration' showing how to add an appender.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25822665
type: Answer

http://stackoverflow.com/comment/40219893
type: Comment
has text: +1 for the step-by-step explanation, it shows beginners how to investigate such bugs by themselves so that they don't come to SO each time a NPE is thrown.
type: AnswerComment
comment on: http://stackoverflow.com/a/25726298
score: 0

http://stackoverflow.com/comment/40333948
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25788428
score: 0
has text: @ ortis and espinosa it is kind of embarrassing now for me, but if i directly enter all the path in the terminal it doesn't locate the file, but my going one by one through cd and entering cat HelloWorld inside the MyFirstProject directory prints the contents of the file

http://stackoverflow.com/q/25770145
has body: Just out of curiosity. When I hover over Object word in eclipse, the doc shows the below info. I would like to know what the Version represent. This does not appear on the online oracle javadocs http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html Also, futher checking Object class, the very intial comments show %W% %E%. I would like to know what are these identifiers for?
has answer: http://stackoverflow.com/a/25770475
has title: What are %I% and %G% identifiers in Object class javadoc?
score: 2
upvote count: 2
has answer: http://stackoverflow.com/a/25770414
type: UnansweredQuestion
type: Question
tagged with: object
tagged with: java
tagged with: eclipse
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40237316
has text: Thanks, MadProgrammer, I should have caught that `static`, it was just a habit after doing it so much in other programs. Also, I knew about that shortcut, madhawa priyashantha. I had just changed it to make sure it wasn't causing some sort of problem. Thanks again, guys!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25735394

http://stackoverflow.com/q/25859950
has answer: http://stackoverflow.com/a/25860095
tagged with: synthesizer
has body: I've been working in a project where I need to manipulate each instrument in a MIDI file in java. Then I decided to get each MIDI Event from each track from the Sequence and send it to a Receiver. After that the thread waits the time each tick lasts then do it again with the next tick. The problem is: the sound of the instruments gets very messed, as well as their order. I tried to execute each track alone too, but it's still messed! The code: Sequence sequence = MidiSystem.getSequence(new File(source)); Synthesizer synth = MidiSystem.getSynthesizer(); //Gets a MidiMessage and send it to Synthesizer Receiver rcv = synth.getReceiver(); //Contains all tracks and events from MIDI file Track[] tracks = sequence.getTracks(); synth.open(); //If there are tracks if(tracks != null) { //Verify the division type of the sequence (PPQ, SMPT) if(sequence.getDivisionType() == Sequence.PPQ) { int ppq = sequence.getResolution(); //Do the math to get the time (in miliseconds) each tick takes long tickTime = TicksToMiliseconds(BPM,ppq); //Returns the number of ticks from the longest track int longestTrackTicks = LongestTrackTicks(tracks); //Each iteration sends a new message to 'receiver' for(int tick = 0; tick &lt; maiorTick ; tick++) { //Iteration of each track for(int trackNumber = 0; trackNumber &lt; tracks.length; trackNumber++) { //If the number of ticks from a track isn't already finished //continue if(tick &lt; tracks[trackNumber].size()) { MidiEvent ev = tracks[trackNumber].get(tick); rcv.send(ev.getMessage(),-1); } } Thread.sleep(tickTime); } } } synth.close();
type: AnsweredQuestion
tagged with: audio
possible better answer: http://stackoverflow.com/a/25860095
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25863018
type: Question
has title: MIDI Java generates messed sound
answer count: 3
score: 2
downvote count: 0
tagged with: midi
has answer: http://stackoverflow.com/a/25863018
favorite count: 0
has answer: http://stackoverflow.com/a/25875842

http://stackoverflow.com/comment/40452854
comment on: http://stackoverflow.com/q/25853321
has text: Do you have a specific problem you are having trouble with? Currently, this question is a bit too broad to get any real help here on SO.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25724672
has title: how to Use RoundedImageView For Picasso in android
downvote count: 0
has answer: http://stackoverflow.com/a/30433680
favorite count: 0
has body: i Want To Load Image From Picasso Library in RoundedImageView I am Taking Refrence From https://github.com/vinc3m1/RoundedImageView I Really Unable To Understand How To Use For RoundedImageView Can You please Tell Me How To use..I m Unable To understand..how to use When I set Layout &lt;com.makeramen.RoundedImageView xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/imageView1" android:src="@drawable/photo1" android:scaleType="centerCrop" app:corner_radius="30dip" app:border_width="2dip" app:border_color="#333333" app:mutate_background="true" app:oval="true" /&gt; instead Of ImageView...Giving Error ... i dowloaded Java.doc.jar of roundedImageview from here http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.makeramen%22%20AND%20a%3A%22roundedimageview%22 and add to the libs folder and build path After Adding ...no resourc Found update //tv_gender.setText(Gender); iv = (ImageView)rootView.findViewById(R.id.imageView1); tv_intrseted.setText(IntrestedIn); // Button logout=(Button)rootView.findViewById(R.id.logout); RoundedImageView iv = new RoundedImageView(context); iv.setScaleType(ScaleType.CENTER_CROP); iv.setCornerRadius(10); iv.setBorderWidth(2); iv.setBorderColor(Color.DKGRAY); iv.setMutateBackground(true); iv.setImageDrawable(drawable); iv.setBackground(backgroundDrawable); iv.setOval(true); if I use Like This giving error ..Can not be Resolved RoundedImageView
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25725220
tagged with: maven
answer count: 4
score: 2
has comment: http://stackoverflow.com/comment/40216663
tagged with: java
has comment: http://stackoverflow.com/comment/40216666
has answer: http://stackoverflow.com/a/41215959
type: Question
has answer: http://stackoverflow.com/a/25725275
has comment: http://stackoverflow.com/comment/40216611
upvote count: 2

http://stackoverflow.com/a/25871924
score: 0
has body: I suggest to you an object-oriented approach, taking advance of the facilities of the Collections API. It is quite clearer: Code an extension of ArrayList overriding the add() method, so that it only includes positive numbers. Code another extension for negatives. Then, all you need is create four collections: A List to include the original array items. A positive ArrayList. A negative ArrayList. A Set for the not-duplicates. ... and just ONE loop, to iterate the original array adding an item to every collection. After all, remove the not-duplicates from the original list through the removeAll method.
answers question: http://stackoverflow.com/q/25871228
type: Answer

http://stackoverflow.com/comment/40410619
score: 6
comment on: http://stackoverflow.com/q/25830388
has text: You can barely get such output. The execution order of threads is unpredictable, so it's very odd that you will get the same output unless you use synchronization between your threads but that would be overkill for this example.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25811707
score: 0
type: Answer
has body: You need to escape any ' character in your cdAlbum.getTitle(), cdAlbum.getGenre(), cdAlbum.getArtist(), cdAlbum.getTracks() strings. Better yet, use prepared statement and it will handle this for you and as a bonus you won't be vulnerable to SQL injection.
answers question: http://stackoverflow.com/q/25811597

http://stackoverflow.com/comment/40334637
type: Comment
type: QuestionComment
has text: @duffymo: Die hard tests aren't relevant to this question. Good random number generators _will_ produce duplicate values without cycling, and some of the best ones have cycles so long that you couldn't possibly determine them by explicit enumeration testing. If you generate 2 digit decimal numbers from a 32 bit generator, there will be duplicates. If you generate `int`s using Java's built-in generator, which is a 48 bit LCG, there will be duplicates.
score: 0
comment on: http://stackoverflow.com/q/25777223

http://stackoverflow.com/comment/40217377
comment on: http://stackoverflow.com/a/25725107
has text: Also note that this will perhaps not work as expected: When you return the value, the timer might not have run yet...
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25789573
has comment: http://stackoverflow.com/comment/40342485
has answer: http://stackoverflow.com/a/25793033
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25793802
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I have a JSON feed which I am trying to parse: { "test": [ "5", { "data": "someData", "number": "9" }, { "data": "someData", "number": "9" } ] } I am using Jackson to parse the JSON file for me and using annotations: private ArrayList&lt;Test&gt; test = new ArrayList&lt;Test&gt;(); /** * @param test the test to set */ public void setTest(ArrayList&lt;Test&gt; test) { this.test = test; } And my Test class: class Test{ private String data= ""; private String number= ""; /** * @return the data */ public String getData() { return data; } /** * @param data the data to set */ public void setData(String data) { this.data= data; } /** * @return the number */ public String getNumber() { return number; } /** * @param number the number to set */ public void setNumber(String number) { this.number= number; } } If I remove the 5 from my JSON, it works fine. However the 5 will be in the feed so I need a way to parse it. I'm completely new to jackson and annotations in general and after spending most of the day trying to figure this out without any luck, I need some help! How can I ignore the "5" if its not named, I've tried creating a container class which holds a String and the ArrayList and passed that as a paramater to the setTest method but that didnt work either.
type: UnansweredQuestion
tagged with: jackson
has title: How to get unnamed property from Json file using Jackson?
has comment: http://stackoverflow.com/comment/40342169
has answer: http://stackoverflow.com/a/25793636
type: Question

http://stackoverflow.com/comment/40390438
type: Comment
has text: @ban-geoengineering - I have code to read Android's sensors using JNI and then seed a random number generator (like OpenSSL or Crypto++). You could use it to do the same, or use it to seed a Java HMAC/SHA-1 generator. The "meat and potatoes" source file is on Pastebin at [Android/Crypto++ PRNG auto-seeded from sensors (by JWW)](http://pastebin.com/0DtQ77MA). I hope to upload the Eclipse project to the [Crypto++ wiki](http://www.cryptopp.com/wiki/Main_Page) soon (the wiki is having trouble at the moment due to a configuration change).
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25817133

http://stackoverflow.com/comment/40447703
score: 0
has text: What is "one of the method calls" Are you talking about library code calling your code? Your code calling library code? or library code calling library code? `Thread.currentThread()` returns the Thread object that controls the calling thread. If you did write (or can write)_ any of the code that is "supposed to run in a separate thread", then you can add a call to Thread.currentThread() to get the thread's identity. Then you can test it to see whether it is a different Thread object from some other Thread.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25850060

jframe
tags question: http://stackoverflow.com/q/25840381
tags question: http://stackoverflow.com/q/25762772
tag name: jframe
tags question: http://stackoverflow.com/q/25750368
tags question: http://stackoverflow.com/q/25835577
tags question: http://stackoverflow.com/q/25725969
tags question: http://stackoverflow.com/q/25832726
tags question: http://stackoverflow.com/q/25819745
tags question: http://stackoverflow.com/q/25789047
tags question: http://stackoverflow.com/q/25835553
tags question: http://stackoverflow.com/q/25738718
tags question: http://stackoverflow.com/q/25827289
tags question: http://stackoverflow.com/q/25748025
tags question: http://stackoverflow.com/q/25740873
tags question: http://stackoverflow.com/q/25862081
tags question: http://stackoverflow.com/q/25821874
tags question: http://stackoverflow.com/q/25715111
tags question: http://stackoverflow.com/q/25740510
tags question: http://stackoverflow.com/q/25868376
tags question: http://stackoverflow.com/q/25767503
tags question: http://stackoverflow.com/q/25803072
tags question: http://stackoverflow.com/q/25846441
tags question: http://stackoverflow.com/q/25846326
type: Tag
tags question: http://stackoverflow.com/q/25843064
tags question: http://stackoverflow.com/q/25734400
tags question: http://stackoverflow.com/q/25870584
tags question: http://stackoverflow.com/q/25813108

http://stackoverflow.com/a/25792923
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25792778
has body: Two approaches: Put that stuff in to a database. Read documentation for properties and subclasses

http://stackoverflow.com/q/25839054
tagged with: java
upvote count: 1
tagged with: eclipse
has title: Eclipse For wrong version of Java
downvote count: 1
type: Question
tagged with: minecraft
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40426817
favorite count: 0
has comment: http://stackoverflow.com/comment/40426831
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40426811
has answer: http://stackoverflow.com/a/25839073
has body: I want to make a mod for Minecraft, and i have Java and JDK 7, because it's not compatible with Java 8. but the new Eclipse is for Java 8, and i can't find anywhere a Eclipse version for Java 7.

http://stackoverflow.com/a/25892117
score: 0
has comment: http://stackoverflow.com/comment/40612276
answers question: http://stackoverflow.com/q/25809769
type: Answer
has body: I think there is some inconsistency in your object model If I understand your model correctly then this should hold: this == this.previousMonth.nextMonth this == this.nextMonth.previousMonth Here is a simple reproducing test case: @NodeEntity public class Month { @GraphId private Long id; private String name; @RelatedTo(type = "MY_REL", direction = Direction.OUTGOING) Month next; @RelatedTo(type = "MY_REL", direction = Direction.INCOMING) Month previous; Test code: Month m1 = new Month("m1"); Month m2 = new Month("m2"); Month mX = new Month("mX"); // this is correct m1.setNext(mX); mX.setPrevious(m1); // this messes up the model m2.setNext(mX); monthRepository.save(m1); monthRepository.save(mX); monthRepository.save(m2); Result&lt;Month&gt; result = monthRepository.findAll(); List&lt;Month&gt; all = result.as(List.class);

http://stackoverflow.com/comment/40431251
score: 0
comment on: http://stackoverflow.com/q/25841382
type: Comment
type: QuestionComment
has text: What programming language is this?

jsoup
tags question: http://stackoverflow.com/q/25724551
tags question: http://stackoverflow.com/q/25851999
tags question: http://stackoverflow.com/q/25747010
tags question: http://stackoverflow.com/q/25856019
tags question: http://stackoverflow.com/q/25831035
type: Tag
tag name: jsoup
tags question: http://stackoverflow.com/q/25746225
tags question: http://stackoverflow.com/q/25751956
tags question: http://stackoverflow.com/q/25833056
tags question: http://stackoverflow.com/q/25829383
tags question: http://stackoverflow.com/q/25731346
tags question: http://stackoverflow.com/q/25871997
tags question: http://stackoverflow.com/q/25840304
tags question: http://stackoverflow.com/q/25817318
tags question: http://stackoverflow.com/q/25862531

http://stackoverflow.com/comment/40219796
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25726303
has text: Hey, thanks for the reply! May I know why did you recommend me to not use a for-each loop? For learning purposes?
score: 0

http://stackoverflow.com/comment/40223508
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25728055
score: 0
has text: Oooh, now I understand! Your answer is awesome. Very comprehensive and clear. Ofcourse compiler can't decide which version of method to use if referred objects types change at runtime.

http://stackoverflow.com/comment/40263249
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25749630
type: QuestionComment
has text: "go" is not implemented inside your `while(true)`, right?

http://stackoverflow.com/comment/40208240
comment on: http://stackoverflow.com/a/25715387
has text: Thank you so much,how can I get an item using map value ?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25869252
favorite count: 0
has title: Design Suggestion - JSON parsing and processing of MSSQL DB records
has comment: http://stackoverflow.com/comment/40481177
tagged with: jdbc
tagged with: spring-jdbc
upvote count: 2
type: UnansweredQuestion
has body: I am writing a framework which needs to fetch large number of records from a MSSQL DB and each record/row has a JSON data which I need to parse and then do some computation out of that JSON data. Parsing and computation of each record is independent. So looking for some design suggestions for this framework. Below are some details. Language : Java No of DB records : pretty large so would need some kind of batching and parallel processing. Libraries currently thinking of to use : GSON (any other suggestion?) -Thanks
score: 2
has comment: http://stackoverflow.com/comment/40481199
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25869450
has comment: http://stackoverflow.com/comment/40484208

http://stackoverflow.com/comment/40421115
type: Comment
has text: The first (inner) loop could probably be made much faster by converting to a binary search, I might do that now...
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25836015

http://stackoverflow.com/comment/40445096
comment on: http://stackoverflow.com/a/25848926
type: Comment
has text: So this was some strange quirk from eclipse. I precautionally deleted all old runconfigurations, but still the same. Had to restart eclipse. Now it is working as expected.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40273693
type: Comment
comment on: http://stackoverflow.com/a/25754723
score: 0
type: AnswerComment
has text: your fix worked, NO_PADDING on the android side would require me to pad it on the C# side, right? That's what I did and it fixed the issue. None of the outputs were padded from the Android side

http://stackoverflow.com/a/25813901
answers question: http://stackoverflow.com/q/25805177
score: 1
accepted answer of: http://stackoverflow.com/q/25805177
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
has body: Remove this line: sortHandler.setList(getLicenseUsers()); You already passed a List into the SortHandler constructor in sortHandler = new ListHandler&lt;GWTLicenseUser&gt;(getLicenseUsers()); Also, instead of setLicenseUsers(tmpLicenseUsers); you may need to use licenseUsers.addAll(tmpLicenseUsers); I hope one of them fixes the problem.

http://stackoverflow.com/comment/40242537
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25738062
has text: How using `Servlet Filter` to validate your requirement in front of webservice calls??
score: 0

http://stackoverflow.com/q/25763592
answer count: 0
has title: Symmetric Encryption isn't working
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40311604
tagged with: encryption
has comment: http://stackoverflow.com/comment/40288223
tagged with: java
has comment: http://stackoverflow.com/comment/40288383
type: Question
has comment: http://stackoverflow.com/comment/40290122
has body: I am trying to generate cipher text and decrypted data. I already have assigned my incrypted value and key. But when I run the program in netbeans it shows error in the execution area, but no cipher text and decrypted data is produced. Encryption.java: package encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Encryption { private static byte[] message; public static void main(String[] args) throws Exception { byte[] message = {0, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 2, 3, 8, 9}; byte[] key = {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4}; byte[] ciphertext; byte[] decrypted; Sender s = new Sender(); s.send(message); Receiver r = new Receiver(); r.receive(message); // TODO code application logic here } } Sender.java: package encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Sender { private Cipher encoder; private SecretKeySpec myKey; public Sender() throws Exception { encoder = Cipher.getInstance("AES"); } public void setKey(byte[] key) throws Exception { myKey = new SecretKeySpec(key, "AES"); encoder.init(Cipher.ENCRYPT_MODE, myKey); } public byte[] send(byte[] message) throws Exception { return encoder.doFinal(message); } } Receiver.java: package encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Receiver { private Cipher decoder; private SecretKeySpec myKey; public Receiver()throws Exception{ decoder=Cipher.getInstance("AES"); } public void setKey(byte[] key) throws Exception{ myKey= new SecretKeySpec(key ,"AES"); decoder.init(Cipher.DECRYPT_MODE, myKey); } public byte[] receive(byte[] message) throws Exception{ return decoder.doFinal(message); } }
score: 0
has comment: http://stackoverflow.com/comment/40288372

http://stackoverflow.com/a/25750609
answers question: http://stackoverflow.com/q/25749486
type: Answer
score: 14
has comment: http://stackoverflow.com/comment/40266199
has comment: http://stackoverflow.com/comment/40266127
has comment: http://stackoverflow.com/comment/40265577
downvote count: 0
has comment: http://stackoverflow.com/comment/40265812
has comment: http://stackoverflow.com/comment/40266104
has comment: http://stackoverflow.com/comment/40265614
has comment: http://stackoverflow.com/comment/40265755
has comment: http://stackoverflow.com/comment/40266268
has comment: http://stackoverflow.com/comment/40265951
has comment: http://stackoverflow.com/comment/40265443
upvote count: 14
has comment: http://stackoverflow.com/comment/46510876
has comment: http://stackoverflow.com/comment/54911126
has body: You shouldn't override getViewTypeCount() and getItemViewType() if all your list items are uniform, or at least make them return 1 and 0 respectively. By overriding them the way you did, first of all you inhibit view-recycling mechanism of ListView, and second this probably leads to crash you described, because when you remove an item from the middle of the list, the types of the views after removed one become changed. UPDATE: Actually, this is what is happening: ListView calls getViewTypeCount() on the adapter only in setAdapter() and creates an internal array of that size. So if you later add views and your getItemViewType() returns an index greater than or equal to that size, you get ArrayIndexOutOfBoundsException. UPDATE 2: If you need expandable list view, just use ExpandableListView. UPDATE 3: OK, I'll explain as thoroughly as I can. There's no reason to open views off the screen. ListView is designed to perform recycling and inhibiting it is unneeded in 99.9% of time, and your case doesn't fall into remaining 0.01%. Your adapter should remember all the details and populate the newly appearing views when the ListView is being scrolled. In your case you have two types of views - open and closed, so getViewTypeCount() should return 2 and getItemViewType() should return 0 or 1 depending on whether the view is closed or open. In getView(), if convertView is null, you should create it depending on what getItemViewType() returns for that position. And if it's not null, you are guaranteed that it is one of the views that you created earlier for the same type. And here is the point of crash which happens if your getItemViewType() returns arbitrary large numbers (I'm referring to sources for API 19): // ListView.java public void setAdapter(ListAdapter adapter) { ... // This is the only call to getViewTypeCount() mRecycler.setViewTypeCount(mAdapter.getViewTypeCount()); ... } // AbsListView.java public void setViewTypeCount(int viewTypeCount) { ... // Here it creates the…
has comment: http://stackoverflow.com/comment/44544321
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40265821
accepted answer of: http://stackoverflow.com/q/25749486

http://stackoverflow.com/a/25799588
score: 1
has comment: http://stackoverflow.com/comment/40354972
accepted answer of: http://stackoverflow.com/q/25799519
type: Answer
answers question: http://stackoverflow.com/q/25799519
has comment: http://stackoverflow.com/comment/40356113
upvote count: 1
has body: Let's write this a little more clearly and clarify the names a bit: public class GC { private Object o; private void setObj(Object obj) { o = obj; } public void doSomething() { Object o = new Object(); //4 setObj(o); o = new Object(); //6 setObj(null); //7 o=null; } } Now, think about how long the object o created on line 4 has to live: On line 5, you're saving a reference to it in the enclosing class. So now the reference can't be GC'd for as long as the enclosing class exists and is holding a reference to it. Once you call setObj(null) on line 7, the enclosing class no longer holds a reference to the object created in line 4. The only existing copy of o would be the one in scope, but the variable "o" no longer refers to that initial object since you've overwritten the reference in line 6. BTW&lt; Your example is a bit hard to read - some formatting would've made this a bit easier.
has comment: http://stackoverflow.com/comment/40447768
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25782045
has comment: http://stackoverflow.com/comment/40322410
has comment: http://stackoverflow.com/comment/40333866
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40322561
has body: I am receiving a large number of items from different webservices and need to show them to user (based on ascending order of their prices). Take SkyScanner as an example of this requirement, user selects a specific flight and the website make request to different web services to receive the results. The question is that, users have access to different filters such as 'show more' and 'sort by price' and I am wondering after retrieving the results from all webservices and sorting the results where I should keep the results? (Show more is similar to pagination, by clicking on 'show more' I need to move to the next page) 'Show more' : at first I need to show first five results and if show more is clicked show more results. 'Sort by price" : this option sort the results based on their price. Back-end public String retrieveResultsFromWebservices(){ results = new ArrayList(); results = wb1(); results = wb2(); results = wb3(); results = wb4(); results = wb5(); return "results"; } Front-end ..... results.name results.price </c:forEach> More details Imagine user is looking for a list of products of all shops of the city, so I send request to the webservice of all shops to receive the list of their products. Then user is able to sort them based on their price, and also able to view the first five items, before clicking on show more to see the second five items.
upvote count: 1
has comment: http://stackoverflow.com/comment/40326557
has comment: http://stackoverflow.com/comment/40322824
tagged with: web-services
has comment: http://stackoverflow.com/comment/40322324
has comment: http://stackoverflow.com/comment/40322672
type: Question
has comment: http://stackoverflow.com/comment/40322611
has comment: http://stackoverflow.com/comment/40331443
has comment: http://stackoverflow.com/comment/40325088
has comment: http://stackoverflow.com/comment/40353058
has title: How to show a long list of results that are retrieved from webservices to users?
has comment: http://stackoverflow.com/comment/40389202
tagged with: struts2
has comment: http://stackoverflow.com/comment/40324720
downvote count: 0
tagged with: jsp
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40322722
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40333252
has comment: http://stackoverflow.com/comment/40365361

http://stackoverflow.com/a/25866053
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25865873
downvote count: 0
type: Answer
has body: All Java parameters are passed by value. For all non-primitive types, the value contains a reference to the object that's passed. For your piece of code, the Integer object is stored at location A in memory. Another location B in memory represents the main's variable x and stores a value A. For the changeInteger call, a new location C is created and a value in B (which is A) gets copied to it. This is the local x of the changeInteger function. With the assigning, you create a new variable stored at D and its location is assigned to C. Then you return from the method. You can see that A and B isn't modified anywhere and thus the value remains unchanged.

http://stackoverflow.com/comment/40263365
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25746768
has text: Update. Add the ListView in your adapter. And pass the reference to it when you create the adapter

http://stackoverflow.com/comment/40286482
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25762379
has text: Oh, foo. Not enough coffee. Sorry, deleting my comment

instantiation
type: Tag
tags question: http://stackoverflow.com/q/25858487
tag name: instantiation

http://stackoverflow.com/a/25753482
upvote count: 1
type: AcceptedAnswer
downvote count: 0
score: 1
has body: You need to serialize your response using something like Jackson or GSON (for json) and then add an @Produces annotation to set the content-type headers in the response. Jersey and Jax-RS are also nice.
accepted answer of: http://stackoverflow.com/q/25751929
type: Answer
answers question: http://stackoverflow.com/q/25751929

http://stackoverflow.com/comment/40416262
score: 0
comment on: http://stackoverflow.com/a/25833467
type: Comment
has text: @ÓscarLópez thanks for making the idea clear for me.
type: AnswerComment

http://stackoverflow.com/comment/40355414
comment on: http://stackoverflow.com/a/25799834
score: 0
type: AnswerComment
has text: can you post your GrantedAuthority.class ?
type: Comment

http://stackoverflow.com/q/25805636
has answer: http://stackoverflow.com/a/25805909
possible better answer: http://stackoverflow.com/a/25805909
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has answer: http://stackoverflow.com/a/25805940
has body: (Disclaimer: pretty new to android) So I am trying to make a tabbed application using Android Studio, and following examples online I have been able to use the actionbar to setup 2 tabs and fragments like so: in MainActivity.java ActionBar bar = getActionBar(); bar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); bar.setTitle("My App Test"); Tab tabSearch = bar.newTab().setText("Search").setIcon(android.R.drawable.ic_menu_search); Tab tabReport = bar.newTab().setText("Report").setIcon(android.R.drawable.ic_menu_report_image); Fragment stfrag = new SearchTabFragment(); Fragment rptfrag = new ReportFragment(); tabSearch.setTabListener(new MyTabsListener(stfrag)); tabReport.setTabListener(new MyTabsListener(rptfrag)); bar.addTab(tabSearch); bar.addTab(tabReport); in ReportFragment/SearchTabFragment .java public class SearchTabFragment extends Fragment { public View onCreateView(LayoutInflater inflater,ViewGroup container, Bundle savedInstanceState){ return inflater.inflate(R.layout.fragment_1,container,false); } } I basically just copied the example for the ActionBar listener directly from the tutorial I found: class MyTabsListener implements ActionBar.TabListener { public Fragment fragment; public MyTabsListener(Fragment fragment){ this.fragment = fragment; }; @Override public void onTabSelected(Tab tab, FragmentTransaction ft){ ft.replace(R.id.wrap,fragment); } @Override public void onTabUnselected(Tab tab, FragmentTransaction ft){ } @Override public void onTabReselected(Tab tab, FragmentTransaction ft){ } } Now my question is, how do I attach eventHandlers to the elements defined in my fragments.xml? Previously in a "Single Activity" application I played with I just put it in the main java file right after the onCreate event. Eg: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); (TextView) tv = (TextView) findViewByid(R.id.textviewidhere); //now I attach the handlers as I need Thanks in advance! (edited for clarity)
type: Question
has title: New to android, how do I initialize event handlers for elements inside a fragment
score: 0
has answer: http://stackoverflow.com/a/25805876
accepted answer: http://stackoverflow.com/a/25805876
answer count: 3
tagged with: android

http://stackoverflow.com/comment/40449171
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25851126
has text: Also I would recommend to use Maven, rather than copying all the jar files manually.

http://stackoverflow.com/a/25856540
has body: Make addProfile and removeProfile that adds and removes from the set
score: 0
answers question: http://stackoverflow.com/q/25855563
type: Answer

http://stackoverflow.com/comment/40390214
has text: @ErwinBolwidt, sorry, my mistake. Already fixed it. Thank you. I was just thinking maybe he'll declare his enum constants in an unordered way. In his given example he has this `enum Animal {sheep, goat};`
type: AnswerComment
comment on: http://stackoverflow.com/a/25818875
score: 0
type: Comment

http://stackoverflow.com/a/38575305
has body: 1, I ran into this too few days ago, its simple just remove cucumber-Spring from the dependency. 2 If that doesn't work try updating cucumber-core, cucumber-junit, and cucumber-java all version 1.2.3
type: Answer
answers question: http://stackoverflow.com/q/25847343
score: 5
upvote count: 5
has comment: http://stackoverflow.com/comment/75337320
downvote count: 0

http://stackoverflow.com/q/25800083
has comment: http://stackoverflow.com/comment/40550194
possible better answer: http://stackoverflow.com/a/25879945
has answer: http://stackoverflow.com/a/25925071
has answer: http://stackoverflow.com/a/25879945
type: AnsweredQuestion
score: 2
downvote count: 0
has title: "Unable to read TLD from JAR file" when run spring boot app on heroku
favorite count: 0
type: Question
has body: I wrote an springboot app running at Heroku. When I run locally with maven spring-boot:run everthing is ok. But when I deploy the app to Heroku, the page show error: There was an unexpected error (type=Internal Server Error, status=500). /WEB-INF/jsp/login.jsp (line: 3, column: 0) /WEB-INF/jsp/common.jsp (line: 3, column: 64) Unable to read TLD "META-INF/spring.tld" from JAR file "jar:file:/app/target/slog-1.0-SNAPSHOT.jar!/lib/spring-webmvc-4.0.7.RELEASE.jar": java.io.IOException: Unable to open root Jar file 'jar:file:/app/target/slog-1.0-SNAPSHOT.jar' And I run the jar locally with "java -jar target/*.jar" have the same error. this is my pom.xml file: <?xml version="1.0" encoding="UTF-8"?> http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 ort.stv slog 1.0-SNAPSHOT Spring Boot Blog System org.springframework.boot spring-boot-starter-parent 1.1.6.RELEASE <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-security org.springframework.boot spring-boot-starter-tomcat org.springframework.boot spring-boot-starter-test test org.springframework.security spring-security-taglibs org.apache.tomcat.embed tomcat-embed-jasper provided javax.servlet jstl provided org.hibernate hibernate-validator org.apache.commons commons-lang3 3.3.2 com.google.guava guava 18.0 postgresql postgresql 9.1-901-1.jdbc4 <classifier /> org.springframework.boot spring-boot-maven-plugin
accepted answer: http://stackoverflow.com/a/25925071
tagged with: tld
upvote count: 2
answer count: 2
tagged with: spring
tagged with: heroku
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/40583350
tagged with: java

http://stackoverflow.com/comment/40313874
comment on: http://stackoverflow.com/q/25776787
has text: @RussJackson: Calendar java.util.Calendar.getInstance(): Constructs a new instance of the Calendar subclass appropriate for the default Locale and default TimeZone, set to the current date and time. Locale.getDefault(): Returns the user's preferred locale. This may have been overridden for this process with setDefault. Since the user's locale changes dynamically, avoid caching this value. Instead, use this method to look it up for each use.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40213172
type: QuestionComment
score: 1
has text: Please post the full stack trace and a SSCCE: http://sscce.org You should use com.jogamp.common.nio.Buffers to create buffers for JOGL. Check if t or gl is null.
comment on: http://stackoverflow.com/q/25713023
type: Comment

libgdx
tags question: http://stackoverflow.com/q/25791256
tags question: http://stackoverflow.com/q/25750398
tags question: http://stackoverflow.com/q/25809293
tags question: http://stackoverflow.com/q/25713043
tags question: http://stackoverflow.com/q/25743610
tags question: http://stackoverflow.com/q/25767519
tag name: libgdx
tags question: http://stackoverflow.com/q/25827965
tags question: http://stackoverflow.com/q/25851853
tags question: http://stackoverflow.com/q/25736748
tags question: http://stackoverflow.com/q/25838226
tags question: http://stackoverflow.com/q/25824006
tags question: http://stackoverflow.com/q/25757027
tags question: http://stackoverflow.com/q/25837115
tags question: http://stackoverflow.com/q/25739021
tags question: http://stackoverflow.com/q/25842882
tags question: http://stackoverflow.com/q/25735363
tags question: http://stackoverflow.com/q/25863150
type: Tag
tags question: http://stackoverflow.com/q/25746112
tags question: http://stackoverflow.com/q/25786789
tags question: http://stackoverflow.com/q/25755162
tags question: http://stackoverflow.com/q/25797334
tags question: http://stackoverflow.com/q/25789196
tags question: http://stackoverflow.com/q/25808728
tags question: http://stackoverflow.com/q/25851740
tags question: http://stackoverflow.com/q/25738035
tags question: http://stackoverflow.com/q/25718624
tags question: http://stackoverflow.com/q/25866866
tags question: http://stackoverflow.com/q/25745049
tags question: http://stackoverflow.com/q/25754136
tags question: http://stackoverflow.com/q/25837013
tags question: http://stackoverflow.com/q/25750747
tags question: http://stackoverflow.com/q/25822178
tags question: http://stackoverflow.com/q/25828048

http://stackoverflow.com/comment/40361966
comment on: http://stackoverflow.com/q/25802370
score: 0
type: QuestionComment
has text: It is taken from somewhere in sun link. I have overridden paint method in Tree class used inside TreeTable. I cant remove paint() method as it does cell rendering with tree node.
type: Comment

android-sqlite
tags question: http://stackoverflow.com/q/25718356
tag name: android-sqlite
type: Tag

http://stackoverflow.com/comment/40328451
has text: You are surely right, I do not want to argue as I am not a java specialist but it does not help saying that it is a contradiction. Do you have any idea/suggestions ?
type: Comment
comment on: http://stackoverflow.com/q/25785223
type: QuestionComment
score: 0

http://stackoverflow.com/q/25873406
tagged with: tomcat
favorite count: 0
has answer: http://stackoverflow.com/a/25876721
has body: I am planning to develop an Intranet application (Java client, JSP, SQLite) Goal of this is that when a user clicks on the link, if the user has access (to a team which is handled in the business logic) a file should be provided for download There is a table in the db which holds the info and below is the example row ID | file | team | md5 1 | D:\test\output_20140915_100012.zip | Falcon | 5cceaf4cc400fd8f5c7fb4b2af754f4093369f59 where MD5 is the MD% checksum of the string "D:\test\output.zip" and not the file itself I create the MD5 just for the sake of having random number. Reason I don't use RAND is to avoid collision (this part is trivial) I want my URL to look like this http://mywebserver:8080/&lt;appname&gt;/5cceaf4cc400fd8f5c7fb4b2af754f4093369f59 Which should be taken to http://mywebserver:8080/&lt;appname&gt;/download.jsp?id=5cceaf4cc400fd8f5c7fb4b2af754f4093369f59 I am using Tomcat and I am wondering if how we could have a URL rewrite for this scenario
type: UnansweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40489701
has answer: http://stackoverflow.com/a/25873898
score: 4
has comment: http://stackoverflow.com/comment/40495541
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/40489381
downvote count: 0
has title: URLRewrite in Tomcat 7

http://stackoverflow.com/q/25750240
has answer: http://stackoverflow.com/a/25751112
has answer: http://stackoverflow.com/a/38503624
tagged with: time-complexity
has body: Supposing that we have a array C with all element in C > 0 A pair of indices (a, b) is multiplicative if 0 ≤ a &lt; b &lt; N and C[a] * C[b] ≥ C[a] + C[b]. with the time-complexity is O ( n ) expected worst-case time complexity is O(N); I appreciate your help in supporting this case. Thanks.
has comment: http://stackoverflow.com/comment/40423979
has answer: http://stackoverflow.com/a/25771099
has answer: http://stackoverflow.com/a/25750580
score: 10
has answer: http://stackoverflow.com/a/34326078
upvote count: 11
favorite count: 0
has answer: http://stackoverflow.com/a/26883344
has title: How to find pairs with product greater than sum
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/37912499
tagged with: java
downvote count: 1
type: Question
answer count: 8
tagged with: algorithm
has answer: http://stackoverflow.com/a/32445384

http://stackoverflow.com/a/25810984
score: 2
downvote count: 0
has body: This isn't a limitation of Java but of the Windows file system where you're trying to write the files. On a case-insensitive file system the compiler can't write both Employee.class and employee.class to disk because as far as the FS is concerned they are the same file. If you could somehow do the compilation to a case-sensitive file system (e.g. on Linux) and then package the resulting class files into a JAR then you would be able to run from that JAR without error on Windows, as a ZIP file is able to contain two distinct entries whose names differ only in case.
has comment: http://stackoverflow.com/comment/40374610
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/25810791
has comment: http://stackoverflow.com/comment/40374535

http://stackoverflow.com/a/25788263
type: Answer
score: -2
has body: change your string like this String lang = "fr,de,gb,nl,se,es"; or change like @TheLostMoind said
answers question: http://stackoverflow.com/q/25788174
upvote count: 0
downvote count: 2

http://stackoverflow.com/comment/40230680
type: QuestionComment
has text: Whether or not a value is odd/even is determined by its least-significant bit; the other bits play no role in it. Beyond this, it's really hard to understand what you're asking. Perhaps you could provide an example to illustrate?
type: Comment
comment on: http://stackoverflow.com/q/25732049
score: 0

http://stackoverflow.com/q/25771412
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/38790371
has answer: http://stackoverflow.com/a/61325622
has title: Read integer from numeric cell using Apache POI in java
accepted answer: http://stackoverflow.com/a/38790371
tagged with: numberformatexception
has answer: http://stackoverflow.com/a/53330828
possible better answer: http://stackoverflow.com/a/25775367
has answer: http://stackoverflow.com/a/25775367
downvote count: 0
has comment: http://stackoverflow.com/comment/40303222
favorite count: 0
has answer: http://stackoverflow.com/a/45856191
has comment: http://stackoverflow.com/comment/65432326
has answer: http://stackoverflow.com/a/44152845
has answer: http://stackoverflow.com/a/58373502
tagged with: http://stackoverflow.com/tag/xls
has body: I have an application which reads xls sheet using apache poi. When the cell has numeric value, i read it by row.getCell(i).getNumericValue(). But it returns floating point digit. like if the cell value is 1, it returns 1.0. Can i convert it to int ? Any helpwould be appreciated. I tried Integer.parseInt(value)- but it throws NumberFormat exception.Any help is appreciated.Here is the pseudo code: FileInputStream file = new FileInputStream(new File("C:\\test.xls")); HSSFWorkbook workbook = new HSSFWorkbook(file); HSSFSheet sheet = workbook.getSheetAt(0); Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while(rowIterator.hasNext()) { Row row = rowIterator.next(); Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while(cellIterator.hasNext()) { Cell cell = cellIterator.next(); switch(cell.getCellType()) { case Cell.CELL_TYPE_NUMERIC: String value= String.valueOf(cell.getNumericCellValue()); int intVal = Integer.parseInt(value)--&gt;&gt;throws Exception
type: AnsweredQuestion
tagged with: apache-poi
score: 7
tagged with: java
upvote count: 7
has answer: http://stackoverflow.com/a/54516930

http://stackoverflow.com/comment/40295652
has text: I didn't try anything.. because this concept is possible in C but not in java.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25767445

http://stackoverflow.com/a/27461140
type: Answer
score: 0
has body: If sw is a dvar float+, then you rather use asNumVarMap rather than asNumMap. You should have a look at examples in opl\examples\opl_interfaces\java
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25828070
answers question: http://stackoverflow.com/q/25828070

http://stackoverflow.com/comment/40367551
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25798808
has text: Thanks for your answer, so is it possible to call the notifyDataSetChanged() directly from the adapter code? At the end of the setItems() method?

http://stackoverflow.com/comment/40357559
has text: That's kind of an unrelated issue - in SOF in generally appreciated to not use comments for that but to start a new question instead. Otherwise it's getting really hard to read & understand.
type: Comment
comment on: http://stackoverflow.com/a/25800976
score: 0
type: AnswerComment

http://stackoverflow.com/a/25810499
type: Answer
score: 2
has body: Just test if test is null right after your call: Set&lt;String&gt; test = C.userPreferences.getStringSet("default", Here); if (test == null) test = new HashSet&lt;String&gt;(); The HashSet class is just an implementation of the Set interface.
downvote count: 0
answers question: http://stackoverflow.com/q/25810293
upvote count: 2

http://stackoverflow.com/q/25768987
has title: Java replace matches with variables
has comment: http://stackoverflow.com/comment/40298922
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25769270
has comment: http://stackoverflow.com/comment/40298504
score: 0
has answer: http://stackoverflow.com/a/25769305
accepted answer: http://stackoverflow.com/a/25769270
has comment: http://stackoverflow.com/comment/40298356
possible better answer: http://stackoverflow.com/a/25769305
has comment: http://stackoverflow.com/comment/40298423
type: AnsweredQuestion
has body: /* Look for phone numbers starting with a 0 after a space character and replace the 0 with "+44 (0)" */ import java.util.regex.*; public class Reg6 { public static void main (String [] args) { String variable1 = "test"; Pattern phone = Pattern.compile("\\s0"); Matcher action = phone.matcher(args[0]); String worldwide = action.replaceAll(" +44 (0) "); System.out.println(worldwide); } } How can I place a variable1 into the replaceAll method? if there will be a string {$variable_1} i wish to replace it by my variable_1 is that possible? its like in php template "{$test}" - I want to use name that matches in the string and find that variable that matches to this string and put it there replacing it all by this variable value its just like in the templates
has comment: http://stackoverflow.com/comment/40298592
tagged with: java
has comment: http://stackoverflow.com/comment/40298464

http://stackoverflow.com/comment/40381748
score: 0
comment on: http://stackoverflow.com/q/25813921
has text: One bit of advice - in cases like this, it'd be good to add a comment to your code sample indicating where precisely your problem is - something like a "//what do I do here?" comment in calculateTeamWins would make your question easier to understand.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40352590
score: 1
type: Comment
type: QuestionComment
has text: Replace `k` which was placed before digit with `000`?
comment on: http://stackoverflow.com/q/25798422

http://stackoverflow.com/q/25803145
has comment: http://stackoverflow.com/comment/40379874
favorite count: 0
has title: facebook android SDK java.io.EOFException after a few calls
type: Question
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/43661126
has body: Anyone have experience or seen this particular issue?? After a few calls facebook android sdk to make posting to a group, Bundle params = new Bundle(); params.putString("message", deviceName); params.putString("link", link.url); Request req = new Request(session, "/" + groupId + "/feed", params, HttpMethod.POST, new Request.Callback() { I encounter errors continually until I exit and relaunch android app. Exception being thrown is: com.facebook.FacebookException: java.io.EOFException at com.facebook.Response.fromHttpConnection(Response.java:333) at com.facebook.Request.executeConnectionAndWait(Request.java:1553) at com.facebook.Request.executeBatchAndWait(Request.java:1452) .... Caused by: java.io.EOFException at libcore.io.Streams.readAsciiLine(Streams.java:203) at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579) at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827) Looks very similar to a few issues I've seen, like java.io.eofexception. I'm new to facebook android sdk as far as I can tell I have no access to the underlying http connection where I could probably address the issue. Anyone have any experience here with this kind of error (on the facebook platform with their android sdk)?? Thanks, Ray.
upvote count: 2
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/28776806
type: UnansweredQuestion
score: 2
downvote count: 0

http://stackoverflow.com/comment/40292875
type: AnswerComment
has text: thanks for the help. with that i get 1.7.0-b147 .... how do i cross reference that with the update number? i'm trying to get something like Java SE 7 Update 51
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25765967

http://stackoverflow.com/comment/40299855
comment on: http://stackoverflow.com/a/25768639
has text: Yes, that is where I am getting stuck. I am doing socket programming for the first time, so can you please tell any way that I can avoid this situation. Also, do read my comment on @Nekojimi reply below for better understanding of my problem.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25728826
upvote count: 3
type: UnansweredQuestion
type: Question
score: 3
has title: JAX-WS: Remove incoming illegal null characters in XML SOAP &#x0;
tagged with: java
tagged with: jax-ws
has body: Environment: * JAX WS 2.2.8 * Standalone publishing with Endpoint Problem: * External, non modifiable system send incoming requests with NULL (0x0) values (&#x0;) * jax-ws crashes, because XML unmarshalling doesn't allow NULL javax.xml.bind.UnmarshalException with linked exception: [com.ctc.wstx.exc.WstxParsingException: Invalid character reference: null character not allowed in XML content. Tried LogicalHandler and SOAPHandler, but buth crash once i try to access the message Possible Solution: * Need a way to access the message on a character level, so i can remove illegal chars and pass it forward. Any ideas? Code snippets? thanks in advance
tagged with: invalid-characters
downvote count: 0
favorite count: 0
tagged with: soap
tagged with: http://stackoverflow.com/tag/xml
answer count: 0

http://stackoverflow.com/q/25778963
has comment: http://stackoverflow.com/comment/40317077
has comment: http://stackoverflow.com/comment/40317148
has comment: http://stackoverflow.com/comment/40317141
has title: using scanner to evaluate words in a string
has answer: http://stackoverflow.com/a/25779701
accepted answer: http://stackoverflow.com/a/25779701
score: 2
possible better answer: http://stackoverflow.com/a/25779173
type: AnsweredQuestion
tagged with: java.util.scanner
has comment: http://stackoverflow.com/comment/40316914
has comment: http://stackoverflow.com/comment/40317065
has answer: http://stackoverflow.com/a/25779173
has comment: http://stackoverflow.com/comment/40316971
has body: Im trying to write a method that returns the number of words from the "words" parameter that have at least the min" but no more than the "max c"haracters. public static int countWords(String words, int min, int max) { Scanner s = new Scanner (words); int counter = 0; while (s.hasNext()) { String word = s.next(); int wordLength = word.length(); if (wordLength&gt;min &amp;&amp; wordLength&lt;max) { counter= counter + 1; s.close(); } } return counter; }
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40317010
upvote count: 3
answer count: 3
has answer: http://stackoverflow.com/a/25779207
downvote count: 1
linked to: http://stackoverflow.com/q/736654
has comment: http://stackoverflow.com/comment/40316931
favorite count: 0

http://stackoverflow.com/a/25773319
type: AcceptedAnswer
downvote count: 0
has body: Allocation is always performed in the current thread, but if there is insufficient space on the heap an allocation request can trigger a garbage collection, which, depending on the JVM and its garbage collector tuning parameters, can employ multiple threads. On the Oracle JVM, you can verify that this is indeed the case by supplying the -verbose:gc option to the Java process. On my computer, your program then produces the following output: Test [GC (Allocation Failure) 512K-&gt;456K(261632K), 0.0007027 secs] [GC (Allocation Failure) 968K-&gt;920K(261632K), 0.0014950 secs] [GC (Allocation Failure) 1432K-&gt;1452K(261632K), 0.0011264 secs] [GC (Allocation Failure) 1964K-&gt;1972K(262144K), 0.0009485 secs] [GC (Allocation Failure) 2996K-&gt;3020K(262144K), 0.0011456 secs] [GC (Allocation Failure) 4044K-&gt;4172K(264704K), 0.0014029 secs] [GC (Allocation Failure) 6220K-&gt;6124K(264704K), 0.0032563 secs] [GC (Allocation Failure) 8172K-&gt;8212K(267776K), 0.0032141 secs] [GC (Allocation Failure) 11796K-&gt;11836K(268288K), 0.0048205 secs] [GC (Allocation Failure) 15420K-&gt;15524K(271872K), 0.0048205 secs] [GC (Allocation Failure) 20644K-&gt;20772K(272896K), 0.0063642 secs] [GC (Allocation Failure) 25892K-&gt;25900K(275968K), 0.0066470 secs] [GC (Allocation Failure) 33580K-&gt;33636K(276480K), 0.0069722 secs] [GC (Allocation Failure) 41316K-&gt;41396K(281088K), 0.0105088 secs] [GC (Allocation Failure) 52660K-&gt;52564K(282112K), 0.0095962 secs] [GC (Allocation Failure) 63828K-&gt;64060K(293376K), 0.0127885 secs] [GC (Allocation Failure) 81468K-&gt;81380K(294400K), 0.0138240 secs] [GC (Allocation Failure) 98788K-&gt;99004K(307712K), 0.0192218 secs] [GC (Allocation Failure) 122044K-&gt;122196K(309248K), 0.0170214 secs] [GC (Allocation Failure) 145236K-&gt;145284K(318976K), 0.0242662 secs] [GC (Allocation Failure) 174468K-&gt;174620K(322048K), 0.0219776 secs] [GC (Allocation Failure) 203804K-&gt;203860K(334336K), 0.0287066 secs] [GC (Allocation Failure) 241236K-&gt;241356K(…
type: Answer
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25772687
answers question: http://stackoverflow.com/q/25772687
score: 3

http://stackoverflow.com/q/25814513
upvote count: 2
tagged with: remoteobject
has body: I have been using java RMI for a while now but I couldn't figure out if the RMI Remote Stubs (on the server side) are singleton? The reason I ask is: lets assume that one of the RMI implementation methods lower down in the chain of calls have a synchronized method. If for some reason the logic in the Synchronized Method is messed up (or hangs), the future RMI calls (from the client) will hang too while trying to get access to that synchronized method. This will hold true only if the RMI stubs are going to be singleton. If a new object is created on the server side at every remote call from the client, this won't be a problem because than the methods are being called from a different object and synchronized method won't be an issue anymore. Long story short. I am trying to understand how JVM internally maintains rmi remote objects on the server side and if they are singleton. I tried many different javadocs but they don't explicitly mention this anywhere. Any and all help is appreciated ! EDIT Based on some questions and comments, I am refining the question: my real question is, does RMI on the server side happen to keep some kind of an object pool based on what one object you export and register ? Can you bind more than one object of the same type with the same name (somewhat simulating an object pool where RMI can give me any of the objects that I registered) or in order to have multiple instances of the same object, I will have to register them with different names
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25815007
tagged with: spring
answer count: 4
score: 2
downvote count: 0
tagged with: rmi
has answer: http://stackoverflow.com/a/25818146
tagged with: java
has answer: http://stackoverflow.com/a/25814860
has title: Are java RMI remote objects (server) singleton?
type: Question
has answer: http://stackoverflow.com/a/25815005

http://stackoverflow.com/q/25753752
has body: I'm beginner in Java and Android. My problem is when I use setDefaultUncaughtExceptionHandler in my code, some functions still need a try/catch block surrounding it, but I want throw all my exceptions to UncaughtException thread. public class MyAlarmReciever extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Thread.setDefaultUncaughtExceptionHandler(new UnCaughtException(context)); try { String imageURL = MyWebService.readFeed(); DownloadAndSet.downloadFile(imageURL); } catch(Throwable e) { throw new RuntimeException(e); } Toast.makeText(context, "Alarm Triggered", Toast.LENGTH_LONG).show(); } }
has answer: http://stackoverflow.com/a/25754154
tagged with: uncaught-exception
tagged with: android
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25753790
has answer: http://stackoverflow.com/a/25753823
tagged with: java
has answer: http://stackoverflow.com/a/25753785
type: Question
tagged with: try-catch
has title: Why must I use try catch when I use global exception handling?
has answer: http://stackoverflow.com/a/25753851
score: 0

http://stackoverflow.com/q/25852541
favorite count: 0
has title: Java rarrange enum array
has comment: http://stackoverflow.com/comment/40452311
has answer: http://stackoverflow.com/a/25852710
has comment: http://stackoverflow.com/comment/40452067
score: 2
type: AnsweredQuestion
upvote count: 2
has comment: http://stackoverflow.com/comment/40452447
tagged with: java
accepted answer: http://stackoverflow.com/a/25852710
has comment: http://stackoverflow.com/comment/40451543
has body: i was wondering how can i reorder enum so that all goats are at the beginning and all sheep are at the end of the array. Right now it actually does the trick but until the array size > 100.. The reordering speed also matters so api methods are bit too slow. Any suggestions? public class Sheep { enum Animal {sheep, goat}; public static void main (String[] param) { reorder(Animal.values()); } public static void reorder (Animal[] animals) { int l, r, i, j; i = l = 0; //left most element r = animals.length - 1;//right most element int mid = (r+l)/2; // middle element of the array for(i=0; i &lt; animals.length;i++) { if(i &lt; mid) { animals[i] = animals[l+1]; System.out.println(animals[r]); } else if(i &gt;= mid ) { animals[i] = animals[r-1]; System.out.println(animals[r]); } } } }
type: Question
answer count: 2
downvote count: 0
possible better answer: http://stackoverflow.com/a/25854379
has answer: http://stackoverflow.com/a/25854379

http://stackoverflow.com/a/25732077
upvote count: 1
answers question: http://stackoverflow.com/q/25731451
has comment: http://stackoverflow.com/comment/40265902
type: AcceptedAnswer
downvote count: 0
has body: As a suggestion: Assuming you are using JBoss as Application-Server, you could write a ServletFilter to modify the request. see here: http://javabeanz.wordpress.com/2009/02/11/how-to-write-a-simple-servlet-filter/
accepted answer of: http://stackoverflow.com/q/25731451
type: Answer
score: 1

http://stackoverflow.com/a/25826863
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40404984
type: Answer
has body: when you got number 5 as the printed out put you will set k++ , that will make k=6. after that k = (k - 1) + (k - 2); output k = (6-1)+(6-2) = 5+4 = 9 , (note : the next should be 8 so your algorithm is wrong) You have mistaken the Idea of Fibonacci numbers. the nth Fibonacci number is equal to the sum of previous two Fibonacci numbers. not to the (Fn-1)+(Fn-2) Edited : So as you can see if we know the first 2 Fibonacci numbers we can calculate the third by adding those two. and the fourth one will be the summation of second one and third one and it goes ..... to n. Okay here is a way that you don't need a recursive approach ( you need to store the found Fibonacci numbers in an Array) okay assume you want to find first n Fibonacci numbers. then create an array of size n and set first and second elements to one (1) since first two Fibonacci numbers are 1 and 1. now loop through the array from 2 to n. at each iteration add the previous two element to the next element. go through the code. you will find it very easy to do. public static void fib(int n){ int Fibonacci [] = new int[n]; Fibonacci [0]=1; Fibonacci [1]=1; for (int i = 2; i &lt; n; i++) { Fibonacci [i]=Fibonacci [i-1]+Fibonacci [i-2]; } System.out.println(Arrays.toString(Fibonacci )); }
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25826782
accepted answer of: http://stackoverflow.com/q/25826782

github
tags question: http://stackoverflow.com/q/25799325
tags question: http://stackoverflow.com/q/25801193
tags question: http://stackoverflow.com/q/25772908
tag name: github
type: Tag
tags question: http://stackoverflow.com/q/25761430
tags question: http://stackoverflow.com/q/25860087

http://stackoverflow.com/q/25730032
has answer: http://stackoverflow.com/a/25730076
accepted answer: http://stackoverflow.com/a/25730055
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25730073
tagged with: java.lang.class
type: Question
tagged with: runtime-error
tagged with: for-loop
score: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25730055
has comment: http://stackoverflow.com/comment/40226586
has title: String index out of bounds? Where?
tagged with: exception
has comment: http://stackoverflow.com/comment/40226659
possible better answer: http://stackoverflow.com/a/25730061
answer count: 4
has answer: http://stackoverflow.com/a/25730061
has body: This is my code for finding the no. of vowels in a string: { String inyo=inpeo.getText().toLowerCase(); System.out.println(inyo); // Just checking for an empty string int vowcount=0; for(int i=0;i&lt;=inyo.length();i++) { char rol=inyo.charAt(i); if(rol=='o'||'u'==rol||rol=='a'||rol=='e'||rol=='i') { vowcount=vowcount+1; System.out.println(vowcount); } numout.setText(""+vowcount); } } Now, nothing is wrong with the output here-it finds the exact no. of vowels as I intended. But it gives me this error: Exception in thread "AWT-EventQueue-0" java.lang.StringIndexOutOfBoundsException: String index out of range: 5 at java.lang.String.charAt(String.java:646) at WordCheck.jButton2ActionPerformed(WordCheck.java:147) // Extra errors removed as they're irrelevant to my issue As a result, there is no way of reusing the program other than closing and restarting it. when the output is coming out as desired, why am I getting this error? I don't get any empty Strings, either.
upvote count: 2

http://stackoverflow.com/comment/40420672
score: 0
type: Comment
type: QuestionComment
has text: Thanks Nabin but there is lot of use cases creating, like one when app installed first time in that case current and old date will be same.
comment on: http://stackoverflow.com/q/25835799

http://stackoverflow.com/comment/90051327
has text: Another thing to take note of is that package level visibility does not work on methods marked @Transactional. It must be public. As per this article: http://www.baeldung.com/transaction-configuration-with-jpa-and-spring, "Another caveat of using proxies is that only public methods should be annotated with Transactional – methods of any other visibilities will simply ignore the annotation silently as these are not proxied."
score: 2
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/37842245

http://stackoverflow.com/q/25808451
has body: I have 20 JLabels and all of them have to change their background color when mouse enters and change back to original color when mouse outs. Do I have to individually bind 2 Event-listeners of MouseEntered and MouseExited with all JLabels separately, or is there any work around so I can make just 2 events kind of monitoring all JLabels? Like in the image below: there are about 6 JLabels and I want each one to change its background color whenever the mouse enters the scene and change back to original color when the mouse outs. So, do I have to individually set event listeners on all JLabels, or there can be a single event listener for all JLabels?
linked to: http://stackoverflow.com/q/2380314
downvote count: 0
upvote count: 1
tagged with: events
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/25808662
accepted answer: http://stackoverflow.com/a/25808662
possible better answer: http://stackoverflow.com/a/25808649
has answer: http://stackoverflow.com/a/25809205
tagged with: swing
has title: Bind single event to all JLabels in Java
has answer: http://stackoverflow.com/a/25809160
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25808649

http://stackoverflow.com/comment/40243686
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25738601
has text: use format instead of parse and try again.refer http://stackoverflow.com/questions/12575990/calendar-date-to-yyyy-mm-dd-format-in-java
score: 0

http://stackoverflow.com/comment/40347697
comment on: http://stackoverflow.com/q/25795294
has text: possible duplicate of [Spring Security: How to clear \`remember me\` cookie programmatically?](http://stackoverflow.com/questions/6265490/spring-security-how-to-clear-remember-me-cookie-programmatically)
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25871131
score: 3
answer count: 1
has answer: http://stackoverflow.com/a/25886312
favorite count: 0
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
upvote count: 3
tagged with: java
accepted answer: http://stackoverflow.com/a/25886312
has body: I have spring-boot application which creates catalog with html static pages. When I start application by command: mvn spring-boot:run everything works good (folder with static pages is created in /resources/ catalog and client have access to pages) but I want have my app deployed as jar file and here I have my question, how can I achieve my goal? I understand that I can't add dynamically resources to jar but maybe I can create folder with resources next to my jar file and somehow add this folder to public resources so client could have access to html pages.
has title: How to dynamically add static resources to spring-boot jar application?
tagged with: resources
type: Question
has comment: http://stackoverflow.com/comment/40485379
tagged with: jar
downvote count: 0
has comment: http://stackoverflow.com/comment/40485723

http://stackoverflow.com/comment/40332180
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25781483
has text: Thanks @babsaai, I just couldn't understand why the webapp archetype didn't initially have those folders
score: 0

http://stackoverflow.com/comment/40294891
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25760432
has text: I have kind fixed it by adding ?disableReplyTo=false. For example, source=activemq:queue:deliverynotification?disableReplyTo=true. However by doing this causes another issue. When doing producerTemplate.requestBody it behaves like an InOnly message and returns the sent XML. How can this be fixed?
type: AnswerComment

http://stackoverflow.com/comment/40424045
comment on: http://stackoverflow.com/a/25837565
has text: The larger point is that, since this question doesn't in any aspect deal with optimizations that compilers may perform, this answer doesn't really go very far in addressing it.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40305268
has text: You forgot to ask yourself two important questions: Do I have a problem? Would implementing this help solve my problem?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25772478

http://stackoverflow.com/q/25818715
has answer: http://stackoverflow.com/a/25818786
type: Question
tagged with: nio
score: 0
answer count: 1
has title: position set to 0 after compact() of ByteBuffer
has body: Typically, after a compact() to a ByteBuffer is called, I see that the new position will be set to the old limit such that the buffer is ready for a put(). But sometimes, I see that the position is 0 in a ByteBuffer (and limit = capacity) after a call to compact(). If so, would this happen only when position = capacity (or position = limit) before the call to compact? The javadoc for ByteBuffer says "The buffer's position is then set to n+1 and its limit is set to its capacity.", but I seem to see the position set to 0 in my program.
accepted answer: http://stackoverflow.com/a/25818786
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40378077
comment on: http://stackoverflow.com/q/25812699
has text: I have a feeling it's linked to the same reason of why you cannot pass a primitive type for a generic type argument. Have you tried changing the values in the `Map` from `Object` to something else, such as `String`? Maybe it's allowed due to the polymorphic property of `Object`
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40454468
type: Comment
comment on: http://stackoverflow.com/a/25849826
has text: Thanks for this @Keith , I clearly understand the difference between OpenID and OAuth, but thanks for describing it in more clear way.The doc for reconnect does not specifies the parameters , which the real concern was.
type: AnswerComment
score: 0

http://stackoverflow.com/q/25809970
score: 2
upvote count: 2
tagged with: java
tagged with: selenium
type: Question
tagged with: gwt
has answer: http://stackoverflow.com/a/25811131
has answer: http://stackoverflow.com/a/26248093
has body: I am new to Selenium IDE. As far as I know, when open Selenium IDE, you will notice that the red 'record macro' button is toggled. This means that selenium will attempt to record every action you make inside the browser. This is a problematic way of recording as we implicitly wait for actions to complete before moving on. If I only let Selenium to record every actions without specifying extra actions, many test step will be failed with error message : Element not found. I was trying to add extra actions based on Selenium API, like waitForElementPresent, waitForSearch etc. My question is: How do I know which extra action do I need to add for each web target? Any standard for it? Thanks!
downvote count: 0
has answer: http://stackoverflow.com/a/26125842
favorite count: 0
tagged with: selenium-ide
type: UnansweredQuestion
has title: How to select proper Action for web target in Selenium IDE
has comment: http://stackoverflow.com/comment/41156240
answer count: 4
has answer: http://stackoverflow.com/a/27439718

http://stackoverflow.com/comment/40429401
type: Comment
comment on: http://stackoverflow.com/a/25839486
type: AnswerComment
score: 0
has text: Ok, it should work now, make the changes and let me now if it works

http://stackoverflow.com/q/25811417
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25824773
tagged with: liferay-aui
tagged with: java
type: Question
tagged with: bean-validation
has body: I'm creating a portlet using SpringWebFlow, this portlet has a JSP having some entry fields, some dropdowns, and few radio buttons, I've used BeanValidation and annotations like @NotNull and @NotEmpty are working fine for dropdowns and entry fields, but annotations are not working for RadioButton, In my JSP i've this code &lt;aui:field-wrapper name="gender"&gt; &lt;aui:input inlineLabel="right" name="gender" type="radio" value="male" label="male" checked="${surveyBean.gender == 'male' ? 'true' : 'false'}"/&gt; &lt;aui:input inlineLabel="right" name="gender" type="radio" value="female" label="female" checked="${surveyBean.gender == 'female' ? 'true' : 'false'}" /&gt; &lt;/aui:field-wrapper&gt; In my PageBean I've the following code @NotNull @NotEmpty public String getGender() { return gender; } What I want is user should not left any fields blank or unselected, for entry fields and dropdown proper error messages are displayed from Validation.properties file if they are left blank,,, for radio button @NotNull and @NotEmpty are not working means they are not getting validated so even they are not selected user is able to go to next page... Could any of you please guide me in the right direction??
score: 0
answer count: 1
tagged with: spring-webflow
has title: BeanValidation not working for Radio Buttons
type: UnansweredQuestion

http://stackoverflow.com/q/25772314
has title: JOptionPane.showMessageDialog keeps reappearing
has body: My code is supposed to ensure that users only enter a binary string. Everything goes right and in order if I enter a correct binary number (1, 0). But when I enter a wrong number (alphabet or number other than 0 and 1) JOptionPane.ShowMessageDialog appears showing the error message, and when I click "OK" or "Cross" Button it reappears again. So to close the app I have to use the process manager to kill "java.exe". Here is the complete code for my app: import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.*; class Bn extends JFrame { private JLabel l1; private JLabel l2; private JLabel l3; private JTextField tf; private JButton oc; private JButton hd; private JButton dc; public Bn() { setTitle("Binary Conversion"); setSize(350 , 190); setResizable(false); setLocation(720 , 200); //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout(FlowLayout.CENTER, 25, 10)); l1 = new JLabel("&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;BINARY CONVERSION&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;"); l2 = new JLabel("Enter The Number:"); l3 = new JLabel(" Convert to: "); tf = new JTextField(25); oc = new JButton("Octal"); hd = new JButton("Hexa Decimal"); dc = new JButton("Decimal"); add(l1); // Binary conversion add(l2); // Enter The Number add(tf); // Text Field add(l3); // Conver to add(oc); // Octal add(hd); // Hexa Decimal add(dc); // Decimal oc.addActionListener(new cvr()); hd.addActionListener(new cvr()); dc.addActionListener(new cvr()); setVisible(true); } void res() { int b = 0; String num = tf.getText(); int i , l; l = num.length(); char ch; do { for (i=0 ; i&lt;l ; i++) { b = 0; ch = num.charAt(i); if (Character.isDigit(ch) &amp;&amp; (ch == 48 || ch == 49)) b=1; else { JOptionPane.showMessageDialog(null, "Please enter a binary number (1 , 0)"); } } } while(b != 1); } void occ() { res(); String num = tf.getText(); long dec = Long.parseLong(num,2); String oct = Long.toOctalString(dec); JOptionPane.showMessageDialog(null, "Octal equivalent is: "+ oc…
has answer: http://stackoverflow.com/a/25772400
has comment: http://stackoverflow.com/comment/40304502
score: 0
tagged with: while-loop
answer count: 1
tagged with: joptionpane
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/40304523
tagged with: java
type: Question

http://stackoverflow.com/comment/40279505
type: QuestionComment
has text: Please make sure that tomcat have the run time dependency of the `org.springframework.web.servlet.jar` jar.Or this issue might also due to the incompitable jar or conflicting jars
comment on: http://stackoverflow.com/q/25758308
score: 0
type: Comment

http://stackoverflow.com/comment/40402082
type: Comment
has text: It is working for me. I think you made some mistake in that. can you please check once
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25825659

http://stackoverflow.com/a/44058669
answers question: http://stackoverflow.com/q/25793628
type: Answer
downvote count: 0
upvote count: 8
has body: This played hell on me for hours too when using Jackson to serialize / deserialize instances of ZonedDateTime and then compare them against each other for equality to verify that my code was working correctly. I don't fully understand the implications but all I've learned is to use isEqual instead of equals. But this throws a big wrench in testing plans as most assertion utilities will just call the standard .equals(). Here's what I finally came up with after struggling for quite some time: @Test public void zonedDateTimeCorrectlyRestoresItself() { // construct a new instance of ZonedDateTime ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Z")); // offset = {ZoneOffset@3820} "Z" // zone = {ZoneOffset@3820} "Z" String starting = now.toString(); // restore an instance of ZonedDateTime from String ZonedDateTime restored = ZonedDateTime.parse(starting); // offset = {ZoneOffset@3820} "Z" // zone = {ZoneOffset@3820} "Z" assertThat(now).isEqualTo(restored); // ALWAYS succeeds System.out.println("test"); } @Test public void jacksonIncorrectlyRestoresZonedDateTime() throws Exception { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.findAndRegisterModules(); // construct a new instance of ZonedDateTime ZonedDateTime now = ZonedDateTime.now(ZoneId.of("Z")); // offset = {ZoneOffset@3820} "Z" // zone = {ZoneOffset@3820} "Z" String converted = objectMapper.writeValueAsString(now); // restore an instance of ZonedDateTime from String ZonedDateTime restored = objectMapper.readValue(converted, ZonedDateTime.class); // offset = {ZoneOffset@3820} "Z" // zone = {ZoneOffset@3821} "UTC" assertThat(now).isEqualTo(restored); // NEVER succeeds System.out.println("break point me"); }
score: 8

http://stackoverflow.com/comment/40369201
score: 0
type: QuestionComment
type: Comment
has text: Did you try painting with color.Transparent()?
comment on: http://stackoverflow.com/q/25806349

tablemodel
type: Tag
tags question: http://stackoverflow.com/q/25719643
tag name: tablemodel

http://stackoverflow.com/q/25729935
accepted answer: http://stackoverflow.com/a/25840469
tagged with: saaj
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: weblogic
possible better answer: http://stackoverflow.com/a/63794041
tagged with: multipart
answer count: 3
upvote count: 1
has title: The SOAPBody content cannot be extracted if more than 1 child element exists
has answer: http://stackoverflow.com/a/34926391
has answer: http://stackoverflow.com/a/63794041
tagged with: soap
favorite count: 0
has body: I'm trying to read a SOAP response (content-type multipart/mixed. Mime headers: application/soap+xml) This is working for us in Java 1.6 and Weblogic 11g, but not in Java 1.7/Weblogic 12c. The extractContentAsDocument() that throws the exception is coming from: jar:file:/u01/app/oracle/Middleware/12c/oracle_common/modules/com.oracle.webservices.orasaaj-rt-api_12.1.2.jar!/oracle/j2ee/ws/saaj/soap/soap12/Body12.class Error: javax.xml.soap.SOAPException: The SOAPBody content cannot be extracted if more than 1 child element exists at oracle.j2ee.ws.saaj.soap.BodyImpl.extractContentAsDocument(BodyImpl.java:233) at queryProducer(queryProducer.java:84) queryProducer.java:83: SOAPMessage response = dispatch.invoke(request); return response.getSOAPBody().extractContentAsDocument(); full response (as a string): urn:ihe:iti:2007:CrossGatewayQueryResponse f3116ff8-378d-11e4-b68e-8f828f8a95e9 urn:ihe:iti:2007:CrossGatewayQuery &lt;AdhocQueryResponse xmlns="urn:mynamespace" status="urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success"&gt; ... Maven Dependency Tree: [INFO] mypackage.myapp:myapp_wrap_haims_query:war:4.4.1.158-SNAPSHOT [INFO] +- mypackage.integration:integration-bpm:jar:4.4.1.158-SNAPSHOT:compile [INFO] | +- mypackage.integration:integration-http:jar:4.4.1.158-SNAPSHOT:compile [INFO] | | \- org.apache.cxf:cxf-rt-frontend-jaxrs:jar:2.7.7:compile [INFO] | | +- org.apache.cxf:cxf-api:jar:2.7.7:compile [INFO] | | | +- org.codehaus.woodstox:woodstox-core-asl:jar:4.2.0:compile [INFO] | | | | \- org.codehaus.woodstox:stax2-api:jar:3.1.1:compile [INFO] | | | +- org.apache.ws.xmlschema:xmlschema-core:jar:2.0.3:compile [INFO] | | | \- org.apache.geronimo.specs:geronimo-javamail_1.4_spec:jar:1.7.1:compile [INFO] | | +- org.apache.cxf:cxf-rt-core:jar:2.7.7:compile [INFO] | | +- javax.ws.rs:javax.ws.rs-api:jar:2.0-m10:compile [INFO] | | +- org.apache.cxf:cxf-rt-bindings-xml:jar:2.7.7:compile [INFO] | | \- org.apache.cxf:cxf-rt-transports-http:jar:2.7.7:compile [INFO] | +- …
has answer: http://stackoverflow.com/a/25840469

http://stackoverflow.com/a/25831398
score: 1
downvote count: 0
has body: Actually your approach is also wrong / bad practice. Starting new activity and finishing current should be done on main thread. Also try to avoid final objects initialization, they may stack in memory. Here is one of correct approaches (postDelayed() will be perform on MainThread): public class StartActivity extends Activity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.start_screen); View view = findViewById(R.id.any_view_from_start_screen_layout); view.postDelayed(new Runnable(){ public void run(){ startNewActivityAndCloseCurrent(); },3000); } private void startNewActivityAndCloseCurrent(){ Intent myAct = new Intent(this, MyActivity.class); startActivity(myAct); finish(); } }
type: Answer
answers question: http://stackoverflow.com/q/25827856
upvote count: 1

http://stackoverflow.com/comment/40414431
comment on: http://stackoverflow.com/a/25832448
score: 0
type: AnswerComment
has text: thanks...so one more doubt: we require AdapterView because we combine child view elements in one parent view element. exactly?
type: Comment

http://stackoverflow.com/comment/40368364
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25807327
has text: yes i'm using maven. I solved the problem by adding this to the tomcat launch configuration: -Dlog4j.configurationFile="file:C:\blah...\src\main\resources\log4j2.xml"

http://stackoverflow.com/a/25783916
downvote count: 0
has comment: http://stackoverflow.com/comment/40361627
has body: Most likely you're using two different version of Guava. Add the line System.out.println(ImmutableSet.class.getClass().getResource("/")); to the line before the exception to find out where the conflicting version resides. Current Guava has the method public static &lt;E&gt; ImmutableSet&lt;E&gt; copyOf(E[] elements) {} Some older version (e.g., Google collections) do not. It looks like com.google.gdata.wireformats.AltFormat$Builder accesses the old version.
has comment: http://stackoverflow.com/comment/40360469
type: Answer
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40329472
answers question: http://stackoverflow.com/q/25783381
has comment: http://stackoverflow.com/comment/40326700
has comment: http://stackoverflow.com/comment/40326925
has comment: http://stackoverflow.com/comment/40329786
has comment: http://stackoverflow.com/comment/40328725
has comment: http://stackoverflow.com/comment/40329002
has comment: http://stackoverflow.com/comment/40330062

http://stackoverflow.com/comment/40227362
type: QuestionComment
has text: Check out Oracle NoSQL, which can be tuned to support data integrity. Also, NoSQL database should not be use as your primary datasource.
score: 0
comment on: http://stackoverflow.com/q/25728532
type: Comment

http://stackoverflow.com/comment/40277147
has text: The best links I could come up with, I put in the [Java Web Start info.](http://stackoverflow.com/tags/java-web-start/info) page linked above! (And again in this comment..) Let me know if any of the links are out of date, I can hunt down new addresses and update it.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25755300
type: Comment

http://stackoverflow.com/a/25740065
has comment: http://stackoverflow.com/comment/40260803
type: Answer
answers question: http://stackoverflow.com/q/25739891
has comment: http://stackoverflow.com/comment/40260883
upvote count: 1
has comment: http://stackoverflow.com/comment/40260736
score: 1
has comment: http://stackoverflow.com/comment/40260469
has comment: http://stackoverflow.com/comment/40246444
has comment: http://stackoverflow.com/comment/40246872
has body: For your activity to catch this though you need to add an attribute to the activity node in the manifest file to handle the change. &lt;activity android:name=".My_Activity" android:label="@string/app_name" android:configChanges="orientation"&gt; In You Activity Class: @Override public void onConfigurationChanged(Configuration myConfig) { super.onConfigurationChanged(myConfig); int orient = getResources().getConfiguration().orientation; switch(orient) { case Configuration.ORIENTATION_LANDSCAPE: //you can remove this case if you want break; case Configuration.ORIENTATION_PORTRAIT: //You can give a toast here break; default: //take necessary action } }
downvote count: 0

http://stackoverflow.com/q/25854077
linked to: http://stackoverflow.com/q/3745905
has title: Calling a servlet from another servlet after the request dispatcher.forward method
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40454199
has body: I'm writing a web page using java servlets. When the user subscribes he will receive an email with the activation link. Currently the servlet redirects the user (using the request dispatcher) to the thank you page after it sends the email and this takes some time. I would like to redirect the user to the page before the email is created and sent and then have the email creation performed by another servlet without the user having to wait. Is this possible? How can I call a servlet from within another servlet after using the request dispatcher.forward method? Is that possible? If not, then what is the best way to do what I want? Thanks.
linked to: http://stackoverflow.com/q/533783
tagged with: java
has answer: http://stackoverflow.com/a/25857023
tagged with: servlets
type: Question
has answer: http://stackoverflow.com/a/25854397
has comment: http://stackoverflow.com/comment/40454962
has comment: http://stackoverflow.com/comment/40457624
downvote count: 0
tagged with: jsp
possible better answer: http://stackoverflow.com/a/25856765
has answer: http://stackoverflow.com/a/25856765
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40453816
score: 1
accepted answer: http://stackoverflow.com/a/25854397

xmpp
tags question: http://stackoverflow.com/q/25831411
tags question: http://stackoverflow.com/q/25747859
tags question: http://stackoverflow.com/q/25731017
type: Tag
tags question: http://stackoverflow.com/q/25785543
tags question: http://stackoverflow.com/q/25846857
tag name: xmpp

http://stackoverflow.com/a/25867144
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25866756
has comment: http://stackoverflow.com/comment/40478203
score: 3
upvote count: 3
has body: Consider what can happen with this code: a.join(); b.join(); proceed(); Both threads may be dead&mdash;proceed immediately; a dead, b alive: block on second line until b dead; a alive, b dead: block on first line until a dead; both alive: block on first line until a dead, then block as needed until b dead. All four cases share the following invariant: proceed() is reached as soon as, but no sooner than, both a and b are dead.
has comment: http://stackoverflow.com/comment/40478299

http://stackoverflow.com/q/25817592
has answer: http://stackoverflow.com/a/25817641
tagged with: static
has comment: http://stackoverflow.com/comment/40387916
tagged with: classloader
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40387887
has comment: http://stackoverflow.com/comment/40387846
tagged with: constants
tagged with: java
has comment: http://stackoverflow.com/comment/40387950
has comment: http://stackoverflow.com/comment/40387971
has body: i'm looking to declare a constant in the class, so that it'll be set the first thing when the class is loaded, and won't change. However, the value it should be set to depends on the content of the file the class reads from a file. The following won't work: static final int N=someMethod(path); unless I also have: static Path path = Paths.get("C:\\Users\\Me\\S2.txt"); If i do this, the param of Paths.get() will have to be manually changed for each run. Giving the path name on invocation of Java won't do either-- that's solely the String[] argument of the main() method(?), and main() doesn't run till later. Is there a better way of doing this than what i do in the above two lines of code? TIA
type: Question
linked to: http://stackoverflow.com/q/5189914
answer count: 2
has answer: http://stackoverflow.com/a/25817672
has title: constant field member to be initialized based on the value of a param from outside
score: 0

http://stackoverflow.com/q/25724704
tagged with: solr
has title: Testing a setting of a parameter by a custom Solr search component
has body: I'm writing a Solr search component that all it does is setting some input parameters in its prepare method: @Override public void prepare(ResponseBuilder rb) throws IOException { ModifiableSolrParams params = new ModifiableSolrParams(rb.req.getParams()); String paramValue = calculateParamValue(); params.set("paramName", paramValue); rb.req.setParams(params); } The component sets the values of a few parameters (as shown in the simplified code sample). The components that come later in the handler's component chain use those values. I would like to separate the testing of my component and test it independently of the components that follow it in the chain. The problem is that the component doesn't add entries to Solr's response. All it does is setting parameters which are only visible to other Solr components. Unfortunately, Solr's testing framework doesn't seem to let me make assertions on the parameters, just on the returned response. Currently I'm testing the component with a dummy search component that does the tests as part of its processing. I don't like the solution because it doesn't allow me to separate test code from source code. Is there a better way to test the component?
tagged with: unit-testing
tagged with: java
type: UnansweredQuestion
score: 2
answer count: 0
downvote count: 0
tagged with: lucene
type: Question
favorite count: 0
upvote count: 2

http://stackoverflow.com/q/25723798
has comment: http://stackoverflow.com/comment/40215126
possible better answer: http://stackoverflow.com/a/25724393
has answer: http://stackoverflow.com/a/25724393
answer count: 2
has title: How to make a count down timer in Java?
has comment: http://stackoverflow.com/comment/40215067
has comment: http://stackoverflow.com/comment/40214907
tagged with: android
has answer: http://stackoverflow.com/a/25723870
has comment: http://stackoverflow.com/comment/40214813
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40214821
accepted answer: http://stackoverflow.com/a/25723870
type: Question
linked to: http://stackoverflow.com/q/10032003
has body: I watched TheNewBostons Video on countdown timers in Java, but he just showed how to display them. I want to know how to get them to work and actually count downwards. So how would I get a timer that starts of with 5 and counts down to 0 and then do something at 0 and after it did something start the counter again and keep repeating it?

http://stackoverflow.com/q/25832279
type: Question
has body: I am aware that there are tons of questions around about this problem but I tried every ungodly way to fix it, still no result. I have created a "test" Derby database within Netbeans. Everything works fine, I can execute SQL commands, alter tables and all within application. But i have to start the server everytime when I open netbeans. But I want my application's itself to start the server with codes. I guess i tried everything to do it. Class.forName("org.apache.derby.jdbc.EmbeddedDriver"); server = new NetworkServerControl(InetAddress.getLocalHost(),1527); server.start(null); conn = DriverManager.getConnection("jdbc:derby://localhost:1527/test;create=true;"); This is what i get if i dont start the server manually. java.sql.SQLNonTransientConnectionException: java.net.ConnectException : Error connecting to server localhost on port 1527 with message Connection refused: connect. I tried different drivers, i tried putting jar and sdk files to my app file. I added permission to socket 1527 to java.security file. No matter what i do, i must start the server manually or i get this chunk of code.
upvote count: 1
tagged with: derby
has comment: http://stackoverflow.com/comment/40414178
tagged with: connection
favorite count: 0
has comment: http://stackoverflow.com/comment/40432359
answer count: 0
type: UnansweredQuestion
has title: Java DB - Starting Server within application
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40421988

http://stackoverflow.com/q/25828082
tagged with: batch-processing
tagged with: cmd
type: UnansweredQuestion
downvote count: 1
has title: Execute tableau commands Through java
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40407135
has comment: http://stackoverflow.com/comment/40407165
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/40407394
has answer: http://stackoverflow.com/a/25828868
answer count: 1
favorite count: 0
has body: I am trying to execute 3-7 commands using Java. First, I need to change the directory with cd and later execute commands 2) and 3). 1) Process p = runtime.exec("cmd /c start cmd.exe /C \"cd C:\\Program Files\\Tableau\\Tableau Server\\8.2\\bin"); and then i want to write 2) runtime.exec("cmd /c start cmd.exe /K \tabcmd login -s http://localhost:80 -u c200433 -p venkat@#"); and in the below command i am getting file name from a string, can I use this format ? 3) runtime.exec("tabcmd publish C:\\Users\\c200433\\Desktop\\Ana\\".getBytes()+filename+" --db-username IIP_RBM_USER --db-password Ytpqxsb9dw".getBytes())); I need to execute all these commands. How do i do this?

http://stackoverflow.com/a/25746200
has comment: http://stackoverflow.com/comment/40257637
type: Answer
has comment: http://stackoverflow.com/comment/40473468
score: 0
has body: Try "update Mutable e set e.Name = '\u0411\u043b\u0430\u0433\u43e\u00434\u0430\u0440\u044f'"; This u-escaping to ASCII removes one problem: that the encoding of the java source text must be the same as the encoding used by the javac compiler. Then easily the results can be displayed false in a Windows or IDE console with a non-Cyrillic encoding. Check the results in the database, as you did. You can check the value indirect: System.out.println("Okay: " + !fieldValue.contains("?")); Verify that the connection string is something like: "jdbc:mysql:///dbname?useUnicode=true&amp;characterEncoding=utf-8" which ensures that the driver communication uses UTF-8.
answers question: http://stackoverflow.com/q/25745495
has comment: http://stackoverflow.com/comment/40257260

http://stackoverflow.com/a/26390909
answers question: http://stackoverflow.com/q/25832317
upvote count: 2
has body: I suspect that you might have exported = false on your PersonEntity object. Because of this, any references in PersonEntity will be added to the _links section of your TeamEntity. Because both PersonEntity objects have a createdBy reference, they are colliding with the TeamEntity.createdBy reference. To understand what is happening this example might help: class Answer { Question q; //JPA ManyToOne back-reference } class Question { List&lt;Answer&gt; as; // JPA OneToMany reference } class UserAnswer { Answer a; Question q; } In my case, because an Answer can only exist within a Question, we have the following on our AnswerResource, to prevent Answers from being exported: @RestResource(exported = false) This causes Answer objects to be serialized within the parent object, rather than as a reference in the _links section, and this ends up being the cause of the problem.... When UserAnswer is serialized, it renders something like this: { "answer" : { "creationDate" : "2014-09-18T17:28:31.000+0000", "modificationDate" : "2014-09-18T17:28:31.000+0000", "answerText" : "Vendas", }, "_links" : { "self" : { "href" : "http://localhost:9090/data/userAnswers/15" }, "question" : { "href" : "http://localhost:9090/data/userAnswers/15/question" } } } Note that "_links.question" above is from the Answer! So if you add a Question to UserAnswer, you will see the error you are asking about, because the UserAnswer itself also wants to include a _link reference to a Question. In your case, I think your PersonEntity and your TeamEntity both have createdBy references. I'm not 100% sure what the solution is yet, I don't know if you can specify hierarchical rel names.
score: 2
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/47455693

http://stackoverflow.com/comment/40292497
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25765825
has text: Not exception always the message from catch block.

http://stackoverflow.com/q/25798883
tagged with: java
tagged with: loops
type: Question
has body: I wrote a program to check whether a word does not have any duplicate letters. There are two problems I am having: 1 - I wrote this in object oriented code and I am having an issue calling my main method. 2- When I had the code in one method - not broken up into pieces - the Boolean was not changing base on my checkLetters method. The output was the same - no matter what the test value was. I am a java beginner and I would appreciate any advice. Thank you! import java.util.Scanner; public class uniqueLetters { boolean isUnique; char temp; int i = 0; String str; char[] letters; public static void main(String[] args) { testWord testing = new testWord(); } private void testWord() { getArray(); checkLetters(); getStatement(); } private void getArray() { Scanner keyboard = new Scanner(System.in); System.out.println("Please enter your word:"); str = keyboard.nextLine(); letters = str.toCharArray(); } private boolean checkLetters() { boolean isUnique = true; for (i = 0; i &lt; letters.length; i++) { for (int j = 0; j &lt; letters.length; j++) { if (letters[i] == letters[j]) isUnique = false; } } return isUnique; } private void getStatement() { if (checkLetters()) System.out.print("This word has all unique letters"); else System.out.print("This word has duplicate letters"); } }
upvote count: 0
score: -2
accepted answer: http://stackoverflow.com/a/25798937
answer count: 1
favorite count: 0
has title: Code detects string as having duplicate letters, even when it does not
downvote count: 2
has answer: http://stackoverflow.com/a/25798937
type: AnsweredQuestion

http://stackoverflow.com/comment/40575676
has text: Ahh, my mistake on misreading that solution. I have not tried calling it on the editor component, only the table at this point. I'll have some time to play around with it tonight, so I'll give it a shot and report back. Thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/25821481
score: 0
type: Comment

http://stackoverflow.com/a/25797902
type: Answer
has comment: http://stackoverflow.com/comment/40353236
has comment: http://stackoverflow.com/comment/40353499
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25797441
answers question: http://stackoverflow.com/q/25797441
has body: As far as I know it's not possible. When you use &lt; in the command line to read from a file, the content of System.in is controlled by the shell, not by Java. readLine() returning null is the way Java signals that you've reached the end of file, and is also what you get if you send EOF/type Ctrl-D in the shell.

http://stackoverflow.com/comment/40271027
score: 0
comment on: http://stackoverflow.com/q/25753404
type: Comment
type: QuestionComment
has text: i think it is hard to decide. i do not see any real advantages to store **constants** in database or XML...but this may depend on the project...

http://stackoverflow.com/a/25807154
downvote count: 0
has comment: http://stackoverflow.com/comment/40367947
has comment: http://stackoverflow.com/comment/40368341
upvote count: 3
has comment: http://stackoverflow.com/comment/40368440
has comment: http://stackoverflow.com/comment/40368914
answers question: http://stackoverflow.com/q/25807055
has body: You can do it using Java Control Panel. How do I clear the Java cache? How can do it in command line? This will be the command to clear cache javaws -clearcache // Remove all non-installed applications from the cache. And javaws -uninstall // Remove all applications from the cache.
type: Answer
score: 3

http://stackoverflow.com/a/25780691
has body: Because in case of a specific exception that you are actually expecting to happen, you are going to handle it in a different way. For example, you may want to create the file when you get FileNotFoundException. If you go broad to narrow as in the example you provided, then FileNotFoundException will never be caught, because a broader one, Exception is used first. So broad to narrow is useless.
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25780619
accepted answer of: http://stackoverflow.com/q/25780619
upvote count: 1

http://stackoverflow.com/q/25768735
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/28780244
has answer: http://stackoverflow.com/a/26146406
type: Question
upvote count: 6
linked to: http://stackoverflow.com/q/28001476
tagged with: google-cloud-storage
answer count: 2
favorite count: 0
tagged with: google-authentication
type: UnansweredQuestion
tagged with: scala
score: 6
has body: I'm trying to use google cloud storage java library in scala to list items in a bucket val credential = new GoogleCredential.Builder() .setTransport(GoogleNetHttpTransport.newTrustedTransport()) .setJsonFactory(JacksonFactory.getDefaultInstance()) .setServiceAccountId("xxx@developer.gserviceaccount.com") .setServiceAccountScopes(Collections.singleton(StorageScopes.DEVSTORAGE_READ_ONLY)) .setServiceAccountPrivateKeyFromP12File(new File("file.p12")) .build() val storage = new Storage.Builder( GoogleNetHttpTransport.newTrustedTransport(), JacksonFactory.getDefaultInstance(), credential) .setHttpRequestInitializer(credential) .setApplicationName("app") .build() storage.objects.list("bucket").execute however I got com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden { "code" : 403, "errors" : [ { "domain" : "global", "message" : "Forbidden", "reason" : "forbidden" } ], "message" : "Forbidden" } my email account have the access to the bucket, I can access it using gsutil by creating a project in my account as well. I've created xxx@developer.gserviceaccount.com in a project in my account as well, any idea that how can I set the permission?
has title: access google cloud storage using java library gets '403 forbidden'

http://stackoverflow.com/comment/40466892
has text: This may help https://github.com/romannurik/Android-WizardPager
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25861095

http://stackoverflow.com/a/25747614
score: 4
type: Answer
answers question: http://stackoverflow.com/q/25747473
upvote count: 4
has body: Your problem in next line JButton button = (JButton) e.getSource(); in actionPerformed() method. Because you add ButtonListener to JButton and to Timer. You can use different listeners for them, or you can validate type of e.getSource(); in actionPerformed()
downvote count: 0

http://stackoverflow.com/q/25763155
type: Question
has comment: http://stackoverflow.com/comment/40288345
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/31765308
favorite count: 0
tagged with: spring-data-jpa
upvote count: 8
has title: Spring Data JPA Repositories: Is it possible to give the params a default Value / default all?
has comment: http://stackoverflow.com/comment/40288518
has body: So, in short terms: Is it possible to set a parameter to "default: All" or more generally to a default specific value in Spring Data JPA (possibly @Query-Annotated) Repository-Methods? I'm aware that it's possible in (Rest)controllers to set a default Value, i'm just curious if it's possible to do it at Repository-Level, too. Might be a nice feature I think, for "get me some filtered resultSet where filters might be not set in frontend by a rest-call" is a very common use-case. Example-Query: @Query("select new com.my.dto(e.name, e.age, e.address)" + " from Entity e" + "where e.name like ?1 " + "and e.age like ?2 " + "and e.street like ?3") List&lt;Item&gt; findItemsFiltered(String name, String age, String street); So when let's say street is not set, the Repository should use "%" to return all Results where the other criteria is matching but the street is not relevant.
score: 8
has comment: http://stackoverflow.com/comment/40290612
type: UnansweredQuestion
tagged with: spring
linked to: http://stackoverflow.com/q/25761416
tagged with: java
tagged with: orm

http://stackoverflow.com/a/36355309
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25853880
has body: Try this out... double tuition = 10000; double count = 1; double percentageIncrease = 1.05; double increasedTuition; double sumOfTuitionAfterFourYears = 0; double increasedTuitionTwo; do { //This is the correct incremental formular tuition = tuition * percentageIncrease; //increasedTuition = increasedTuition * percentageIncrease; count++; //Formatting the number of digits after the decimal point increasedTuition = (int)(tuition * 100) / 100.0; //This if statement must be inside the loop body if (count &gt; 10) //Note, do not put a semi-colon here System.out.println("Tuition in ten years is " + increasedTuition); } while (count &lt;= 10); //End of first loop do { increasedTuition = increasedTuition * percentageIncrease; //Formatting the number of digits after the decimal point increasedTuitionTwo = (int)(increasedTuition * 100) / 100.0; //Adding the result above on each iteration pass sumOfTuitionAfterFourYears += increasedTuitionTwo; if (count == 14) System.out.println("The sum of four years tuition starting from 10 years is " + sumOfTuitionAfterFourYears); //Increments the count from 10 since our base tuition is the last tuition in the last loop //You can also write your continuation-condition like this: (count &gt;= 10 &amp;&amp; count &lt;= 14). //You will get the same result without changing the base tuition count++; } while (count &lt;= 14); //End of second loop

http://stackoverflow.com/comment/40607444
comment on: http://stackoverflow.com/a/25932468
score: 0
type: AnswerComment
has text: I tried these JVM parameters and apparently GC is not able to free the old gen space and keeps rying to free the memory forever each time able to recover hardly any memory.
type: Comment

http://stackoverflow.com/comment/40283119
comment on: http://stackoverflow.com/q/25760269
score: 0
type: Comment
type: QuestionComment
has text: This could be useful, I'll take a look, Thanks :)

akka
type: Tag
tags question: http://stackoverflow.com/q/25744749
tags question: http://stackoverflow.com/q/25765858
tag name: akka
tags question: http://stackoverflow.com/q/25867916
tags question: http://stackoverflow.com/q/25858870

http://stackoverflow.com/comment/54414157
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/25751248
type: Comment
has text: Perhaps this change in the last years. See the multithreading section here:http://www.h2database.com/html/features.html

http://stackoverflow.com/a/25810329
has body: IMHO, you should use a map String[] arrayA = {"a1", "a2", "a3"}; String[] arrayB = {"b1", "b2", "b3"}; String[] arrayC = {"c1", "c2", "c3"}; HashMap&lt;String, String[]&gt; mapArray = new HashMap&lt;String, String[]&gt;(); mapArray.put("A", arrayA); mapArray.put("B", arrayB); mapArray.put("C", arrayC); when you want to retrieve your array public static void printArray(String id) { System.out.println("Array " + id + ": " + Arrays.toString(mapArray.get(id))); }
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/25809764
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25809764

http://stackoverflow.com/q/25862879
upvote count: 1
downvote count: 1
favorite count: 0
tagged with: linux
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25863407
tagged with: java
type: Question
has body: I using Processbuilder as follows: List&lt;String&gt; args = initArgs(); ProcessBuilder pb = new ProcessBuilder(args); tdmServerProcess = pb.start(); handleInfoLog(tdmServerProcess.getInputStream()); handleErrorLog(tdmServerProcess.getErrorStream()); In the initArgs method I am setting the linux commands I want to execute, as follows: args.add("java -version"); args.add(javaHome + File.separator + "bin" + File.separator + "java"); first command is getting executed successfully. But second is failing with following error: /opt/java7/bin/java: cannot execute binary file though i have execute permission, following are permission bits: -r-xr-xr-x I am able to execute the same command from terminal.
score: 0
has answer: http://stackoverflow.com/a/25863188
answer count: 2
has title: Not able to execute linux command using processBuilder

http://stackoverflow.com/a/25816556
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25812699
accepted answer of: http://stackoverflow.com/q/25812699
has body: It is instructive to consider what the class looks like after removing type parameters (type erasure): public class Test { Map map = new HashMap(); public static void main (String ... args) { Test test = new Test(); test.put("test", "value"); System.out.println("Test: " + test.get("test", Double.class)); } public Object get(String key, Class clazz) { return map.get(key); } public void put(String key, Object value) { map.put(key, value); } } This compiles and produces the same result that you see. The tricky part is this line: System.out.println("Test: " + test.get("test", Double.class)); If you had done this: Double foo = test.get("test", Double.class); then after type erasure the compiler would have inserted a cast (because after type erasure test.get() returns Object): Double foo = (Double)test.get("test", Double.class); So analogously, the compiler could have inserted a cast in the above line too, like this: System.out.println("Test: " + (Double)test.get("test", Double.class)); However, it doesn't insert a cast, because the cast is not necessary for it to compile and behave correctly, since string concatenation (+) works on all objects the same way; it only needs to know the type is Object, not a specific subclass. Therefore, the compiler can omit an unnecessary cast and it does in this case.

http://stackoverflow.com/a/25846199
score: 0
answers question: http://stackoverflow.com/q/25846083
type: Answer
has body: Try this : it will add new item to the end of your previous list. mConversationArrayAdapter.addAll(readMessage);

http://stackoverflow.com/q/25753568
tagged with: ram
answer count: 2
has body: I just found VFS as a way to access sftp. Seems to work but all the examples assume a local file; instead I have my data in memory. I only see a method copyFrom(FileObject), no overloads accepting a stream or a buffer... So I tried ram as it sounds approximately right (some documentation wouldn't hurt but I can't fine any) and the following test succeeds. Copying into an sftp FileObject also worked. QUESTION. It gives the following output: INFO: Using "C:\Users\myname\AppData\Local\Temp\vfs_cache" as temporary files store. -- is it actually writing a temp file?? That's what I was trying to avoid (due to potential permissions/concurrency problems on the Unix servers where this thing will run). If it does, how do I do it completely in-memory? // try to copy a string from memory into a FileObject public class VFSTest { public static void main(String[] args) throws IOException { String hello = "Hello, World!"; FileObject ram = VFS.getManager().resolveFile("ram:/tmp"); OutputStream os = ram.getContent().getOutputStream(); os.write(hello.getBytes()); ram.getContent().close(); FileObject local = VFS.getManager().resolveFile("C:\\foo.txt"); local.copyFrom(ram, Selectors.SELECT_SELF); } }
tagged with: java
type: UnansweredQuestion
tagged with: apache-commons-vfs
upvote count: 4
has answer: http://stackoverflow.com/a/65395288
downvote count: 0
has title: Apache VFS in-memory
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/43986703
has answer: http://stackoverflow.com/a/27783261
score: 4

http://stackoverflow.com/q/25819907
answer count: 1
has answer: http://stackoverflow.com/a/25828127
has title: Using JNI with a C function that returns multiple short int pointers whose size is not pre-determined
has body: I have a C function to be used in an Android app that "returns" multiple short (int) pointers and the number of short ints pointed to by each pointer via the parameter list. I want to return all these lists to the calling Java class, so can't use a single return type for the function. It seems that I need to know before hand the size of the list in order to pre-allocate a java short[] with enough memory as follows: inside java class short[] fooArr = new short[2]; short[] mooArr = FibLib.testFunc(fooArr); inside c file JNIEXPORT jshortArray JNICALL Java_com_funTest_testFunc(JNIEnv *env, jclass clazz, jshortArray retData) { // retData is the data returned to the caller via the parameter list // it is declared in the java section and a pointer is created here jshort outCArray[] = {100, 200}; // some fake data; in reality the size of this list is unknown until runtime jshort *cArray = (*env)-&gt;GetShortArrayElements(env, retData, NULL); if (cArray == NULL) { return 0; } else { //jini len = (*env)-&gt;GetArrayLength(env, array); jsize len = (*env)-&gt;GetArrayLength(env, retData); jint ix; for (ix = 0; ix &lt; len; ix++) { cArray[ix] = outCArray[ix]; // this will modify retData with the new values when we release } (*env)-&gt;ReleaseShortArrayElements(env, retData, cArray, 0); // mode 0 to copy back the content and free cArray } jshortArray outJNIArray = (*env)-&gt;NewShortArray(env, 2); // allocate //if (NULL == outJNIArray) return -1; (*env)-&gt;SetShortArrayRegion(env, outJNIArray, 0 , 2, outCArray); // copy return outJNIArray; } If I don't know the size of retData beforehand, how do I pass a "resizeable" fooArr to testFunc?
score: 0
tagged with: android
type: UnansweredQuestion
tagged with: java-native-interface
tagged with: java
tagged with: http://stackoverflow.com/tag/c
type: Question

http://stackoverflow.com/a/25829810
type: Answer
accepted answer of: http://stackoverflow.com/q/25829715
has comment: http://stackoverflow.com/comment/40409690
upvote count: 1
has comment: http://stackoverflow.com/comment/40409671
has comment: http://stackoverflow.com/comment/40409733
answers question: http://stackoverflow.com/q/25829715
score: 1
has comment: http://stackoverflow.com/comment/40409653
has body: Let's work through an example to see how to fix your code. Since the values aren't part of the algorithm, I will ignore them in the following discussion. First, assume we already have a list with the following keys: 5 -&gt; 42 -&gt; 69 Now let's analyze the call list.insert(53, x); which should insert a (key, value) pair as the third element in our list. Start at the beginning of the list. Link pcurrent = pfirst; Create a new node. Link newLink = new Link(key, value); Make sure we are not at the end of the list. if(pcurrent != null) { Step through the list to find the node where the new link should be inserted.Note that we must be very careful with this loop. It is very easy to have an off-by-one error here. while(pcurrent.key &lt;= newLink.key &amp;&amp; pcurrent.next != null) { pcurrent = pcurrent.next; } Note that we must be very careful with this loop. It is very easy to have an off-by-one error here. So let's analyze it more carefully. In our exmple, pcurrent.key starts with a value of 5 which is less than the 53 we are inserting. Also, pcurrent.next is not null. So we move to the next link which has a key of 42. This is still less than 53 and pcurrent.next is still not null. So we move to the next link again. Now pcurrent.next is 69. This isn't less or equal to 53, so the loop terminates. Link temp = pcurrent.next ; pcurrent.next = newLink; newLink.next = temp; Now we insert after the 69. Ooops! We are off by one. So our loop is incorrect. To fix this we will need another Link variable, call it previous. Then you can insert after previous and everything should be fine. Link pcurrent = pfirst; Link previous = null; // Add this declaration Link newLink = new Link(key, value); if(pcurrent != null) { while(pcurrent.key &lt;= newLink.key &amp;&amp; pcurrent.next != null) { previous = pcurrent; // Update previous pcurrent = pcurrent.next; } // insert newLink between previous and next previous.next = newLink; newLink.next = current; } You should also perform a simila…
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40409707
has comment: http://stackoverflow.com/comment/40409643

http://stackoverflow.com/a/30333154
answers question: http://stackoverflow.com/q/25792321
upvote count: 3
has body: Also adding this dependency to pom.xml worked for me :) commons-dbcp commons-dbcp 1.4
score: 3
downvote count: 0
type: Answer

http://stackoverflow.com/a/25747656
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40260845
upvote count: 2
has comment: http://stackoverflow.com/comment/40261120
has comment: http://stackoverflow.com/comment/40260978
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25747485
has body: You should re-structure your code to make it more readable, and eliminate repetition. But first you need to decide on the order of precedence of your variables when more than one of them has the highest value. Here is the sketch of how to modify your code: // You may want to make a dedicated method for this int max = Math.max(Math.max(A, B), Math.max(C, D)); int additional; if (max == A) { additional = 2; } else if (max == B) { additional = 3; } else if (max == C) { additional = 1; } else if (max == D) { additional = 2; } else { throw new IllegalStateException(); } while (h &lt; max + additional) { r.up(); h++; } The idea is to compute the end value using the conditionals, but do the increments in a single loop. The result is a cleaner code without repeated loop.
has comment: http://stackoverflow.com/comment/40260417
answers question: http://stackoverflow.com/q/25747485
has comment: http://stackoverflow.com/comment/40260359

http://stackoverflow.com/q/25721859
answer count: 1
tagged with: ant
tagged with: java
type: UnansweredQuestion
has title: Include other project java files in build.xml
has body: I have project called LTSWebEJB in eclipse. This Project reference another project called LTSCommonUtil. I have written build file for LTSWebEJB as, <?xml version="1.0"?> <property name="build.dir" value="build" /> <property name="jarName" value="LTSWebEJB.jar" /> <property name="JBOSS" value="C:\Lts8083\jboss-as-web-7.0.0.Final" /> <property name="JBOSSLIB" value="${JBOSS}\modules\javax" /> <fileset dir="../LTSWebEAR/ear/lib" includes="*.jar"/> <fileset dir="${JBOSSLIB}/persistence/api/main" includes="*.jar"/> <fileset dir="${JBOSSLIB}/ejb/api/main" includes="*.jar"/> <fileset dir="${JBOSSLIB}/servlet/api/main" includes="*.jar"/> <fileset dir="../LTSCommonUtil/src" includes="src/com/eiw/server/"/> <delete dir="${build.dir}" failonerror="false" /> <delete dir="../LTSWebEAR/ear/${jarName}" failonerror="false" /> <mkdir dir="${build.dir}"/> <classpath refid="project.class.path"/> <fileset dir="src" excludes="*.java"/> <fileset dir="${build.dir}" excludes="**/Test.class" /> But LTSWebEJB fails compilation as it shows cannot find symbol. It is unable to take classes from LTSCommonUtil project. But i had included it in the line "". Please help.
has answer: http://stackoverflow.com/a/25722944
type: Question
tagged with: build.xml
score: 0

http://stackoverflow.com/comment/40262214
type: Comment
comment on: http://stackoverflow.com/a/25748930
type: AnswerComment
score: 0
has text: I don't see how your first paragraph applies. There's no reference to another class' field.

http://stackoverflow.com/comment/40282324
has text: Never used `spring-ws` but when I built your pom, it didn't bring in the required `spring-oxm`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25759812

http://stackoverflow.com/comment/40324083
comment on: http://stackoverflow.com/q/25782956
has text: What are you trying to achieve by putting them in a different location?
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25714167
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40197419
accepted answer of: http://stackoverflow.com/q/25713930
has comment: http://stackoverflow.com/comment/40197188
score: 1
has body: The insertar() method does not insert anything into the Key column, which is declared as NOT NULL.
has comment: http://stackoverflow.com/comment/40197155
has comment: http://stackoverflow.com/comment/40197125
downvote count: 0
answers question: http://stackoverflow.com/q/25713930
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40197675

http://stackoverflow.com/comment/40320167
has text: Duplicate [Why does order matter when catching exceptions?](http://stackoverflow.com/q/15167899/1066779)
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25780619

http://stackoverflow.com/comment/40359207
has text: Thanks :) I have another binding for that. If you put it as a answer I will accept :)
comment on: http://stackoverflow.com/q/25800425
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40358799
comment on: http://stackoverflow.com/q/25800425
score: 0
has text: I'm getting above exception. What could be the reason?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40417778
type: AnswerComment
has text: It all depends on the language and the level of analysis you need. For many classifications tasks a simple tokenizer+stemmer would be sufficient (Lucene does that, or you can tokenize yourself and use Snowball stemmer). For more advanced level of analysis you can use the already mentioned Stanford parser or GATE, or Apache OpenNLP. An even heavier approach may require an entire pipeline, like UIMA or GATE.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25810091

http://stackoverflow.com/q/25782794
type: Question
score: 0
has title: Stop Gson from serializing object in list
answer count: 1
type: UnansweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25783078
has body: When serializing a list of Java objects with Gson, I want the objects to be filtered so that only objects with certain values in a status field are serialized. So far I have come up with using two Gson instances, one with a custom serializer, one without ... gson = gsonBuilder.create(); gsonBuilder.registerTypeAdapter(PropertyValue.class, new PropertyValueSerializer()); strictGson = gsonBuilder.create(); where PropertyValueSerializer looks like this: public static class PropertyValueSerializer implements JsonSerializer&lt;PropertyValue&gt; { @Override public JsonElement serialize(PropertyValue propertyValue, Type typeOfT, JsonSerializationContext context) { PropertyStatus propertyStatus = propertyValue.getStatus(); if (propertyStatus == null || propertyStatus.isIndex()) { return gson.toJsonTree(propertyValue); } else { return null; } } } That is, use default serialization or return null if the status field indicates that the PropertyValue should not be serialized. This executes, but returning null obviously doesn't work for excluding the PropertyValue object from serialization as I get JSON like this: [ { "status": "HasDraft", "sourceInfo": { "author": "UUU", "refId": "6aad7da8-e635-461d-8d42-c9a8aecd61fc" }, "valueType": "TEXT", "value": { "sv": "Rojo" } }, null ] Is there a way to exclude the second PropertyValue object so I get [ { "status": "HasDraft", "sourceInfo": { "author": "UUU", "refId": "6aad7da8-e635-461d-8d42-c9a8aecd61fc" }, "valueType": "TEXT", "value": { "sv": "Rojo" } } ]
tagged with: gson

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/25827662
tags question: http://stackoverflow.com/q/25855047
tags question: http://stackoverflow.com/q/25838757
type: Tag
tags question: http://stackoverflow.com/q/25837873
tags question: http://stackoverflow.com/q/25832379
tags question: http://stackoverflow.com/q/25828722

http://stackoverflow.com/comment/40269883
type: Comment
has text: This: "Circle should contain an appropriate attribute to keep track (count) of the number of Circle objects instantiated" clearly states, that `counter` should be a static member of `Circle`.
comment on: http://stackoverflow.com/a/25753046
score: 0
type: AnswerComment

http://stackoverflow.com/q/25727924
tagged with: spring-jdbc
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has body: I'm using PostgreSQL with Spring JDBC. Everythig building with Gradle: dependencies { compile("org.springframework.boot:spring-boot-starter-web") compile("org.springframework:spring-jdbc") compile("postgresql:postgresql:9.0-801.jdbc4") compile("com.h2database:h2") compile("com.googlecode.json-simple:json-simple:1.1") testCompile("junit:junit") } Here is code fragment where I got exception: String sql = "INSERT INTO " + dbname + " (:fields) VALUES (:values)"; MapSqlParameterSource parameters = new MapSqlParameterSource(); parameters.addValue( "fields", fieldsObj.keySet().toArray() ); parameters.addValue( "values", fieldsObj.values().toArray() ); count = jdbcTemplate.update( sql, parameters ); I get this error: PreparedStatementCallback; bad SQL grammar [INSERT INTO test (?, ?, ?) VALUES (?, ?, ?)]; nested exception is org.postgresql.util.PSQLException I've tried to convert array into string with values, divided by commas, but this gave me same error. What should I do? Or, if you have better ideas what to use, to build custom queries, please, post this idea in comments.
type: Question
has answer: http://stackoverflow.com/a/25729427
answer count: 1
downvote count: 0
favorite count: 0
tagged with: postgresql
tagged with: spring
has title: How to solve bad sql grammar error with Spring JDBC?
accepted answer: http://stackoverflow.com/a/25729427

http://stackoverflow.com/comment/40312243
score: 1
type: AnswerComment
has text: @Johnny_b: Google is your friend. There are thousands of examples. Just look for try/catch string, or something similar.
type: Comment
comment on: http://stackoverflow.com/a/25776168

http://stackoverflow.com/q/25824235
has answer: http://stackoverflow.com/a/25824249
accepted answer: http://stackoverflow.com/a/25824249
upvote count: 0
type: AnsweredQuestion
has title: String Replace with Regex in Java
tagged with: java
type: Question
downvote count: 2
score: -2
answer count: 1
has body: String str1 = "S1,,?-"; String str2 = "R2'"; str1 = str1.replace("([A-Z][0-9]?)(?:\\.{1,2}|'{1,2})?", str2); Expected output: R2',,?- Actual Output: S1,,?- In the above code, I want to replace the matching pattern in str1 with str2. All other strings will be retained in str1. The str1 is a string and always starts with specific pattern having one alphabet followed by one digit followed by one or two dots or on or two quotes or none. After this str1 may contain many other characters. (Ex: S1..-,,, R2':--, G4''?, M2';; etc). So the length of sub-string to be replaced is not known and hence I used pattern matcher "([A-Z][0-9]?)(?:\\.{1,2}|'{1,2})?". I am not able to make out why I am not getting expected result.
favorite count: 0

http://stackoverflow.com/q/25843650
tagged with: jpa
has answer: http://stackoverflow.com/a/25848130
answer count: 1
downvote count: 0
has body: I am currently working on a JavaSE project that I would like to build in the most effective way. My project is an employeeManagementSystem which has several schemas. For example I have one schema called employees which contains employee data and another schema called company which contains the company data. Currently I have implemented my entities and tested these using hibernate.cfg.xml to make sure they are implemented correctly. For example, one such entity in the employee schema is @Entity @Table(name="employees", uniqueConstraints= { @UniqueConstraint(columnNames="idEmployees"), @UniqueConstraint(columnNames="idCardNumber"), @UniqueConstraint(columnNames="niNumber") }) public class Employee { @Id @GeneratedValue @Column(unique=true, nullable=false, updatable=false) private int idEmployees; @Column(unique=true, nullable=false, updatable=false) @Size(min=1, max=15) private String idCardNumber; @Column(unique=true, nullable=false, updatable=false) @Size(min=1, max=15) private String niNumber; @Column(nullable=false, updatable=false) @Size(min=1, max=20) private String name; @Column(nullable=false) @Size(min=1, max=20) private String surname; // Other class variables //Constructors //getters & setters } I an now trying to use an EntityManager to manage my schemas. My persistence.xml for the employee schema is org.hibernate.ejb.HibernatePersistence com.shopmanagementsystem.employeesdao.entities.Employee //Other classes in this schema <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> <property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver"/> <property name="javax.persistence.jdbc.user" value="root"/> <property name="javax.persistence.jdbc.password" value="root"/> <property name="javax.persistence.jdbc.url" value="jdbc:mysql://localhost:3306/employees"/> I want to create a Service and ServiceImpl class to manage the processes related to the entities. Q1) Should I have a Service and ServiceImpl for each entity? Some of …
favorite count: 0
accepted answer: http://stackoverflow.com/a/25848130
tagged with: maven
type: AnsweredQuestion
score: 1
tagged with: java
has title: Using @PersistenceContext and EntityManager for several schemas
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/25811257

http://stackoverflow.com/q/25749598
has title: REST: Handling the 400 error for GET requests
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40263760
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/40264816
type: Question
has comment: http://stackoverflow.com/comment/40264782
has answer: http://stackoverflow.com/a/25750422
tagged with: jersey
has body: I have a GET request url entities\{id}. Here RestController is expecting id in a Long format. Test case says that if user passes an invalid id, controller should return a HTTP-400 Bad Request error. For example: /entities/21.0, /entities/xx etc. But before hitting the controller itself jersey is throwing a HTTP-404 error. RestController looks like this: @GET @Path("/{id}") @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) public Response getEntityById(@PathParam("id") Long id){}
has comment: http://stackoverflow.com/comment/40264232
has comment: http://stackoverflow.com/comment/40264413
score: 0
tagged with: rest

http://stackoverflow.com/q/25818933
tagged with: menubar
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40433603
favorite count: 0
tagged with: javafx-8
has comment: http://stackoverflow.com/comment/40414509
has title: How to align MenuItem popup to the right bottom corner of the Menu
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40426761
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/50518256
tagged with: menuitem
type: Question
has comment: http://stackoverflow.com/comment/40439688
tagged with: java
has answer: http://stackoverflow.com/a/39383191
has body: Javafx standard MenuItem of the MenuBar displays like: I would like it to display such that the menuitem is aligned with the right bottom corner of the menu: I tried to modify the css properties of the MenuItem, but it only changed the text alignment of the menu, no impact on the position of the menuitem. Is there a simple way to do it with css properties?

http://stackoverflow.com/comment/40438057
comment on: http://stackoverflow.com/q/25845333
score: 0
type: QuestionComment
type: Comment
has text: createSQLQuery() makes even bigger errors.

http://stackoverflow.com/comment/40230244
type: Comment
comment on: http://stackoverflow.com/a/25731531
score: 0
type: AnswerComment
has text: That completely *made up* language resembles me to Ruby.

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/25733029
type: Tag
tags question: http://stackoverflow.com/q/25713404

http://stackoverflow.com/a/25769007
answers question: http://stackoverflow.com/q/25768529
score: 0
type: Answer
has body: Silly example: public class PassClassExample { public static class ClassValidator { private Class theClass; public ClassValidator(Class theClass) { this.theClass = theClass; } public boolean instanceOf(Class someClass) { return theClass == someClass; } } public static void main (String [] args ) { ClassValidator personValidator = new ClassValidator(Person.class); Person you = new Person(); Animal me = new Animal(); System.out.println(personValidator.instanceOf(you.getClass())); System.out.println(personValidator.instanceOf(me.getClass())); } public static class Person { } public static class Animal { } } Will print out true false Indicating you are a person and I am an animal :)

http://stackoverflow.com/comment/40357232
comment on: http://stackoverflow.com/q/25800918
has text: @yshavit as you have mentioned in your second comment, this is the exact wordings of the book.Please give an example to show where we actually stuck if use comparable and how comparator solve our problem.
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25807872
tagged with: spring-mvc
type: AnsweredQuestion
has body: I am trying to convert a static xml into a POJO (unmarshalling) in my controller class. I am using Jaxb2Marshaller and I am configuring in the following way in my root context &lt;oxm:jaxb2-marshaller id="marshaller"&gt; &lt;oxm:class-to-be-bound name="org.springframework.ws.samples.airline.schema.Airport"/&gt; &lt;/oxm:jaxb2-marshaller&gt; I am trying to inject the marshaller using autowiring. But it throws No Bean Found Exception. @AutoWired private Unmarshaller marshaller; How to inject the marshaller in the controller. Any other ways or pointing out the error in my code will be helpful?
tagged with: java
has comment: http://stackoverflow.com/comment/40393790
linked to: http://stackoverflow.com/q/16458754
type: Question
possible better answer: http://stackoverflow.com/a/27101023
answer count: 2
has comment: http://stackoverflow.com/comment/40393786
downvote count: 0
has title: Injecting Jaxb2Marshaller in Spring MVC controller
has comment: http://stackoverflow.com/comment/40369314
has answer: http://stackoverflow.com/a/25809708
accepted answer: http://stackoverflow.com/a/25809708
has comment: http://stackoverflow.com/comment/40369768
score: 4
tagged with: jaxb2
has comment: http://stackoverflow.com/comment/40394231
favorite count: 0
has answer: http://stackoverflow.com/a/27101023
tagged with: spring
upvote count: 4

http://stackoverflow.com/q/25863600
type: UnansweredQuestion
score: -3
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25863696
has body: I need to tablevalues.. into the map.. My code is bellow: public HashMap getValuesFromDeleteAction(String tableName,Object[] filterColumn,Object[] filterValue){ Connection conn = null; ResultSet rs = null; PreparedStatement ps = null; HashMap map = new HashMap(); try{ System.out.println("====DELETE_ACTION==="); conn=this.getConnection(); if(conn!=null &amp;&amp; !conn.isClosed()){ if(filterColumn!=null &amp;&amp; filterValue!=null &amp;&amp; !tableName.trim().isEmpty() &amp;&amp;filterColumn.length==filterValue.length){ String sql = "SELECT * FROM "+tableName+""; String filterSql = " WHERE " ; for(int i=0;i&lt;filterColumn.length;i++){ if(i==0){ filterSql = filterColumn[i]+"="+"'"+filterValue[i]+"'"; }else{ filterSql= filterSql+" AND "+filterColumn[i]+"="+"'"+filterValue[i]+"'"; } } String sSql=sql+filterSql; ps = conn.prepareStatement(sSql); rs=ps.executeQuery(); while(rs.next()) { map.put(tableName +"LAST_UPDATE_DATE", rs.getString("LAST_UPDATE_DATE")); map.put(tableName +"LAST_UPDATE_BY" , rs.getString("LAST_UPDATE_BY")); } }else{ //do nothing } System.out.println("MapValues==2323===&gt;"+map); } }catch(Exception e){ } return map; }
type: Question
has title: Get tableName values to be put into hashmap
has comment: http://stackoverflow.com/comment/40471124
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25803561
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: how to destroy a singleton object when i can't find any api about it
has comment: http://stackoverflow.com/comment/40428164
has comment: http://stackoverflow.com/comment/40361905
tagged with: java
has comment: http://stackoverflow.com/comment/40362504
downvote count: 1
type: Question
has body: When I use Gephi-tookkit to draw the graph in java. But i find the problem of memory leak.I use the MemoryAnalyzer to analy the dump,it show the ProjectController make the this problem. This class ProjectController is singleton in gephi. ProjectController pc = Lookup.getDefault().lookup(ProjectController.class); I want to destroy this class ,how can I do?
has comment: http://stackoverflow.com/comment/40362046
has answer: http://stackoverflow.com/a/25861500
tagged with: gephi
answer count: 1
score: 1
has comment: http://stackoverflow.com/comment/40428125

http://stackoverflow.com/comment/40251267
comment on: http://stackoverflow.com/a/25740860
score: 0
has text: "${cato.catogories_name}"
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40290585
score: 1
comment on: http://stackoverflow.com/q/25764851
has text: The interface `MyEnum` doesn't have a method named `values()`.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25794258
has comment: http://stackoverflow.com/comment/40346637
tagged with: testing
tagged with: jersey
has answer: http://stackoverflow.com/a/26898187
tagged with: junit
downvote count: 0
answer count: 1
has body: I think I have all necessary jars. I am getting error: com.sun.jersey.test.framework.spi.container.TestContainerException: The default test container factory, null, could not be instantiated at com.sun.jersey.test.framework.JerseyTest.getDefaultTestContainerFactory(JerseyTest.java:408) at com.sun.jersey.test.framework.JerseyTest.getTestContainerFactory(JerseyTest.java:273) at com.sun.jersey.test.framework.JerseyTest.&lt;init&gt;(JerseyTest.java:165) at SimpleTest.&lt;init&gt;(SimpleTest.java:18) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:187) at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:236) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:233) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.j…
score: 1
favorite count: 0
linked to: http://stackoverflow.com/q/25138354
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/65725415
has title: The default test container factory, null, could not be instantiated
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/40317491
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25745778
has text: yes, I'm looking at http://docs.oracle.com/javaee/7/tutorial/doc/ejb-intro004.htm but not sure what JAR's I need on the classpath.

glassfish
tags question: http://stackoverflow.com/q/25836010
tags question: http://stackoverflow.com/q/25870583
tags question: http://stackoverflow.com/q/25809019
tags question: http://stackoverflow.com/q/25840940
tags question: http://stackoverflow.com/q/25821480
tags question: http://stackoverflow.com/q/25825990
tags question: http://stackoverflow.com/q/25799671
tags question: http://stackoverflow.com/q/25825075
tags question: http://stackoverflow.com/q/25740832
tags question: http://stackoverflow.com/q/25728007
tags question: http://stackoverflow.com/q/25831689
tags question: http://stackoverflow.com/q/25759949
tags question: http://stackoverflow.com/q/25857376
tags question: http://stackoverflow.com/q/25819063
tags question: http://stackoverflow.com/q/25828542
tag name: glassfish
tags question: http://stackoverflow.com/q/25871027
tags question: http://stackoverflow.com/q/25741585
type: Tag

http://stackoverflow.com/comment/40292316
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25765594
type: Comment
has text: In the top method, change the counter from `++i` to `i++` and it'll print the index.

http://stackoverflow.com/comment/40199137
comment on: http://stackoverflow.com/a/25715271
score: 0
type: Comment
has text: That doesn't make much sense, but sure: if you start from the assumption that it will be the same value for every instance then you might as well indicate that by making it `static`.
type: AnswerComment

http://stackoverflow.com/comment/40219777
type: AnswerComment
has text: i am new to the java can you explain by a giving a example
comment on: http://stackoverflow.com/a/25726053
type: Comment
score: 0

http://stackoverflow.com/comment/40343188
comment on: http://stackoverflow.com/q/25793575
score: 0
type: Comment
type: QuestionComment
has text: Can you provide an example method signature?

http://stackoverflow.com/q/25849719
tagged with: debugging
has comment: http://stackoverflow.com/comment/40446175
answer count: 1
has comment: http://stackoverflow.com/comment/40446138
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/25850080
upvote count: 1
has body: I have a situation where I need to change(remove will also work) value corresponding to a key in a Map. There are so many pairs in map. I don't want to copy all and create new map in change value for Map. Is there any way I can directly change/remove value corresponding to a key. I have tried changing complete map like : Map m = commandParameters; m.put("AID",""); return m; But commandParameters is not resolved. I tried changing that particular entry using random expressions, but could not work out. Is there any way to do so? **EDIT : ** commandParameters is original map.
downvote count: 1
accepted answer: http://stackoverflow.com/a/25850080
type: AnsweredQuestion
has title: JAVA - eclipse debug remove/change a key in map
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/40278463
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/25757918
has text: Please don't cry in the title.
type: Comment

http://stackoverflow.com/a/43642070
has comment: http://stackoverflow.com/comment/74333411
downvote count: 0
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/74333221
type: Answer
has body: Like this: CipherInputStream cis = new CipherInputStream(socket.getInputStream, inCipher); ObjectInputStream ois = new ObjectInputStream(cis);
answers question: http://stackoverflow.com/q/25836932

http://stackoverflow.com/q/25714082
downvote count: 0
has answer: http://stackoverflow.com/a/25714196
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/25746941
upvote count: 2
answer count: 2
tagged with: java
has answer: http://stackoverflow.com/a/25746941
has title: Math.pow(10,6) = 999999.999999 on Doogee DG800 Android phone
has comment: http://stackoverflow.com/comment/40196846
tagged with: double-precision
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25714196
has body: I know that Math.pow(10,6) performs the computation using doubles which means the precision is not absolute. The current release of Google Authenticator uses following code to compute codes: int codeLength = 6; .... int code = truncatedHash % (int) Math.pow(10, codeLength); Unfortunately at least two Android phones (see google-authenticator issue 396) compute 999999.9999999, which results in incorrect (not working) authentication codes. The fix is known and it uses a table of integer dividers as the count is limited to 10 possible values (see the fix referenced from the issue). And here is the question: Is it the application programmer's fault or the library programmer's fault? Should the application programmer expect the correct result (1000000) or must the limited precision be taken into account?

http://stackoverflow.com/comment/40320820
score: 0
type: Comment
has text: Hi @AbimaranKugathasan, do you have sample code? Thank you!
type: QuestionComment
comment on: http://stackoverflow.com/q/25781168

http://stackoverflow.com/q/25791029
answer count: 0
type: UnansweredQuestion
tagged with: facebook
has comment: http://stackoverflow.com/comment/40339610
has comment: http://stackoverflow.com/comment/40339341
tagged with: java
has comment: http://stackoverflow.com/comment/40339382
has comment: http://stackoverflow.com/comment/40339272
type: Question
has comment: http://stackoverflow.com/comment/40339489
has title: Does facebook require authentication for a trusted app?
tagged with: facebook-apps
has comment: http://stackoverflow.com/comment/40338713
has body: Once a user has trusted a facebook app, I'd like our backend java application to be able to post to facebook without ever requiring authentication in facebook again. Is this possible? If it helps to give a scenario: User visits foo.com/trustFooApp, this then navigates to and from facebook to do the authentication. When returning from a successful authentication, the users identity (facebook username?) and date of birth are stored in a database table PreviouslyAuthenticatedUsers A Java backend system is running and at midnight each day it queries the PreviouslyAuthenicatedUsers table to see if it is anyone's birthday today. If any are found with a birthday today it posts on their wall to say 'Happy Birthday!' without requiring authentication again.
score: 0
has comment: http://stackoverflow.com/comment/40339535
has comment: http://stackoverflow.com/comment/40338518
tagged with: facebook-authentication
tagged with: oauth

http://stackoverflow.com/comment/40386474
score: 0
has text: @guest This works for main="aaab" and sub="aab"
type: Comment
comment on: http://stackoverflow.com/q/25816429
type: QuestionComment

http://stackoverflow.com/q/25873446
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40490557
has title: Spring MVC - Session differences
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
tagged with: httpsession
tagged with: session
has answer: http://stackoverflow.com/a/25874276
has body: Are there any differences between getting session through HttpServletRequest.getSession() and HttpSession injected in controller's method?
tagged with: servlets
accepted answer: http://stackoverflow.com/a/25874276

http://stackoverflow.com/a/25861562
has comment: http://stackoverflow.com/comment/40468037
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25861498
has body: you can have Pojo which looks something like this class Value{ @JsonProperty("Values") List&lt;DateValuePair&gt; values; } class DateValuePair{ @JsonProperty("Date") String date; @JsonProperty("Value") String value; } and getters/setteres as well we have jackson libraries which will help you to de-serialize the json string to above POJO object Just a pointer you need to take it forward Hope this helps!
type: Answer
has comment: http://stackoverflow.com/comment/40468002
upvote count: 1
has comment: http://stackoverflow.com/comment/40467963

http://stackoverflow.com/q/25871048
has comment: http://stackoverflow.com/comment/40485447
has comment: http://stackoverflow.com/comment/40488040
type: Question
tagged with: out-of-memory
has body: I just implemented Pentaho in my company and set its memory with 12GB. When we try to load a 16 million rows from one table to another, it goes out of memory. I thought Pentaho would clear the memory when performing the commit on the database, but seemingly it doesn't happen. This exception is thrown when it loads around row 2.5 million, which means to load 16 million I'd need a 73Gb RAM machine? (a rough math, of course) Is there any parameter or configuration to make the magic happen? This memory issue is limiting our loading capacity (16 million is only one of the tables ). Can't believe Pentaho will braise the memory until it bursts without clearing the cache eventually. My file D:\Pentaho\server\biserver-ee\tomcat\bin\service.bat has the following line: "%EXECUTABLE%" //US//%SERVICE_NAME% ++JvmOptions "-Djava.io.tmpdir=%CATALINA_BASE%\temp; -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager; -Djava.util.logging.config.file=%CATALINA_BASE%\conf\logging.properties; -XX:MaxPermSize=256m" --JvmMs 2048 --JvmMx 12288 Does it have anything to do with the line below? -XX:MaxPermSize=256m Could someone explain me what exactly it is? Thanks in advance! PS: This is my first contact with Pentaho, so, I am sorry for any unnecessary question or assumption.
upvote count: 6
has comment: http://stackoverflow.com/comment/40485745
has title: Pentaho OutOfMemory Exception with a 12GB Ram Machine
has answer: http://stackoverflow.com/a/25871412
tagged with: java
answer count: 2
linked to: http://stackoverflow.com/q/542979
has comment: http://stackoverflow.com/comment/40485762
has comment: http://stackoverflow.com/comment/40484646
has comment: http://stackoverflow.com/comment/40720011
linked to: http://stackoverflow.com/q/5839359
has comment: http://stackoverflow.com/comment/40485195
has comment: http://stackoverflow.com/comment/40489599
tagged with: pentaho
has comment: http://stackoverflow.com/comment/40485353
has comment: http://stackoverflow.com/comment/40485087
has comment: http://stackoverflow.com/comment/40485122
score: 6
linked to: http://stackoverflow.com/q/318942
has comment: http://stackoverflow.com/comment/40484916
has comment: http://stackoverflow.com/comment/40485245
has comment: http://stackoverflow.com/comment/40522654
accepted answer: http://stackoverflow.com/a/25871412
has comment: http://stackoverflow.com/comment/40484701
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/35173259
favorite count: 0
has answer: http://stackoverflow.com/a/35173259

http://stackoverflow.com/comment/40396505
type: Comment
has text: Yes, AbstractAnnotationConfigDispatcherServletInitializer implements WebApplicationInitializer.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25822418

http://stackoverflow.com/q/25735394
type: AnsweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/40237337
has body: So I have been trying to disable/enable a jPanel within a jTabbedPane (on Netbeans) using a simple boolean and the boolean always gets stuck on false. The disabling/enabling of the jPanel within the jTabbedPane is triggered by the click of a button. Here is an excerpt of my code: package programming.club; /** * * @author RandomGuy */ public class GranadaProgrammingClubUI extends javax.swing.JFrame { public static boolean allowNavigation = true; /** * Creates new form ProgrammingClubUI */ public ProgrammingClubUI() { initComponents(); } private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: if (allowNavigation == false) { jTabbedPane1.setEnabledAt(0, true); allowNavigation = true; } if (allowNavigation == true) { jTabbedPane1.setEnabledAt(0, false); allowNavigation = false; } System.out.println(allowNavigation); } I put the System.out.println(allowNavigation); just to check what the value of allowNavigation was, and every time I click the button, the value just stays as false, but it should be switching, and changing the status of the jPanel, enabled or disabled! (I think) I really can't figure out what's wrong here. Thank you for your time.
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40237316
has comment: http://stackoverflow.com/comment/40237595
type: Question
has comment: http://stackoverflow.com/comment/40237334
has comment: http://stackoverflow.com/comment/40237339
has comment: http://stackoverflow.com/comment/40237387
has title: Simple Disabling of JPanels in JTabbedPane
tagged with: boolean-logic
has comment: http://stackoverflow.com/comment/40237441
upvote count: 2
has comment: http://stackoverflow.com/comment/40237270
tagged with: boolean
has comment: http://stackoverflow.com/comment/40237395
has comment: http://stackoverflow.com/comment/40237243
has answer: http://stackoverflow.com/a/25735475
answer count: 1
accepted answer: http://stackoverflow.com/a/25735475
has comment: http://stackoverflow.com/comment/40237447
favorite count: 0
has comment: http://stackoverflow.com/comment/40237466
tagged with: swing

http://stackoverflow.com/q/25754136
has comment: http://stackoverflow.com/comment/40350785
type: AnsweredQuestion
tagged with: box2d
has title: rotation origin of composed texture regions?
type: Question
has comment: http://stackoverflow.com/comment/40350826
tagged with: libgdx
tagged with: java
has answer: http://stackoverflow.com/a/25814032
score: 0
answer count: 1
has body: I am looking for a mathematical solution for the "tank" problem: I have a tank that is composed of the tank body and the cannon: tank: 5.795 meters width (87 px @ 720p-Resolution = 15 px/mtr) 3.8 meters height (57 px @ 720p-Resolution = 15 px/mtr) cannon: 6.8 meters width (102 px @ 720p-Resolution = 15 px/mtr) 2.063 meters height (31 px @ 720p-Resolution = 15 px/mtr)...(box2d fixture is only 0.4f height) Each is a separate object with a box2d body. The tank has a rotation and the cannon has a separate rotation, too. Both box2d bodies are bound together with a joint: RevoluteJointDef jointDef = new RevoluteJointDef(); jointDef.bodyA = getBody(); // the tank-body jointDef.bodyB = cannon.getBody(); jointDef.localAnchorB.x = -getWidth() / 3.9f; // not sure what i am doing here !? joint = (RevoluteJoint) map.box2dworld.createJoint(jointDef); I am drawing two texture regions with their rotation on top of each other for the tank body and the tank cannon. But the origin of the cannon is NOT the center of that texture region. Let's say that the origin of the tank is the center of the tank body texture region. And the rotation origin of the tank cannon should be exactly at the origin of the tank body. But this origin of the cannon is shifted to one side (see screenshot) RENDERING batch.draw(tankTextureRegion, tank.getPosition().x - tank.getWidth() * 0.5f, tank.getPosition().y - tank.getHeight() * 0.5f, tank.getWidth() * 0.5f, tank.getHeight() * 0.5f, tank.getWidth(), tank.getHeight(), 1, 1, tank.getAngleInDegress()); batch.draw(cannonTextureRegion, tank.getPosition().x - tank.getWidth() * 0.5f + 1f, // +1f is sort of a tweaking / Workaround tank.getPosition().y - tank.getHeight() * 0.5f + 1f, // +1f is sort of a tweaking / Workaround 2.0f, 1.0f, 6.8f, 2.063f, 1, 1, // 2.0f, 1.0f .... not quite sure here! tank.cannon.getOwnAngle() * MathUtils.radiansToDegrees); => the problem is, that the cannon is still shifting a bit around when i rotate cannon or tank. so i guess there are …
has comment: http://stackoverflow.com/comment/40350765
accepted answer: http://stackoverflow.com/a/25814032

http://stackoverflow.com/q/25773239
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has title: java to android error in eclipse
has body: I have a function in java and I want to use it in eclipse in a android project: public String submitForm() { DefaultHttpClient httpclient = new DefaultHttpClient(); httpclient.setRedirectStrategy(new LaxRedirectStrategy()); CookieStore cookieStore = new BasicCookieStore(); HttpContext localContext = new BasicHttpContext(); localContext.setAttribute(ClientContext.COOKIE_STORE, cookieStore); httpclient.getParams().setParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS, true); try { for (BasketItem item: getModel().getItems()) { IOUtil.getConentAsString("BZIRAN_PATH" + "/add2card.php?vendors=" + "item.getDetail().getVendors()" + "&amp;id=" + "item.getDetail().getId()", httpclient, localContext); } } catch (ClientProtocolException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); return null; } but eclise get me an error in line 3,4: httpclient.setRedirectStrategy(new LaxRedirectStrategy()); CookieStore cookieStore = new BasicCookieStore(); can anyone help me to fix them: line3 error: LaxRedirectStrategy cannot be resolved to a type line4 error: Type mismatch: cannot convert from BasicCookieStore to CookieStore here is import: import java.io.IOException; import java.net.CookieStore; import java.util.HashMap; import org.apache.commons.io.IOUtils; import java.lang.Object; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.params.ClientPNames; import org.apache.http.client.protocol.ClientContext; import org.apache.http.impl.client.BasicCookieStore; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem;
accepted answer: http://stackoverflow.com/a/25773344
score: 0
has comment: http://stackoverflow.com/comment/40306965
tagged with: android
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40306230
upvote count: 1
has answer: http://stackoverflow.com/a/25773344
type: AnsweredQuestion

http://stackoverflow.com/q/25746893
tagged with: distributed-transactions
favorite count: 0
has title: How to implement web service transactions?
type: Question
score: 5
has comment: http://stackoverflow.com/comment/40258195
has answer: http://stackoverflow.com/a/25748938
tagged with: java
has body: Is there a Java tool for choreographing web services that makes it easy to deal with transactions? In my use case I want to chain 2 SOAP web services: the first will perform a debit into a client's bank account and the second will recharge his cell phone for the corresponding amount. How can I implement this sequence of web services calls transactionally? I briefly looked at Apache Camel but it doesn't seem to be the most adequate tool. Thanks.
answer count: 1
accepted answer: http://stackoverflow.com/a/25748938
upvote count: 5
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40261327
has comment: http://stackoverflow.com/comment/40260929
downvote count: 0

http://stackoverflow.com/comment/40234925
type: QuestionComment
has text: They absolutely do. Declare a `App` bean (and enable component scanning) in your context and retrieve it from the `ApplicationContext`, rather than instantiating it yourself.
comment on: http://stackoverflow.com/q/25733587
score: 0
type: Comment

http://stackoverflow.com/comment/40229556
has text: `float` gives you about 6 decimal digits of precision. So if you want a value with 4 digits to the left of the decimal point, you can only have 2 to the right and expect answers that show up correctly. If you want 4 to the left and 4 to the right, that's 8. So you can't use `float`.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25728804

jface
tags question: http://stackoverflow.com/q/25742573
tags question: http://stackoverflow.com/q/25727187
tag name: jface
tags question: http://stackoverflow.com/q/25845009
type: Tag
tags question: http://stackoverflow.com/q/25787499
tags question: http://stackoverflow.com/q/25720039
tags question: http://stackoverflow.com/q/25718599

http://stackoverflow.com/a/25784759
answers question: http://stackoverflow.com/q/25782118
has body: To visualize how to proceed with this issue, I've coded a little example: When you start it, two rectangles will be created. They start moving, when you click with the left mouse button on the drawing area. Motion will stopped, when the destination line is arrived. The logic depends on a status in the Rectangle class. When the timer event handler runs, every rectangle's status is checked and the timer is stopped, if all rectangles reached have the isStopped status: public void mousePressed(MouseEvent e) { if (e.getButton() == MouseEvent.BUTTON1) { timer = new Timer(100, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { /** * Variable isStopped is used to track, if any * rectangle didn't reach the destination yet */ boolean isStopped = true; for(int i = 0; i &lt; count; i++){ rectangles[i].moveUp(destination); if (!rectangles[i].isStopped()) { isStopped = false; } } drawPanel.repaint(); /** * With all rectangles having arrived at destination, * the timer can be stopped */ if (isStopped) { timer.stop(); } } }); timer.start(); } } Excerpt from the Rectangle class - here you see, how the isStopped status is handled - internally as private isStop variable - retrievable with the isStopped getter. /** * Moves the rectangle up until destination is reached * speed is the amount of a single movement. */ public void moveUp(int destination) { if (speed &lt; 5) { speed++; } y -= speed; if (y &lt; destination) { y = destination; isStop = true; } } public boolean isStopped() { return isStop; } Here is the whole Program: Main Program MovingRectangle, creating the drawing area and providing control: package question; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextArea; import javax…
score: 0
type: Answer

http://stackoverflow.com/q/25774794
tagged with: java
has comment: http://stackoverflow.com/comment/40310504
has body: I am plotting a large number of connected edges on a canvas, all of which are arranged in a way that some specific extension to these edges always gives an intersection point with another extended edge. This point is needed for further calculations - it is not relevant in the context of what appears on the canvas. My code works great for the general case, but if the edge's respective extensions go far out, the intersections do not always exist (however, the lines are not parallel) - at least not within the scope of this program. Does anyone have any ideas to improve the precision of this code? I am actually working with BigDecimals later, but for the plotting steps I initially thought it would suffice to use double. This one extends the edge to both sides: public Line2D.Double ExteLine(Point2D p, Point2D q){ double slope, y3, y4; slope = (q.getY() - p.getY())/(q.getX() - p.getX()); y3 = (slope * (100000 - p.getX())) + p.getY(); y4 = (slope * (-100000 - p.getX())) + p.getY(); Point2D out1 = new Point2D.Double(100000, y3); Point2D out2 = new Point2D.Double(-100000, y4); Line2D.Double line = new Line2D.Double(out1, out2); return line; } This one finds the intersection: public Point2D.Double getIntersectionPoint(Line2D.Double line1, Line2D.Double line2) { if (! line1.intersectsLine(line2)) { System.out.println("No intersection"); return null;} double s1 = line1.getX1(), sp2 = line1.getY1(), rx = line1.getX2()-s1, ry = line1.getY2()-sp2; double qx = line2.getX1(), qy = line2.getY1(), sx = line2.getX2()-qx, sy = line2.getY2()-qy; double det = sx*ry - sy*rx; if (det == 0) { System.out.println("Det = 0"); return null;} else { double z = (sx*(qy-sp2)+sy*(s1-qx))/det; if (z==0 || z==1) return null; return new Point2D.Double( (double)(s1+z*rx), (double)(sp2+z*ry)); } }
has comment: http://stackoverflow.com/comment/40313910
has title: Far out intersection points for lines which are almost parallel
answer count: 1
downvote count: 0
favorite count: 0
tagged with: geometry
has comment: http://stackoverflow.com/comment/40311585
has answer: http://stackoverflow.com/a/25788397
type: AnsweredQuestion
upvote count: 3
has comment: http://stackoverflow.com/comment/40313873
accepted answer: http://stackoverflow.com/a/25788397
type: Question
score: 3

http://stackoverflow.com/q/25765232
tagged with: portability
has body: In C and C++, the behavior of INT_MIN % -1 seems to be undefined / platform-dependent as per Shafik's post. In Java, does the % operator ever overflow? Consider this piece of code: public class Test { public static void main(String[] args) { // setup variables: byte b = Byte.MIN_VALUE % (-1); short s = Short.MIN_VALUE % (-1); int i = Integer.MIN_VALUE % (-1); long l = Long.MIN_VALUE % (-1); // my machine prints "0" for all: System.out.println(b); System.out.println(s); System.out.println(i); System.out.println(l); } } Is there a platform-independent guarantee that the above results are 0?
type: AnsweredQuestion
tagged with: strictfp
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/25765508
has comment: http://stackoverflow.com/comment/40291579
type: Question
score: 3
tagged with: modulo
has title: Does Java's % operator ever overflow?
linked to: http://stackoverflow.com/q/19285163
accepted answer: http://stackoverflow.com/a/25765508
downvote count: 0
answer count: 1
tagged with: operators
favorite count: 0

http://stackoverflow.com/q/25819723
has comment: http://stackoverflow.com/comment/40391708
has comment: http://stackoverflow.com/comment/40391857
answer count: 2
has comment: http://stackoverflow.com/comment/40391773
possible better answer: http://stackoverflow.com/a/25819767
has comment: http://stackoverflow.com/comment/40391822
has answer: http://stackoverflow.com/a/25819767
linked to: http://stackoverflow.com/q/1519736
accepted answer: http://stackoverflow.com/a/25819763
type: AnsweredQuestion
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40391843
has comment: http://stackoverflow.com/comment/40391753
has title: Generate Random Numbers In A Range with All Numbers Being Hit
type: Question
has comment: http://stackoverflow.com/comment/40391818
has comment: http://stackoverflow.com/comment/40391785
has body: I want to generate random integers from range 0-9 and put it in an array of size 100. That's easy but I'm clueless on how to make sure that in the array, I have at least one occurrence of every integer in the range 0-9. This is all using java by the way. This is what I've got so far (the numbers are different in my coding because I wanted to ask a simpler question): public static int[] extendTo1024(int[] key) { int[] extendedKey = new int[1024]; Random random = new Random(); for(int i = 0; i &lt; 1024; i++) { int rand = random.nextInt(64) + 1; extendedKey[i] = bitKey[rand]; } return extendedKey; } Any help? Thank you in advance!
has answer: http://stackoverflow.com/a/25819763

http://stackoverflow.com/q/25775808
tagged with: java
has body: As far as I understand I can overwrite equals() in Java to handle how my class interacts with ==. Which method do I have to overwrite to be define the behavior of MyClass obj1; MyClass obj2; if (obj1 &gt; obj2){ ... }
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/25775827
has answer: http://stackoverflow.com/a/25775827
accepted answer: http://stackoverflow.com/a/25775823
answer count: 2
linked to: http://stackoverflow.com/q/513832
downvote count: 0
has comment: http://stackoverflow.com/comment/40311567
favorite count: 0
has title: Which method do I have to overwrite in Java to use ">" to compare instances of my class
has answer: http://stackoverflow.com/a/25775823
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/40283381
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25760676
has text: I am not taking image from URL, I am selecting it from the gallery now. So I need the dir and name of the selected file.
score: 0

http://stackoverflow.com/q/25872237
tagged with: java
type: UnansweredQuestion
has body: I am getting the following error when I reboot my device (my app launches on boot, as it is defined as a launcher). This only started happening recently for some odd reason! java.lang.RuntimeException: Unable to start activity ComponentInfo{com.domain.application/com.domain.application.MainActivity}: java.lang.NullPointerException The Exception in LogCat points to: loginBtn.setOnClickListener(new View.OnClickListener() { // code here to deal with button press } loginBtn is defined near the start of the onCreate: // Set activity view setContentView(R.layout.activity_main); // Initialise button Button loginBtn = (Button)findViewById(R.id.loginButton); The activity xml: <?xml version="1.0" encoding="utf-8"?> <requestFocus /> I have searched through nearly all the instances of this error on SO, and I have double checked everything and I'm sure my code is correct. Like I said, this has only just started happening and only happens when the device boots. If I debug the app (so it re-installs and starts) it is fine, there is no error. Manifest XML: <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/> <!-- <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> --> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.HOME" /> <category android:name="android.intent.category.DEFAULT" /> <action android:name="android.intent.action.BOOT_COMPLETED" /> <category android:name="android.intent.category.DEFAULT"/> <service android:enabled="true" android:name=".PlaylistS…
has comment: http://stackoverflow.com/comment/40487481
has comment: http://stackoverflow.com/comment/40486869
answer count: 0
has comment: http://stackoverflow.com/comment/40496332
has comment: http://stackoverflow.com/comment/40487751
has title: Unable to start activity ComponentInfo caused by onClickListener
type: Question
tagged with: android
has comment: http://stackoverflow.com/comment/40487061
score: 0
has comment: http://stackoverflow.com/comment/40487132
has comment: http://stackoverflow.com/comment/40487634

http://stackoverflow.com/comment/40436150
type: AnswerComment
has text: you have to add a plugins.xml file in res/xml/ directory
comment on: http://stackoverflow.com/a/25844136
score: 0
type: Comment

http://stackoverflow.com/comment/43578062
type: AnswerComment
comment on: http://stackoverflow.com/a/27466802
score: 0
type: Comment
has text: When you have assigned "java.util.LinkedHashMap" to "type" of resultMap, declare function `public List<Map> selectEmployeeDetails();` in the Mapper.java.

http://stackoverflow.com/q/25822465
tagged with: log4j
has comment: http://stackoverflow.com/comment/40396258
score: 0
linked to: http://stackoverflow.com/q/4401251
has comment: http://stackoverflow.com/comment/40396370
has body: In my application we are using different log files. But I was unable to find the way the log messages are going to different log files. I know we can specify the packages in log4j.properties by using category. Is there any way to specify the logger to go to some specific file and to get some information about logger means the file in which the log messages are rendering.
answer count: 1
tagged with: logging
tagged with: jakarta-ee
has title: How to get logger information by using Log4j in java
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25822529
type: Question

http://stackoverflow.com/comment/86351700
has text: Worked for me ! Very nice !
comment on: http://stackoverflow.com/a/25871626
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25792111
type: AcceptedAnswer
type: Answer
score: 2
has body: thanks for the feedback First of all, remove allure-junit-plugin from your project configuration. It's solve your problem Then change version of allure-maven-plugin to 2.0. Also you can read migration guide from 1.3.* to 1.4 https://github.com/allure-framework/allure-core/wiki/Upgrading-to-1.4 PS today we release allure version 1.4.1
downvote count: 0
has comment: http://stackoverflow.com/comment/40365292
has comment: http://stackoverflow.com/comment/40360398
accepted answer of: http://stackoverflow.com/q/25786193
upvote count: 2
answers question: http://stackoverflow.com/q/25786193

http://stackoverflow.com/q/25798565
tagged with: nexus-5
has title: Writing a text file to android storage for viewing later
tagged with: storage
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: adt
has answer: http://stackoverflow.com/a/25798718
downvote count: 0
answer count: 1
has body: So I'm trying to basically write some logs to a text file so i can view it later. I'm running this on a physical phone, not the emulator. I've tried so many different variations, and the most i got was it writing to data/data and storage/emulated but i can never access my file. Any help would be appreciated. Some of my latest undeleted examples have been: String filename = "myfile.txt"; try { File path = new File(context.getFilesDir(), "myfolder"); if (!path.exists()) path.mkdir(); File output = new File(path, filename); BufferedWriter buff = new BufferedWriter(new FileWriter(output)); buff.append("hi"); Log.d("Success", "Successfully wrote a file " + context.getFilesDir()); } catch (Exception e) { e.printStackTrace(); } and final String appPath = String.format("%s/Datafiles", context.getFilesDir()); File path = new File(appPath); if (!path.exists()) { path.mkdir(); } String fileName = String.format("%s/filedemo.txt", appPath); and try { String filename = "myfile.txt"; File path = new File(Environment.getRootDirectory(), "myfolder"); if (!path.exists()) path.mkdir(); File output = new File(path, filename); BufferedWriter buff = new BufferedWriter(new FileWriter(output)); buff.append("hi"); Log.d("Success", "Successfully wrote a file " + context.getFilesDir()); } catch (Exception e) { e.printStackTrace(); } Both of the following put it under /storage/emulated/0/Android/data/com.example.simplelte/files/system/stuff/test.txt and /storage/emulated/0/Android/data/com.example.simplelte/files/storage/emulated/0/stuff/test.txt respectively try { File file = new File(context.getExternalFilesDir(Environment .getRootDirectory().getCanonicalPath()), "stuff"); if (!file.mkdirs()) { Log.e(LOG_TAG, "Directory not created"); } File output = new File(file, "test.txt"); BufferedWriter buff; buff = new BufferedWriter(new FileWriter(output)); buff.append("hi"); buff.close(); Log.d("Success", output.getCanonicalPath()); } catch (IOException e) { // TODO Auto-generated catch block e.prin…
favorite count: 0
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/a/25777272
has body: Explanation: For example, you can make a list that contains 8 numbers and after that shuffle the list in order to be randomized what you want. Code: Integer[] array = new Integer[100]; for (int i = 0; i &lt; 100; i++) { array[i] = i+1; } List&lt;Integer&gt; list = Arrays.asList(array); Collections.shuffle(list); for (int i = 0; i &lt; list.size(); i++) { System.out.print(list.get(i) + " "); } Output: 88 25 24 15 92 87 14 100 68 98 91 32 28 22 74 37 10 90 44 77 94 52 34 86 72 99 46 71 36 26 69 55 82 79 19 78 60 49 70 85 33 66 45 57 61 9 51 76 3 42 16 29 84 93 58 2 53 97 6 17 13 43 12 56 35 96 83 40 38 59 50 5 41 65 11 23 73 4 47 89 1 81 21 80 63 48 20 27 64 54 18 75 30 62 39 31 7 8 67 9
has comment: http://stackoverflow.com/comment/40314385
downvote count: 0
has comment: http://stackoverflow.com/comment/40409608
has comment: http://stackoverflow.com/comment/40334272
type: Answer
answers question: http://stackoverflow.com/q/25777223
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40344840

http://stackoverflow.com/q/25716899
has comment: http://stackoverflow.com/comment/40202468
score: 0
has comment: http://stackoverflow.com/comment/40202398
has comment: http://stackoverflow.com/comment/40202357
has answer: http://stackoverflow.com/a/25716919
type: AnsweredQuestion
has title: Parse JSON in Java 3 levels deep
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40202516
possible better answer: http://stackoverflow.com/a/25717152
accepted answer: http://stackoverflow.com/a/25716919
type: Question
has comment: http://stackoverflow.com/comment/40202499
has body: Thank you in advanced I'm trying to parse a JSON array from a Weather Underground api. The return I'm getting for the 10 day forecast is as follows: { "response": { "version": "0.1", "termsofService": "http://www.wunderground.com/weather/api/d/terms.html", "features": { "forecast10day": 1 } }, "forecast": { "txt_forecast": { "date": "8:00 AM PDT", "forecastday": [{ "period": 0, "icon": "partlycloudy", "icon_url": "http://icons-ak.wxug.com/i/c/k/partlycloudy.gif", "title": "Tuesday", "fcttext": "Overcast in the morning, then clear. High of 75F. Winds from the SSW at 5 to 20 mph.", "fcttext_metric": "Overcast in the morning, then clear. High of 24C. Windy. Winds from the SSW at 5 to 30 km/h.", "pop": "0" }, { "period": 1, "icon": "partlycloudy", "icon_url": "http://icons-ak.wxug.com/i/c/k/partlycloudy.gif", "title": "Tuesday Night", "fcttext": "Mostly cloudy. Low of 55F. Winds from the SW at 5 to 15 mph.", "fcttext_metric": "Mostly cloudy. Low of 13C. Breezy. Winds from the SW at 10 to 20 km/h.", "pop": "0" }, { "period": 2, "icon": "partlycloudy", "icon_url": "http://icons-ak.wxug.com/i/c/k/partlycloudy.gif", "title": "Wednesday", "fcttext": "Mostly cloudy in the morning, then clear. High of 72F. Winds from the SW at 10 to 15 mph.", "fcttext_metric": "Mostly cloudy in the morning, then clear. High of 22C. Breezy. Winds from the SW at 15 to 25 km/h.", "pop": "0" }, { "period": 3, "icon": "partlycloudy", "icon_url": "http://icons-ak.wxug.com/i/c/k/partlycloudy.gif", "title": "Wednesday Night", "fcttext": "Mostly cloudy. Fog overnight. Low of 55F. Winds from the SW at 10 to 15 mph.", "fcttext_metric": "Mostly cloudy. Fog overnight. Low of 13C. Breezy. Winds from the SW at 15 to 20 km/h.", "pop": "0" }, { "period": 4, "icon": "partlycloudy", "icon_url": "http://icons-ak.wxug.com/i/c/k/partlycloudy.gif", "title": "Thursday", "fcttext": "Mostly cloudy. Fog early. High of 70F. Winds from the WSW at 10 to 15 mph.", "fcttext_metric": "Mostly cloudy. Fog early. High of 21C. Wi…
has answer: http://stackoverflow.com/a/25717152
answer count: 2

http://stackoverflow.com/a/25728959
answers question: http://stackoverflow.com/q/25728753
downvote count: 1
has comment: http://stackoverflow.com/comment/40225366
upvote count: 1
has body: To optimize this more effectively, you could break your setBorders routine into 4 methods (1 for each param) and use 4 locking Objects to lock each setter method individually... But this would only be more effective if your setters were being called individually (not always as a block) and/or weren't always called in the same order, or if you could do a quick escape from the setter when you determine the value isn't actually changing
has comment: http://stackoverflow.com/comment/40224962
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40226452

http://stackoverflow.com/q/25758128
has answer: http://stackoverflow.com/a/25758740
favorite count: 0
has comment: http://stackoverflow.com/comment/40279111
has body: In my project I need to generate a lots of (thousands) of unique random numbers. So far I am using this not-so-efficient solution: public void codeFactory(int count) { for (;count &gt; 0; count --) { while (true) { long code = getRandomCode(); Long codeStored = em.select("c.code").from("codes c").where("c.code = ?", code) .fetchSingle(Long.class); if (codeStored == null) { // this code has not yet been stored break; } else { // we continue, this code is already stored continue; } ... } // we have created a unique code } } Is there a way to create them directly with MySQL so I would not need to access MySQL for each code? EDIT: I want to generate RANDOM numbers between 1000000000000 and 9999999999999.
upvote count: 1
has title: How to generate a big number of unique random numbers in MySQL
has comment: http://stackoverflow.com/comment/40279078
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/25758740
has answer: http://stackoverflow.com/a/25759372
type: Question
has comment: http://stackoverflow.com/comment/40279011
downvote count: 0
possible better answer: http://stackoverflow.com/a/25758775
has comment: http://stackoverflow.com/comment/40281737
has answer: http://stackoverflow.com/a/25758775
answer count: 3

http://stackoverflow.com/a/25871189
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25833023
upvote count: 1
score: 1
has body: you should simply pass java CL down into your groovy method: def doit( ClassLoader cl ) { cl.loadClass 'oracle.jdbc.driver.OracleDriver' .... } then call ClassLoader parent = getClass().getClassLoader(); Object[] args = { parent }; groovyObject.invokeMethod("doit", args);

http://stackoverflow.com/comment/40197106
score: 0
comment on: http://stackoverflow.com/q/25714246
type: Comment
type: QuestionComment
has text: @specializt: The file I have has a delimiter '&&'

http://stackoverflow.com/a/25766806
accepted answer of: http://stackoverflow.com/q/25751758
upvote count: 2
answers question: http://stackoverflow.com/q/25751758
score: 2
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: .component() is available via the JExpression interface. All you need to do is use it via the interface: JExpression expression = ... expression.component(JExpr.lit(1)); This works for the other common expressions in JCodeModel (JVar, JInvocation) as they all extend JExpression. I ran into a similar problem when trying to use this method and casing the expression to a JArrayCompRef.

http://stackoverflow.com/q/25804450
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/25805048
accepted answer: http://stackoverflow.com/a/25805048
has comment: http://stackoverflow.com/comment/40366361
favorite count: 0
upvote count: 2
downvote count: 2
tagged with: bitmap
has body: I know this topic has been discussed so many times and I have read so many articles on handling large bitmap but if we put that problem aside, I would like to know why does a single bitmap take so much memory. Now, I am developing an Android application with a dynamic background. The background is gradient-like image and it's supposed to go from white, over gray to black color. I have 4 background images which together make the wanted gradient. Now, if I use only one image and make the background static, everything works perfectly fine on a device with VM heap of 64 Mb. If, however, i decided to use all backgrounds, i get outofmemory error even on a device with VM heap of 128 Mb. Now, of course, I can understand why that happens if i load all 4 images but I edited my code so that only 2 images are loaded in the memory at one moment ( if one background image is no longer on the screen, it is recycled) and that works, but barely. If i add just a single other image, which has negligible dimensions compared to the background image, it get the same error. Another problem in all of this is that I have to scale my bitmaps after loading them. I scale them to the size of the screen. I know scaling takes up a lot of memory too, but if i do the calculations, a bitmap of dimensions 1280x720 stored as ARGB888 should use no more than 4 MB of memory. Setting largeHeap to true won't do any help either, as some devices have heap as low as 16 MB .. Even caching bitmaps to storage won't help because at a single moment i need more bitmaps than some devices could handle.. Also, loading sampled image won't do any help since images aren't very large (1000x1000 for xxhdpi density) Code for BitmapDrawing: private void DrawBackground(Canvas canvas) { //temp and bgs[1] are loaded at start up, as they are required right away if (bg_num &gt; 3) { canvas.drawBitmap(bgs[3], 0, 0, null); if (!bgs[0].isRecycled()) bgs[0].recycle(); return; } if (bgs[0] == null) { bgs[0] = Bitmap.createScaledBitmap(…
has title: Single bitmap taking enormous amounts of memory
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40363876
answer count: 1

http://stackoverflow.com/a/37345455
answers question: http://stackoverflow.com/q/25872702
score: 0
type: Answer
has body: You have mixed m and M. mstands for minute and M for month. Below is an example of a working format. SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy"); String dateInString = "07/06/2013"; Date date = formatter.parse(dateInString); System.out.println(formatter.format(date));

http://stackoverflow.com/comment/40207334
type: AnswerComment
comment on: http://stackoverflow.com/a/25717796
score: 0
type: Comment
has text: i checked i have all jar in lib

http://stackoverflow.com/q/25791406
tagged with: java
possible better answer: http://stackoverflow.com/a/25791757
has body: I'm writing a rather simple Java program that prompts the user for 2 Strings, following which the first string is formatted according to the second one and outputted accordingly. This processing proceeds by deleting every character in the first string that corresponds with each character in the second string and outputting the first string after the intended changes. This might be looking baffling and incomprehensible. For example: suppose we've got the following 2 strings as input: lennon Ln Output: eo After removing every occurrence of the characters 'L' &amp; 'n' from the first String (without regard to case) This is the pertinent program : BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); System.out.format("Enter 2 Strings, schmuck:%n"); String s1 = br.readLine(); String s2 = br.readLine(); List&lt;Character&gt; l = new ArrayList&lt;&gt;(); for(int i = 0; i &lt; s1.length(); i++) { l.add(s1.charAt(i)); } char ch; for(int i = 0; i &lt; s2.length(); i++) { ch=s2.charAt(i); while((l.indexOf(ch)) != -1) { if(Character.isUpperCase(ch)) l.remove(ch); l.remove(Character.toLowerCase(ch)); } } for(Character c : l) { System.out.printf("%c", c); } It's throwing an IndexOutOfBoundsException. I find it eerie and perplexing and feel I've reached an impasse. Maybe it's a silly error. Any sort of help would be ecstatically appreciated.
score: 0
answer count: 3
tagged with: string
tagged with: exception
has comment: http://stackoverflow.com/comment/40339344
has title: Unexpected perplexing error thrown
type: AnsweredQuestion
tagged with: list
has comment: http://stackoverflow.com/comment/40339779
has answer: http://stackoverflow.com/a/25791757
has comment: http://stackoverflow.com/comment/40339578
type: Question
has answer: http://stackoverflow.com/a/25791592
accepted answer: http://stackoverflow.com/a/25791592
has answer: http://stackoverflow.com/a/25792052

http://stackoverflow.com/q/25832528
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25832613
score: 0
tagged with: java
has body: I want to get the week of the month for a specified date. For example for today(Sunday Sep 14 2014), the result should be 2. For tomorrow(Monday Sep 15 2014), result should be 3. So i do this : Calendar cal = Calendar.getInstance(); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.setTime(myDate); // myDate is a Date object with the specified date cal.get(Calendar.WEEK_OF_MONTH); But this gives me the result 3 for today and tomorrow. What am i doing wrong?
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25832599
has answer: http://stackoverflow.com/a/25832599
has comment: http://stackoverflow.com/comment/40414629
has answer: http://stackoverflow.com/a/25832613
has title: Calendar.setFirstDayOfWeek does not work

http://stackoverflow.com/a/25816159
score: 1
has comment: http://stackoverflow.com/comment/40397882
has comment: http://stackoverflow.com/comment/40385240
accepted answer of: http://stackoverflow.com/q/25815908
has comment: http://stackoverflow.com/comment/40385074
answers question: http://stackoverflow.com/q/25815908
has comment: http://stackoverflow.com/comment/40385608
upvote count: 1
type: AcceptedAnswer
type: Answer
has body: You don't really say where the data comes from. If the data is static, then a static class is a fine solution. For example, I could envision a static class to represent the 50 US states. In contrast, for a class that represents a list of authorized users, I would use a singleton pattern. Although there is only 1 list, that list could change while the app is running.
downvote count: 0

http://stackoverflow.com/a/71219752
answers question: http://stackoverflow.com/q/25851374
score: 0
type: Answer
has body: You need to basically access the ejb from a web client You need to add the following code to web.xml BASIC ManagementRealm You need to add the following code to standalone.xml <module-option name="password-stacking" value="useFirstPass"/> <module-option name="usersProperties" value="${jboss.server.config.dir}/application-users.properties"/> <module-option name="rolesProperties" value="${jboss.server.config.dir}/application-roles.properties"/> <module-option name="realm" value="ApplicationRealm"/> <module-option name="password-stacking" value="useFirstPass"/> <module-option name="password-stacking" value="useFirstPass"/> You can easily create an ejb bean and an ejb interface in an EJBproject Then you can access this ejb from a web project using a servlet My servlet looks as follows: @WebServlet("/JbossServlet") public class JbossServlet extends HttpServlet { private static final long serialVersionUID = 1L; @EJB Calculator1 calculator1; public JbossServlet() {} protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { System.out.println("1 + 1 = " + calculator1.add(1, 1)); System.out.println("1 - 1 = " + calculator1.subtract(1, 1)); System.out.println("4/2 = " + calculator1.divide(4, 2)); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } } Don't forget to create an application user using jboss-cli.bat before accessing it from the url My EJB3 bean looks as follows: package org.jboss.tutorial.stateless.bean; import java.security.Principal; import javax.annotation.Resource; import javax.annotation.security.PermitAll; import javax.annotation.security.RolesAllowed; import javax.ejb.Remote; import javax.ejb.SessionContext; import javax.ejb.Stateful; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import org.jboss.logging.Logger; import org.jboss.security.annotation.SecurityDomain; @St…
has comment: http://stackoverflow.com/comment/125911894

http://stackoverflow.com/q/25748095
possible better answer: http://stackoverflow.com/a/26679579
linked to: http://stackoverflow.com/q/16726745
has answer: http://stackoverflow.com/a/25955924
has answer: http://stackoverflow.com/a/26679579
tagged with: java
has answer: http://stackoverflow.com/a/26761968
has title: Android Studio appengine endpoint does not include builder
answer count: 4
has body: In my AndroidStudio project I have two modules: app, which is the android module and api which is the app-engine module. The App-Engine module api was generated by creating an Endpoints App Engine Module in AndroidStudio. I have an Endpoint class generated from an objectify annotated class called Comment. package com.example.pontuse.api; import com.googlecode.objectify.annotation.Entity; import com.googlecode.objectify.annotation.Id; /** * Created by pontuse on 2014-09-08. */ @Entity public class Comment { @Id Long id; String who; String txt; public Comment() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getWho() { return who; } public void setWho(String who) { this.who = who; } public String getTxt() { return txt; } public void setTxt(String txt) { this.txt = txt; } } Later on I generated an Endpoint called CommentEndpoint from the class by hitting Tools > Google Cloud Tools > Generate Endpoint package com.example.pontuse.api; import com.google.api.server.spi.config.Api; import com.google.api.server.spi.config.ApiMethod; import com.google.api.server.spi.config.ApiNamespace; import com.google.api.server.spi.config.Nullable; import com.google.api.server.spi.response.CollectionResponse; import com.google.api.server.spi.response.ConflictException; import com.google.api.server.spi.response.NotFoundException; import com.google.appengine.api.datastore.Cursor; import com.google.appengine.api.datastore.QueryResultIterator; import com.googlecode.objectify.cmd.Query; import static com.example.pontuse.api.OfyService.ofy; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; import javax.inject.Named; import javax.xml.ws.Endpoint; /** An endpoint class we are exposing */ @Api(name = "commentEndpoint", version = "v1", namespace = @ApiNamespace(ownerDomain = "api.pontuse.example.com", ownerName = "api.pontuse.example.com", packagePath="")) public class CommentEndpoint{ // Make sure to add this endpo…
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/28836812
accepted answer: http://stackoverflow.com/a/25955924
type: Question
tagged with: google-app-engine
tagged with: android
tagged with: android-studio
tagged with: google-cloud-endpoints
upvote count: 2

http://stackoverflow.com/a/25775685
has comment: http://stackoverflow.com/comment/40365974
upvote count: 10
type: AcceptedAnswer
downvote count: 0
has body: After the call to verifyStatic, you'll need to actually call the method you're trying to verify, as in the documentation here: PowerMockito.verifyStatic(Static.class); Static.thirdStaticMethod(Mockito.anyInt()); At that point you can use Mockito argument captors, as demonstrated (but not tested): ArgumentCaptor&lt;Properties&gt; propertiesCaptor = ArgumentCaptor.forClass(Properties.class); PowerMockito.verifyStatic(SomeStaticClass.class); SomeStaticClass.methodBeingStubbed(propertiesCaptor.capture()); Properties passedInValue = propertiesCaptor.getValue(); If you're used to @Mock annotations, or you need to capture a generic (as in List&lt;String&gt;), you may also be interested in using the @Captor annotation instead.
answers question: http://stackoverflow.com/q/25763338
has comment: http://stackoverflow.com/comment/92820411
accepted answer of: http://stackoverflow.com/q/25763338
type: Answer
has comment: http://stackoverflow.com/comment/92819923
score: 10

http://stackoverflow.com/q/25840529
upvote count: 0
answer count: 1
score: -6
favorite count: 0
has comment: http://stackoverflow.com/comment/40429633
has comment: http://stackoverflow.com/comment/40429662
has title: Why do I get a $ sign in decompiled java classes full with errors?
tagged with: anonymous
has comment: http://stackoverflow.com/comment/40429676
has body: I decompiled my lost apk and got all the resources and all java classes, but the problem is that I got all the .java files with errors and with dollar signs? I know these are anonymous java classes, but how to fix these errors? I can't find a way to do that... Please help
downvote count: 6
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25840657
has comment: http://stackoverflow.com/comment/40429627
type: Question
has comment: http://stackoverflow.com/comment/40429594
tagged with: java
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25840657

http://stackoverflow.com/comment/40452237
score: 9
type: AnswerComment
has text: @MuhammadHaryadiFutra Be careful this solution removes also symbols like `.`, `,`, `;`, etc.
comment on: http://stackoverflow.com/a/25852984
type: Comment

http://stackoverflow.com/q/25845688
type: Question
score: 0
has title: not able to get passed attributes in declarative component managed bean in Constructor in Oracle adf
has answer: http://stackoverflow.com/a/25884603
answer count: 1
has body: i have a declarative component in which the component ui is generated at run time based on the parameters passed to the tag. now i want to get the attribute values in the constructor of the component class/Managed bean. the first time i load the jspx where this declarative component is called, the component class of the DC prints that the EL: #{attrs} is null. This is an issue as without that i cannot initialize the form UI. Can anyone tell me how to access the attributes that are passed
accepted answer: http://stackoverflow.com/a/25884603
tagged with: oracle-adf
type: AnsweredQuestion
tagged with: java
tagged with: declarative

http://stackoverflow.com/comment/40250767
comment on: http://stackoverflow.com/a/25742931
type: AnswerComment
has text: @Raghu see my answer, clearly explained there, either make new field as `Id` or if you are using existing `vehicleno` as `Id`, the you will get one record only.
type: Comment
score: 0

http://stackoverflow.com/comment/40309749
has text: That's not the only... look at `if (paramInt == 1) Process localProcess ...`
comment on: http://stackoverflow.com/q/25774846
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25840471
has comment: http://stackoverflow.com/comment/40504625
has comment: http://stackoverflow.com/comment/40429834
upvote count: 1
has comment: http://stackoverflow.com/comment/40675258
answers question: http://stackoverflow.com/q/25840315
has comment: http://stackoverflow.com/comment/40429887
type: Answer
has comment: http://stackoverflow.com/comment/40673737
has comment: http://stackoverflow.com/comment/40652042
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40500642
has body: You need to add server runtime libraries.The server runtime libraries have all the JavaEE libraries. To make it work,install a Java EE server like Glassfish or Tomcat or JBoss etc. Right click on your project in eclipse->Configure BuildPath->Click on Libraries->Click on Add Library->Click on Server Runtime->Select the server which you have installed.

http://stackoverflow.com/a/25751759
answers question: http://stackoverflow.com/q/25751712
score: 1
downvote count: 0
type: Answer
has body: private final String id; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.table); Intent intent = getIntent(); id = intent.getStringExtra("id"); }
upvote count: 1

http://stackoverflow.com/comment/40210853
type: AnswerComment
has text: @Gagravarr so I just use rownum? refer to your link.
type: Comment
comment on: http://stackoverflow.com/a/25717795
score: 0

http://stackoverflow.com/comment/40477954
comment on: http://stackoverflow.com/q/25867387
has text: no that's not the case
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40454608
comment on: http://stackoverflow.com/q/25854555
type: Comment
type: QuestionComment
score: 1
has text: Why use `Arrays.asList(myDogs).stream()` instead of `Arrays.stream(myDogs)`?

http://stackoverflow.com/comment/40272423
type: Comment
comment on: http://stackoverflow.com/q/25754101
has text: `int a =0; a <= 2; a++` is going to cause an index out of bounds exception. Use `a < 2` like the other loops.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40301067
type: Comment
type: QuestionComment
has text: Why are you doing n = kbd.nextInt()? Shouldn't you do kbd.nextDouble()?
score: 0
comment on: http://stackoverflow.com/q/25770524

http://stackoverflow.com/a/25804312
score: 0
answers question: http://stackoverflow.com/q/25801440
has body: I would like to thank everyone who tried looking into this question ! Turns out there was something wrong with the Teacher.class constructor logic that caused a change in the Namespace, without reverting it to its previous state (the ID generator function). Now that I took care of it all works great !! I think it's just one of those days !! Again thanks alot and I will be leaving this code as a template incase someone needs it.
type: Answer

http://stackoverflow.com/q/25783137
has comment: http://stackoverflow.com/comment/40324735
answer count: 3
tagged with: ws-security
tagged with: wsdl
has answer: http://stackoverflow.com/a/25908589
has answer: http://stackoverflow.com/a/25807931
has body: I've been given task to create java client for a specific web service that is described by following wsdl file: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Person" targetNamespace="http://tempuri.org/"&gt; &lt;wsp:Policy wsu:Id="WSHttpBinding_IPersonService_policy"&gt; &lt;wsp:ExactlyOne&gt; &lt;wsp:All&gt; &lt;sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt; &lt;wsp:Policy&gt; &lt;sp:TransportToken&gt; &lt;wsp:Policy&gt; &lt;sp:HttpsToken RequireClientCertificate="false" /&gt; &lt;/wsp:Policy&gt; &lt;/sp:TransportToken&gt; &lt;sp:AlgorithmSuite&gt; &lt;wsp:Policy&gt; &lt;sp:Basic256 /&gt; &lt;/wsp:Policy&gt; &lt;/sp:AlgorithmSuite&gt; &lt;sp:Layout&gt; &lt;wsp:Policy&gt; &lt;sp:Strict /&gt; &lt;/wsp:Policy&gt; &lt;/sp:Layout&gt; &lt;sp:IncludeTimestamp /&gt; &lt;/wsp:Policy&gt; &lt;/sp:TransportBinding&gt; &lt;sp:EndorsingSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy"&gt; &lt;wsp:Policy&gt; &lt;sp:SecureConversationToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"&gt; &lt…
favorite count: 0
upvote count: 2
type: AnsweredQuestion
tagged with: cxf
score: 1
accepted answer: http://stackoverflow.com/a/25908589
tagged with: java
has comment: http://stackoverflow.com/comment/40360539
has comment: http://stackoverflow.com/comment/40325080
downvote count: 1
has comment: http://stackoverflow.com/comment/40324773
has comment: http://stackoverflow.com/comment/40348965
type: Question
has comment: http://stackoverflow.com/comment/40519794
possible better answer: http://stackoverflow.com/a/25846664
has title: What WS-Security settings should I apply to connect to wsdl descripted SOAP service?
tagged with: webservice-client
has answer: http://stackoverflow.com/a/25846664

http://stackoverflow.com/comment/40438621
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [How can I send http request to another servlet](http://stackoverflow.com/questions/18148932/how-can-i-send-http-request-to-another-servlet)
comment on: http://stackoverflow.com/q/25844873

http://stackoverflow.com/q/25846648
type: UnansweredQuestion
tagged with: java
tagged with: ejb-2.x
has body: I'm migrating my application from Jboss 4 to Jboss 7(jboss eap 6.1 alpha) getting the below error, while trying to search results in my project. I'm using Java 6, Struts 1.2, EJB 2.0, Jboss 6 EAP alpha. Note: The same code works fine when running in Jboss 4.0 Server Logs: ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/myproject].[strutsAction]] (http-localhost/127.0.0.1:8080-2) JBWEB000236: Servlet.service() for servlet strutsAction threw exception: java.lang.StackOverflowError at java.util.IdentityHashMap.maskNull(IdentityHashMap.java:175) [rt.jar:1.6.0_27] at java.util.IdentityHashMap.get(IdentityHashMap.java:314) [rt.jar:1.6.0_27] at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:150) [jboss-cli-client.jar:7.2.0.Alpha1-redhat-4] at org.jboss.marshalling.cloner.SerializingCloner.clone(SerializingCloner.java:134) [jboss-cli-client.jar:7.2.0.Alpha1-redhat-4] at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:274) [jboss-cli-client.jar:7.2.0.Alpha1-redhat-4] at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:276) [jboss-cli-client.jar:7.2.0.Alpha1-redhat-4] at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:276) [jboss-cli-client.jar:7.2.0.Alpha1-redhat-4] at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:276) [jboss-cli-client.jar:7.2.0.Alpha1-redhat-4] at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:276) [jboss-cli-client.jar:7.2.0.Alpha1-redhat-4] at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:276) [jboss-cli-client.jar:7.2.0.Alpha1-redhat-4] at org.jboss.marshalling.cloner.SerializingCloner.initSerializableClone(SerializingCloner.java:276) [jboss-cli-client.jar:7.2.0.Alpha1-redhat-4] at org.jboss.marshalling.cloner.SerializingCloner.initSer…
tagged with: struts-1
has answer: http://stackoverflow.com/a/25855603
type: Question
score: 2
answer count: 1
downvote count: 0
tagged with: stack-overflow
favorite count: 0
tagged with: jboss-eap-6
has title: JBWEB000236: Servlet.service() for servlet strutsAction threw exception: java.lang.StackOverflowError
linked to: http://stackoverflow.com/q/2392993
upvote count: 2

http://stackoverflow.com/comment/40258357
score: 0
comment on: http://stackoverflow.com/q/25725996
type: Comment
type: QuestionComment
has text: Can you reach the web-frontend for your application on a browser on your phone? Also are you trying to hit the local development server or a deployed application?

http://stackoverflow.com/q/25803479
favorite count: 0
tagged with: exception
has comment: http://stackoverflow.com/comment/40362876
has title: why MongoDB will not remove older documents if a capped collection reaches the maximum size?
upvote count: 3
type: UnansweredQuestion
tagged with: capped-collections
has comment: http://stackoverflow.com/comment/40364765
has body: I have a capped collection, which was created in java-code: this.collection = db.createCollection("stat", new BasicDBObject("capped", true).append("size", 200000000).append("max", 1000000)); Now in statistics for this collection we have: /* 0 */ { "ns" : "myDatabase.stat", "count" : 12212, "size" : 2146416, "avgObjSize" : 175, "storageSize" : 200003584, "numExtents" : 1, "nindexes" : 4, "lastExtentSize" : 200003584, "paddingFactor" : 1, "systemFlags" : 1, "userFlags" : 0, "totalIndexSize" : 2272928, "indexSizes" : { "_id_" : 1259104, "downloaded_1" : 335216, "submitted_1" : 318864, "retries_1" : 359744 }, "capped" : true, "max" : 1000000, "ok" : 1 } And if I try to insert document in collection with this code: BasicDBObject doc = new BasicDBObject(). append("downloaded", new Date(0)). append("sessionId", sessionId). append("group", group); collection.update(new BasicDBObject("_id", request.getUrl()), new BasicDBObject("$set", doc), true, false); I catch this error: com.mongodb.WriteConcernException: { "serverUsed" : "/127.0.0.1:27017" , "lastOp" : { "$ts" : 0 , "$inc" : 0} , "connectionId" : 16420 , "err" : "failing update: objects in a capped ns cannot grow" , "code" : 10003 , "n" : 0 , "ok" : 1.0} at com.mongodb.CommandResult.getException(CommandResult.java:77) at com.mongodb.CommandResult.throwOnError(CommandResult.java:110) at com.mongodb.DBTCPConnector._checkWriteError(DBTCPConnector.java:102) at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:142) at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:115) at com.mongodb.DBApiLayer$MyCollection.update(DBApiLayer.java:327) at com.mongodb.DBCollection.update(DBCollection.java:178) at com.mongodb.DBCollection.update(DBCollection.java:209) at com.srg.hydra.monitoring.HydraStatistics.insert(HydraStatistics.java:63) at com.srg.hydra.HydraSite.onSubmit(HydraSite.java:91) at ru.decipher.site.AbstractSite.submit(AbstractSite.java:198) at com.srg.hydra.Eip.start(Eip.java:48) at com.srg.hydra.runner.DefaultHydraRunner.…
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40364392
type: Question
tagged with: mongodb
has answer: http://stackoverflow.com/a/25807059
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/40459389
type: AnswerComment
score: 0
has text: @kunalkakkad, I see you tried it both ways, but once you started writing to response and setting headers, etc. you made it impossible to redirect. See my update to my answer.
type: Comment
comment on: http://stackoverflow.com/a/25856962

http://stackoverflow.com/comment/40387150
comment on: http://stackoverflow.com/q/25815318
type: QuestionComment
has text: @Mike'Pomax'Kamermans - Ah, but out-of-touch executives select the people who enforce the "outdated traditions". Those are definitely the rules.
type: Comment
score: 0

http://stackoverflow.com/q/25756597
favorite count: 0
tagged with: spring-bean
tagged with: spring
has answer: http://stackoverflow.com/a/25756614
type: UnansweredQuestion
tagged with: java
has title: Why is it showing Element type "bean" must be followed by either attribute specifications, ">" or "/ >".at <property name="list">
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40276305
type: Question
score: 0
answer count: 1
has body: <?xml version="1.0" encoding="UTF-8"?> " or "/>". 1 21 21 <entry key="1" value="value1" /> <entry key="2" value-ref="employee" /> 2. THis is another dependency bean class to inject id and employee dependencies. <bean id="employee" class="com.spring.collections"

http://stackoverflow.com/q/25832423
favorite count: 0
tagged with: android
downvote count: 1
upvote count: 4
has body: I have a difficulty in understanding following method. In the documentation, the method description is as follows: public abstract void onItemClick (AdapterView&lt;?&gt; parent, View view, int position, long id) Parameters: parent The AdapterView where the click happened. view The view within the AdapterView that was clicked (this will be a view provided by the adapter) position The position of the view in the adapter. id The row id of the item that was clicked. I understand last two, but couldn't understand what parent does here and why view is required? if someone have a good explanation, then please let me understand.
has title: what is parent and view in onItemClick?
accepted answer: http://stackoverflow.com/a/25832448
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/25832448
tagged with: onitemclick
tagged with: onitemclicklistener
answer count: 1

hive
tags question: http://stackoverflow.com/q/25743302
tags question: http://stackoverflow.com/q/25757394
tags question: http://stackoverflow.com/q/25770648
type: Tag
tag name: hive

http://stackoverflow.com/comment/40340599
has text: @Sash_KP...Do I need to calculate the height and width of the frame or the image..Also is it possible to adjust the image under the frame on all devices ?
type: AnswerComment
comment on: http://stackoverflow.com/a/25776762
score: 0
type: Comment

hql
tag name: hql
tags question: http://stackoverflow.com/q/25802873
tags question: http://stackoverflow.com/q/25729513
tags question: http://stackoverflow.com/q/25865323
tags question: http://stackoverflow.com/q/25812216
type: Tag
tags question: http://stackoverflow.com/q/25767422
tags question: http://stackoverflow.com/q/25869388

http://stackoverflow.com/comment/40382386
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25814671
has text: @Santiago, I was afraid of that, unless there is a hex-edit-like method to replace the class-name within the *.class itself... but then that would just make things more and more complicated instead of short and simple. THANKS!

http://stackoverflow.com/q/25821663
has answer: http://stackoverflow.com/a/25821806
type: AnsweredQuestion
score: 1
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25821806
has title: Please install android target 19 (the android newest sdk) when adding android platform in Cordova
answer count: 1
has body: When I am going to add android platform then I am getting this error please install android target 19 (the android newest sdk). make sure you have the latest android tools installed as well. Run "androir" from your command line to install update any missing sdk or tools while in C:\Program Files (x86)\Android\android-studio\sdk\tools android.bat i have checked that there is installed things are: android sdk tools 23.0.2 android sdk platform tool 20 android sdk build tools 20 android sdk build tools 19 and android 4.3 (API 18)'s SDK Platform and Samples for sdk installed.
favorite count: 0
tagged with: cordova
upvote count: 2
tagged with: android

http://stackoverflow.com/comment/40259276
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25740473
has text: I don't think it's proper as the index value is always -1 no matter the value I select in the spinner

http://stackoverflow.com/comment/40332851
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25782377
has text: Yes, I tend to do that :-) OTOH, "*blah blah blah yadda yadda yadda*" makes it hard for me to stay professional ;-)
score: 0

boggle
tag name: boggle
type: Tag
tags question: http://stackoverflow.com/q/25743753

http://stackoverflow.com/q/25814349
type: AnsweredQuestion
upvote count: 1
has body: Im trying to find my Coordinates and show it in the Map fragment with this code but my app is crashing. Im using the GoogleMap API for it which is up to date. public class gmapp extends FragmentActivity{ // Google Map private GoogleMap googleMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map); setUpIfNeeded(); } private void setUpIfNeeded() { if (googleMap == null) { googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap(); if (googleMap != null) { setUpMap(); } } } private void setUpMap() { googleMap.setMyLocationEnabled(true); LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE); Criteria criteria = new Criteria(); String provider = locationManager.getBestProvider(criteria , true); Location myLocation = locationManager.getLastKnownLocation(provider); googleMap.setMapType(GoogleMap.MAP_TYPE_HYBRID); double latitude = myLocation.getLatitude(); double longtitude = myLocation.getLongitude(); LatLng latLng = new LatLng(latitude , longtitude); googleMap.moveCamera(CameraUpdateFactory.newLatLng(latLng)); googleMap.animateCamera(CameraUpdateFactory.zoomTo(20)); googleMap.addMarker(new MarkerOptions().position(new LatLng(latitude , longtitude)).title("Im here")); } } Here's my error Message after I compile it. 09-12 20:10:01.034: E/AndroidRuntime(27507): FATAL EXCEPTION: main 09-12 20:10:01.034: E/AndroidRuntime(27507): Process: com.max.maxo, PID: 27507 09-12 20:10:01.034: E/AndroidRuntime(27507): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.max.maxo/com.max.maxo.gmapp}: java.lang.NullPointerException 09-12 20:10:01.034: E/AndroidRuntime(27507): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2394) 09-12 20:10:01.034: E/AndroidRuntime(27507): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2452) 09-12 20:10:01.034: E/AndroidRuntime(27507): at andr…
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40382355
has answer: http://stackoverflow.com/a/25814776
has comment: http://stackoverflow.com/comment/40381409
downvote count: 0
answer count: 1
has title: NULL Pointer using GoogleMaps API
favorite count: 0
linked to: http://stackoverflow.com/q/14047257
has comment: http://stackoverflow.com/comment/40381479
tagged with: android
accepted answer: http://stackoverflow.com/a/25814776

http://stackoverflow.com/q/25743233
tagged with: cas
tagged with: asp.net
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25758230
tagged with: cookies
tagged with: java
has body: We have one common Java Web application (A) which takes care of the login mechanism and it uses spring security. Later many other java web applications uses the Spring security context initialized by the common web application (A) and does not needs login again (SSO). We are planning to achieve the SSO using CAS with Spring security. The problem is we have another .Net web application which needs to use this common java web application (A) for login mechanism and SSO. 1) How can this integration be achieved ? 2) How to share the user details with the .Net application ? 3) Is sharing cookie the only way ? 4) Would there be any problems in using cookies like reliability, security, etc ?
type: Question
has title: Sharing Java HTTP session with .Net
tagged with: spring-security
score: 0
answer count: 1

http://stackoverflow.com/comment/40406990
type: QuestionComment
type: Comment
score: 0
has text: Is there any link on how to add applicationContext.xml and what it should contain? I was following this blog and it doesn't have applicationContext.xml.
comment on: http://stackoverflow.com/q/25828060

http://stackoverflow.com/q/25863377
has comment: http://stackoverflow.com/comment/40470822
accepted answer: http://stackoverflow.com/a/25863430
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40470808
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40470809
has comment: http://stackoverflow.com/comment/40470794
type: Question
has answer: http://stackoverflow.com/a/25863601
downvote count: 0
possible better answer: http://stackoverflow.com/a/25863455
has answer: http://stackoverflow.com/a/25863430
has answer: http://stackoverflow.com/a/25863455
answer count: 3
has comment: http://stackoverflow.com/comment/40470845
favorite count: 0
has title: convert string array to int
has body: I am trying to convert a array with text and numbers to an int. the array separated: separated[0] some text separated[1] 1 separated[2] some more text What I want is that the [1] ends up being a int. I tried: int logSetting = Integer.parseInt(String.valueOf(separated)); and int logSetting = Integer.parseInt(String.valueOf(separated[1])); Both made the app crash 09-16 09:57:30.865: E/AndroidRuntime(27938): FATAL EXCEPTION: main 09-16 09:57:30.865: E/AndroidRuntime(27938): Process: my.project, PID: 27938 09-16 09:57:30.865: E/AndroidRuntime(27938): java.lang.NumberFormatException: Invalid int: "[Ljava.lang.String;@42b273f0" 09-16 09:57:30.865: E/AndroidRuntime(27938): at java.lang.Integer.invalidInt(Integer.java:137) 09-16 09:57:30.865: E/AndroidRuntime(27938): at java.lang.Integer.parse(Integer.java:374) 09-16 09:57:30.865: E/AndroidRuntime(27938): at java.lang.Integer.parseInt(Integer.java:365) 09-16 09:57:30.865: E/AndroidRuntime(27938): at java.lang.Integer.parseInt(Integer.java:331) 09-16 09:57:30.865: E/AndroidRuntime(27938): at my.project.MainActivity.fileReader(MainActivity.java:928) 09-16 09:57:30.865: E/AndroidRuntime(27938): at my.project.MainActivity.logCat(MainActivity.java:944) 09-16 09:57:30.865: E/AndroidRuntime(27938): at my.project.MainActivity$1.run(MainActivity.java:854) 09-16 09:57:30.865: E/AndroidRuntime(27938): at android.os.Handler.handleCallback(Handler.java:733) 09-16 09:57:30.865: E/AndroidRuntime(27938): at android.os.Handler.dispatchMessage(Handler.java:95) 09-16 09:57:30.865: E/AndroidRuntime(27938): at android.os.Looper.loop(Looper.java:157) 09-16 09:57:30.865: E/AndroidRuntime(27938): at android.app.ActivityThread.main(ActivityThread.java:5356) 09-16 09:57:30.865: E/AndroidRuntime(27938): at java.lang.reflect.Method.invokeNative(Native Method) 09-16 09:57:30.865: E/AndroidRuntime(27938): at java.lang.reflect.Method.invoke(Method.java:515) 09-16 09:57:30.865: E/AndroidRuntime(27938): at com.android.internal.os.ZygoteInit$MethodAndArgsCa…

http://stackoverflow.com/q/25749606
has title: Finding fields in an object
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40262992
has comment: http://stackoverflow.com/comment/40263221
has body: I have an input JSON object which I convert to java vo object using gson api. This is for restful web-services. I have a requirement that the fields in the json are optional. Now how do I handle this in Java, how will I maintain the VO object if am not sure if all the incoming fields will be present or not? Say if my actual JSON is { "1":"one","2":"two","3":"three"} this for the POST operation and during a PUT if it comes with {"2":"B"} how will I maintain the VO class. Hope I made myself clear.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25750846
score: -1
type: Question
favorite count: 0
answer count: 1
downvote count: 1
upvote count: 0

http://stackoverflow.com/comment/40384486
type: AnswerComment
score: 0
type: Comment
has text: Thanks man, I feel so stupid missing something so simple haha. Thanks alot
comment on: http://stackoverflow.com/a/25815799

http://stackoverflow.com/comment/40254447
comment on: http://stackoverflow.com/a/25738673
type: AnswerComment
score: 0
type: Comment
has text: I tried ` <equals arg1="@{myattr}" arg2="xyz" /> <include name="*.bat" if="pass"/> ` however, it seems like for every `@{myattr}`, it includes `*.bat` (and if `unless` is used, it excludes all even when `@{myattr}` is indeed `xyz`!

http://stackoverflow.com/a/25808422
score: 0
accepted answer of: http://stackoverflow.com/q/25797095
type: AcceptedAnswer
type: Answer
has body: I started looking at the source to write a patch and I found com.vaadin.data.util.filter.IsNull. Solution is: sqlContainer.addContainerFilter(new IsNull("monthsLeft"));
answers question: http://stackoverflow.com/q/25797095

http://stackoverflow.com/q/25839671
has title: How to reference a websphere Resource Environment Provider in web.xml?
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: web.xml
has answer: http://stackoverflow.com/a/25845517
accepted answer: http://stackoverflow.com/a/25845517
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: websphere
upvote count: 1
has body: We have custom properties defined in websphere using a Resource Environment provider that was setup using the instructions on http://www.ibm.com/developerworks/websphere/library/techarticles/0611_totapally/0611_totapally.html In that article in section 6, it says "For a Web module, open the web.xml file (for an EJB module, open the ejb-jar.xml file ) using the deployment descriptor editor." I need to edit the web.xml by hand since the IBM development tools are unavailable to me at this time. Is there documentation somewhere that would provide the xml fragments that the GUI creates? Google has failed me on this point
answer count: 1

http://stackoverflow.com/comment/40201541
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25716262
type: AnswerComment
has text: Your broadcast will be received by a BroadcastReceiver object in the activity that holds the fragment. If your fragment is active, you can directly pass on a Bundle object. If it is not, then you can have something like a flag set so that the fragment knows that it needs to be updated the next time it starts up.

http://stackoverflow.com/a/25847098
downvote count: 0
has comment: http://stackoverflow.com/comment/40441304
accepted answer of: http://stackoverflow.com/q/25845929
has comment: http://stackoverflow.com/comment/40441144
has comment: http://stackoverflow.com/comment/40440953
answers question: http://stackoverflow.com/q/25845929
upvote count: 2
has comment: http://stackoverflow.com/comment/40441242
has comment: http://stackoverflow.com/comment/40441209
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40441148
has comment: http://stackoverflow.com/comment/40441271
type: Answer
has body: I have not benchmarked this, but (probably) the fastest simple way to read large numbers of integer and floating point values would be to use a DataInputStream and its various readXxx() methods. If the data is homogeneous, then you can probably get faster transfer using FileChannel, ByteBuffer and (say) DoubleBuffer. This method is described here: "write/read float array in java fast way". (Kudos goes to @greenapps ...) However, it would be tricky to get that to work if the data is heterogeneous; i.e. a mixture of different primitive types.
score: 2

removechild
tags question: http://stackoverflow.com/q/25814928
type: Tag
tag name: removechild

http://stackoverflow.com/comment/40242670
comment on: http://stackoverflow.com/q/25738265
score: 0
type: Comment
has text: Because it makes no sense to put a "entry" function at instance level. Also, It will be present when a class is loaded. The JVM doesn't need an instance of `Test` to call it.
type: QuestionComment

http://stackoverflow.com/q/25808094
upvote count: 1
tagged with: parent
favorite count: 0
has answer: http://stackoverflow.com/a/25808737
possible better answer: http://stackoverflow.com/a/25808737
answer count: 4
type: AnsweredQuestion
has body: I know super() is used to retrieve the instance variables from parent class, but when I saw the codes as follow: public class novel extends literature { private String title; private String writer; public novel(String title) { super("novel"); this.title = title; this.writer = "Unknow"; } public novel(String title, String writer) { super("novel"); this.title = title; this.writer = writer; } public String getInfo() { return getGenre() + "\nTitle: " + title + "\nWriter: " + writer; } public static void main(String[] args) { novel n = new novel("The devil wears prada", "Lauren Weisberger"); System.out.println(n.getInfo()); } } When I saw this: super("novel"); I get very confuse, how come the child class name can be put in the super method? And I don't know why this.writer = "unknown"; is here for what? Why don't it just set it to be writer? Sorry for throwing so many questions to you guys, but will appreciate a lot for any solutions. I'm sorry guys i still did not totally get why it used super("novel")? If we say novel here is a string, but then why we use that string which has the same name as "novel class"?
has title: I‘m get confused with super() usage
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/25808257
accepted answer: http://stackoverflow.com/a/25808257
tagged with: extend
has comment: http://stackoverflow.com/comment/40437753
type: Question
has answer: http://stackoverflow.com/a/25808273
tagged with: java
has answer: http://stackoverflow.com/a/25809272
tagged with: parent-child

http://stackoverflow.com/q/25847089
has answer: http://stackoverflow.com/a/25847327
has title: comparison of each line in two file
has body: I have a task to compare lines in two files.. values stores in files as string. I am new to Java so please forgive if there is some silly mistake :) file1 contains 1044510=&gt;40000 2478436011=&gt;10000 2478442011=&gt;3500 2498736011=&gt;3000 2498737011=&gt;550 2478443011=&gt;330 2478444011=&gt;1,550 File two contains 1044510=&gt;30,097 2478436011=&gt;9,155 2478442011=&gt;2,930 2498736011=&gt;2,472 2498737011=&gt;548 2478443011=&gt;313 2478444011=&gt;1,550 I want to take line one from first file and second file and check if value of line1 from first file is greater than second file or not. (40000&gt;30,097) or not. Dont want to take values before "=>". I have done a sample code but i am getting error while running. private static void readfiles() throws IOException { BufferedReader bfFirst = new BufferedReader(new FileReader(first_list)); BufferedReader bfSecond = new BufferedReader(new FileReader(second_list)); int index = 0; while (true) { String partOne = bfFirst.readLine(); String partTwo = bfSecond.readLine(); String firstValue=null; String secondValue=null; int firstValueInt; int secondValueInt; if (partOne == null || partTwo == null) { break; } else { System.out.println(partOne + "-----\t-----" + partTwo); firstValue=partOne.split("=&gt;")[1]; secondValue=partTwo.split("=&gt;")[1]; System.out.println("first valueee"+firstValue); System.out.println("second value"+secondValue); firstValueInt=Integer.parseInt(firstValue); secondValueInt=Integer.parseInt(secondValue); if(secondValueInt&gt;firstValueInt) { System.out.println("greater"); } else { System.out.println("lesser"); } } } } } This is the exception i get Exception in thread "main" java.lang.NumberFormatException: For input string: "30,097" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at com.bq.pricefinder.flipkart.findProductDifferenceFromFiles.readfiles(findProductDifferenceF…
type: Question
possible better answer: http://stackoverflow.com/a/25847272
score: 0
answer count: 3
tagged with: file-io
has comment: http://stackoverflow.com/comment/40440949
has answer: http://stackoverflow.com/a/25847272
accepted answer: http://stackoverflow.com/a/25847327
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25847179
tagged with: file

http://stackoverflow.com/comment/40477678
comment on: http://stackoverflow.com/a/25866942
score: 0
type: AnswerComment
type: Comment
has text: I will try and post an update with the result, thanks for the suggestions!

http://stackoverflow.com/q/25805580
tagged with: url-validation
has answer: http://stackoverflow.com/a/25887961
linked to: http://stackoverflow.com/q/25541940
has answer: http://stackoverflow.com/a/45939455
has comment: http://stackoverflow.com/comment/40645075
has answer: http://stackoverflow.com/a/25808760
has answer: http://stackoverflow.com/a/25887639
downvote count: 0
has title: How to quickly check if URL server is available
favorite count: 0
has body: I have a URL in the form http://www.mywebsite.com/util/conv?a=1&amp;from=%s&amp;to=%s And want to check if it is available. The links redirect me on a bad request page if I try to open these with a browser, however via code I can get the data that I need. Using a try-catch block on a HTTP request procedure is pretty slow, so I'm wondering how I could ping a similar address to check if its server is active. I have tried boolean reachable = InetAddress.getByName(myLink).isReachable(6000); But returns always false. I have also tried public static boolean exists(String URLName) { try { HttpURLConnection.setFollowRedirects(false); HttpURLConnection con = (HttpURLConnection) new URL(URLName).openConnection(); con.setConnectTimeout(1000); con.setReadTimeout(1000); con.setRequestMethod("HEAD"); return (con.getResponseCode() == HttpURLConnection.HTTP_OK); } catch (Exception e) { e.printStackTrace(); return false; } } That returns the correct value at the end of the process, bit is too slow if server is not available. EDIT I have understood what is the cause of slowness a) if server returns some data but interrupts the request before complete the request the timeout is ignored and stuck until returns an Exception that lead the execution to reach the catch block, this is the cause of the slowness of this method, and still I haven't found a valid solution to avoid this. b) If I start the android device and open the App without connection, the false value is returned correctly, if the app is opened with internet connection active and the device lost its internet connection happens the same thing of the case A (also if I try to terminate and restart the App... I don't know why, I suppose that something remains cached) All this seems related to the fact Java URLConnection doesn't provide no fail-safe timeout on reads. Looking at the sample at this link I have seen that uses a thread to interrupt the connection in some way but if I add simply the line new Thread(new InterruptThread…
has comment: http://stackoverflow.com/comment/40367047
tagged with: android
has answer: http://stackoverflow.com/a/25927259
upvote count: 29
has answer: http://stackoverflow.com/a/25968102
has answer: http://stackoverflow.com/a/34650241
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3584210
score: 29
tagged with: http
has answer: http://stackoverflow.com/a/25883969
type: Question
answer count: 8
has comment: http://stackoverflow.com/comment/40391999
linked to: http://stackoverflow.com/q/4779367
has comment: http://stackoverflow.com/comment/40365112
has comment: http://stackoverflow.com/comment/40404379
has comment: http://stackoverflow.com/comment/40377138
tagged with: java

http://stackoverflow.com/a/25818239
answers question: http://stackoverflow.com/q/25818211
score: 4
type: Answer
upvote count: 4
has body: The root cause is here public Add(Expression l, Expression r) { left = l; right = r; } Your child class is trying to implicitly invoke a parameterless super constructor. Your parent class does not have such a parameterless constructor. So, instead, invoke its existing constructor public Add(Expression l, Expression r) { super(l, r); left = l; right = r; } Also, you're redeclaring left and right fields in the Add class. There's no point doing this. Your child class already has access to the left and right fields of its parent class, BinaryExpression.
downvote count: 0

http://stackoverflow.com/comment/40327098
has text: This is a bad idea, recursion has its place but it's definitely not appropriate for this one or for a new programmer just getting started.
type: AnswerComment
comment on: http://stackoverflow.com/a/25784608
score: 0
type: Comment

http://stackoverflow.com/comment/40357167
has text: I am trying to ranomly generate the location of the tiles
comment on: http://stackoverflow.com/q/25800809
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25842201
has body: You can only open a given camera (front or back) once, you cannot open the camera multiple times to produce multiple preview streams. In fact, on most devices, you can't open the front and back cameras simultaneously, since the camera processing pipeline is shared between the two cameras. To do this, you need to only open the camera once, and then split the output preview data into the three parts that you then display. If you need to run on Android versions before 3.0 (Honeycomb), then you need to use the preview callbacks. With them, you'll get a byte[] array of YUV data for each frame that you can then crop, convert to RGB, and place in an ImageView or SurfaceView. On Android 3.0 or later, you can use the setPreviewTexture method to pipe the preview data into an OpenGL texture, which you can then render to multiple quads in a GLSurfaceView or equivalent.
type: Answer
answers question: http://stackoverflow.com/q/25842175
has comment: http://stackoverflow.com/comment/40436135
accepted answer of: http://stackoverflow.com/q/25842175
has comment: http://stackoverflow.com/comment/40432777
score: 0
has comment: http://stackoverflow.com/comment/40432665
has comment: http://stackoverflow.com/comment/70080289
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40435724

http://stackoverflow.com/a/37236781
has comment: http://stackoverflow.com/comment/95022401
downvote count: 0
score: 51
upvote count: 51
type: Answer
has body: Make sure to read Spring's documentation about HATEOAS, it helps to get the basics. In this answer a core developer points out the concept of Resource, Resources and PagedResources, something essential which is is not covered by the documentation. It took me some time to understand how it works, so let's step through some examples to make it crystal-clear. Returning a Single Resource the resource import org.springframework.hateoas.ResourceSupport; public class ProductResource extends ResourceSupport{ final String name; public ProductResource(String name) { this.name = name; } } the controller import org.springframework.hateoas.Link; import org.springframework.hateoas.Resource; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController public class MyController { @RequestMapping("products/{id}", method = RequestMethod.GET) ResponseEntity&lt;Resource&lt;ProductResource&gt;&gt; get(@PathVariable Long id) { ProductResource productResource = new ProductResource("Apfelstrudel"); Resource&lt;ProductResource&gt; resource = new Resource&lt;&gt;(productResource, new Link("http://example.com/products/1")); return ResponseEntity.ok(resource); } } the response { "name": "Apfelstrudel", "_links": { "self": { "href": "http://example.com/products/1" } } } Returning Multiple Resources Spring HATEOAS comes with embedded support, which is used by Resources to reflect a response with multiple resources. @RequestMapping("products/", method = RequestMethod.GET) ResponseEntity&lt;Resources&lt;Resource&lt;ProductResource&gt;&gt;&gt; getAll() { ProductResource p1 = new ProductResource("Apfelstrudel"); ProductResource p2 = new ProductResource("Schnitzel"); Resource&lt;ProductResource&gt; r1 = new Resource&lt;&gt;(p1, new Link("http://example.com/products/1")); Resource&lt;ProductResource&gt; r2 = new R…
has comment: http://stackoverflow.com/comment/82557439
has comment: http://stackoverflow.com/comment/94980970
has comment: http://stackoverflow.com/comment/95069106
answers question: http://stackoverflow.com/q/25858698

http://stackoverflow.com/comment/40332686
score: 0
type: Comment
has text: Thanks dursun, for pointing me down the right path. No, I didn't need to use mem. However, you were right in pointing out that the connection URL should point to a remote database location. So I finally used jdbc:h2:tcp://localhost/~/test and it functioned smoothly. Thanks a lot once again. Cheers..
comment on: http://stackoverflow.com/a/25784421
type: AnswerComment

http://stackoverflow.com/comment/40474496
type: Comment
comment on: http://stackoverflow.com/a/25864174
has text: It was working fine without any extra configurations and whenever I remove the interceptor it works fine again, also I am not using hibernate validation annotation I am using spring validators which dose not need the above 2 jars.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25821813
has comment: http://stackoverflow.com/comment/40395248
has answer: http://stackoverflow.com/a/43405313
tagged with: webserver
has title: How to make Push notification server for my android application?
accepted answer: http://stackoverflow.com/a/25821898
answer count: 2
tagged with: push-notification
upvote count: 1
has body: How i can make my own push notification server for my android &amp; ios application? m not wanna to use GCM.
has answer: http://stackoverflow.com/a/25821898
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/43405313
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/25818436
type: Answer
answers question: http://stackoverflow.com/q/25818317
has body: From the docs : XPath is the suggested way for more complex searches, a brief tutorial can be found in W3Schools @Test public void xpath() throws Exception { final WebClient webClient = new WebClient(); final HtmlPage page = webClient.getPage("http://htmlunit.sourceforge.net"); //get list of all divs final List&lt;?&gt; divs = page.getByXPath("//div"); //get div which has a 'name' attribute of 'John' final HtmlDivision div = (HtmlDivision) page.getByXPath("//div[@name='John']").get(0); webClient.closeAllWindows(); } SO: No, its is not possiable, you can use XPath (A java library for parsing xml(html is xml)) to get your desired affect. Good luck :)
score: 0

http://stackoverflow.com/q/25819174
has answer: http://stackoverflow.com/a/25819500
downvote count: 0
has answer: http://stackoverflow.com/a/53240823
has answer: http://stackoverflow.com/a/25819272
tagged with: java
tagged with: eclipse
type: Question
score: 4
has answer: http://stackoverflow.com/a/25819177
answer count: 7
has answer: http://stackoverflow.com/a/61256001
has answer: http://stackoverflow.com/a/71193240
has title: "Cannot be resolved to a type" when attempting to use Scanner
favorite count: 0
has answer: http://stackoverflow.com/a/31853661
tagged with: java.util.scanner
type: UnansweredQuestion
has body: when i run following code it shows error that scanner cannot be resolved to type. i checked that jre is installed and version is 1.7 what else do i need to check ? please help. public class student { String name; int rollno; public void get(String nm, int rno) { name=nm; rollno=rno; } public void display() { System.out.println("Name of student is :" +name); System.out.println("Roll no of student is :" +rollno); } public static void main(String args[]) { int i ; int r1; String n1; student obj[]= new student[10]; Scanner sc=new Scanner(System.in); for(i=0;i&lt;10;i++) { obj[i]= new student(); } for(i=0;i&lt;10; i++) { System.out.println("Enter name:"); n1=sc.next(); sc.nextLine(); System.out.println("Enter roll no :"); r1=sc.nextInt(); obj[i].get(n1,r1) ; obj[i].display() ; } } }
upvote count: 4

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

http://stackoverflow.com/comment/40322117
comment on: http://stackoverflow.com/q/25740832
has text: Have you considered application-client for swing project? This will allow you to use the normal @EJB injection mechanism, albeit within your main class static variables.
type: QuestionComment
type: Comment
score: 1

http://stackoverflow.com/comment/40352038
type: QuestionComment
comment on: http://stackoverflow.com/q/25798156
has text: Show us how you do it now and what exactly is incorrect about it.
score: 0
type: Comment

http://stackoverflow.com/comment/40252589
comment on: http://stackoverflow.com/q/25742226
type: Comment
score: 0
has text: What do you mean by `doesn't work properly`? I.e. what do you expect? What kind of unexpected result or behavior do you have? You have to provide more contextual information about your issue if you want people (to be able) to help you. See [How do I ask a good question](http://stackoverflow.com/help/how-to-ask) for instance.
type: QuestionComment

http://stackoverflow.com/q/25739572
has comment: http://stackoverflow.com/comment/40245435
tagged with: multiple-columns
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40245536
has body: I have a JComboBox with 2 columns inside. I am getting the data from a database in an ArrayList. And with loop in the JComboBox: for(int x = 0; x &lt; result.size(); x++) combo.addItem(new String[]{ (String) result.get(x),""+(String) result2.get(x)}); This is my Custom Renderer: class MyRenderer extends JPanel implements ListCellRenderer&lt;Object&gt; { private static final long serialVersionUID = 236185631594254585L; JLabel[] lbl = new JLabel[2]; public MyRenderer () { setLayout(new GridLayout(0,2)); for(int x = 0; x &lt; lbl.length; x++){ lbl[x] = new JLabel(); lbl[x].setOpaque(true); add(lbl[x]); } } public Component getListCellRendererComponent (JList&lt;?&gt; list,Object value, int index,boolean isSelected,boolean cellHasFocus) { for(int x = 0; x &lt; lbl.length; x++) lbl[x].setText((String)((String[])value)[x]); return this; } } runable code: public class MultipleComboTest extends JFrame { JComboBox&lt;String[]&gt; combo = new JComboBox&lt;String[]&gt;(); ArrayList result; ArrayList result2; public TestingMultipleCombo(){ setLocation(400,300); setDefaultCloseOperation(EXIT_ON_CLOSE); combo.setRenderer(new MyRenderer()); getContentPane().add(combo); result = new ArrayList(); result2 = new ArrayList(); result.add("Test1"); result.add("Test2"); result2.add("Value1"); result2.add("Value2"); for(int x = 0; x &lt; result.size();x++) combo.addItem(new String [] {(String) result.get(x),""+(String) result2.get(x)}); pack(); combo.setEditable(true); } public static void main(String[] args){new TestingMultipleCombo().setVisible(true);} } class MyRenderer extends JPanel implements ListCellRenderer&lt;Object&gt; { private static final long serialVersionUID = 236185631594254585L; JLabel[] lbl = new JLabel[2]; public MyRenderer(){ setLayout(new GridLayout(0,2)); for(int x = 0; x &lt; lbl.length; x++){ lbl[x] = new JLabel(); lbl[x].setOpaque(true); add(lbl[x]); } } public Component getListCellRendererComponent(JList&lt;?&gt; list,Object value, int index,boolean isSelected,boo…
has comment: http://stackoverflow.com/comment/40245619
tagged with: jcombobox
linked to: http://stackoverflow.com/q/25738472
answer count: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/40245350
type: Question
has title: JCombobox multi Column Editable
has comment: http://stackoverflow.com/comment/40245943
has comment: http://stackoverflow.com/comment/40245388
has comment: http://stackoverflow.com/comment/40246013
score: 0
has comment: http://stackoverflow.com/comment/40246210
has comment: http://stackoverflow.com/comment/40245218

http://stackoverflow.com/a/25757704
score: 0
has body: Ending up finding the answer after enough tinkering around with things and bouncing ideas off my roommates. Changed this: public String decode(String codedWord) { //Maps every character back 2 spaces w/ wrap around String result = ""; for (int cnt = 0; cnt &lt; codedWord.length(); cnt++) { result += backMap(codedWord.charAt(cnt)); } decodedList[0] = result; return result; } To this: public String decode(String codedWord) { //Maps every character back 2 spaces w/ wrap around String result = ""; for (int cnt = 0; cnt &lt; codedWord.length(); cnt++) { result += backMap(encodedList[0].charAt(cnt)); } decodedList[0] = result; return result; }
answers question: http://stackoverflow.com/q/25757183
type: Answer

http://stackoverflow.com/comment/40436818
has text: Why duplicate it? You can't provide the information we need to fix it
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25842817
type: Comment

http://stackoverflow.com/q/25819834
accepted answer: http://stackoverflow.com/a/25819859
has comment: http://stackoverflow.com/comment/40391988
answer count: 1
has body: SOLVED!!! Thanks for the hand guys got it working. Appreciate it! I'm writing a program that has user name and password input. I am trying to check if a file exists for a user if the user puts in a user name that already exists when they create a user name and password. The .exists method isn't working and I cant figure it out. Error cannot find symbol comes back. I've changed things, moved things around and got it down to one error. Tried using loops as well as if statements but using if gets me to only one error .Any help would be great. import java.util.Scanner; import java.io.*; class UserData { public static void main ( String[] args ) throws IOException { Scanner kb = new Scanner(System.in); System.out.println("Do you have an account? Yes or No: "); String answer = kb.next().trim(); if ((answer.startsWith("N")) || (answer.startsWith("n"))) { System.out.println("Create user name: "); String user = kb.next().trim(); String fileName = user + ".txt"; FileWriter userData = new FileWriter(fileName); if (userData.exists()) { System.out.println("User already exists"); System.out.println("Create user name: "); user = kb.next().trim(); fileName = user + ".txt"; userData = new FileWriter(fileName); } System.out.println("Create Password: "); String ps = kb.next().trim(); userData.write(user + " "); userData.write(ps); userData.close(); } else if ((answer.startsWith("Y")) || (answer.startsWith("y"))) { System.out.println("Enter user name: "); String user = kb.next().trim(); System.out.println("Enter Password: "); String ps = kb.next().trim(); String fileName = user + ".txt"; Scanner inFile = new Scanner(new File(fileName)); String userName = inFile.next(); String password = inFile.next(); // If ((userName != user) || (password != ps)) // { // System.out.println("User Not Found"); // System.out.println("Enter user name: "); // String user = kb.next().trim(); // // System.out.println("Enter Password: "); // String ps = kb.next().trim(); // // String fileName = user + ".txt";…
favorite count: 0
has title: Check if a .txt file exists. FileWriter.exists method not working
has comment: http://stackoverflow.com/comment/40391965
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25819859
score: 1
tagged with: java
tagged with: filewriter
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/40392097

http://stackoverflow.com/comment/126383801
type: AnswerComment
has text: This is for me the more completed answer.
type: Comment
comment on: http://stackoverflow.com/a/25863861
score: 0

http://stackoverflow.com/q/25811394
has comment: http://stackoverflow.com/comment/40375665
has answer: http://stackoverflow.com/a/25811864
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/686453
tagged with: xml-parsing
answer count: 1
has title: parsing xml with records type
favorite count: 0
accepted answer: http://stackoverflow.com/a/25811864
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
has body: I had got an xml data to parse into java Object. But this xml data with records is seeing first time,any body had an idea to parse this. <?xml version="1.0" encoding="UTF-8"?> <Coder version="1.0"> load 1.0 2 0 13 382 13 382 CD3 1 13 382 CD2 1 13 382 CD1 1 13 382 CD4 1 dir 2014 </ICoder> Normally for parsing from xml to javaObjects usually use the jaxB code. JAXBContext jaxbContext; try { jaxbContext = JAXBContext.newInstance(OrderType .class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); OrderType order = (OrderType ) jaxbUnmarshaller.unmarshal(file); System.out.println(order ); } catch (JAXBException e) { // TODO Auto-generated catch block e.printStackTrace(); }
tagged with: jaxb

http://stackoverflow.com/comment/40482526
comment on: http://stackoverflow.com/q/25869837
score: 0
type: Comment
type: QuestionComment
has text: @talex Well any wrapper object would do, obviously, but I was surprised by the wording "pass by reference", which, IMO, is not very appropriate here.

http://stackoverflow.com/a/25804993
has comment: http://stackoverflow.com/comment/40367763
has comment: http://stackoverflow.com/comment/40366182
has comment: http://stackoverflow.com/comment/40364247
has comment: http://stackoverflow.com/comment/40364164
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25804414
has body: I dint understood your question properly. felt like you want to compare the id attribute of environment tag and DB tag with some default value or among themselves. As per the XML sample given, following code will give you the id value of both tags.Hope it can be used for comparison. Node environment= doc.getElementsByTagName("Environment").item(0); NamedNodeMap nodeMap = environment.getAttributes(); Node idAttr = nodeMap.getNamedItem("id"); String envAttrValue = idAttr.getTextContent(); Node dbNode = node.getChildNodes().item(0); NamedNodeMap dbNodeMap = dbNode.getAttributes(); Node dbIdAttr = dbNodeMap.getNamedItem("id"); String dbAttrValue = dbIdAttr.getTextContent();
has comment: http://stackoverflow.com/comment/40366730

http://stackoverflow.com/a/25747048
has body: I figured it out myself! I needed to do this: import java.io.FileFilter; and then modify each error line from File[] directories = objectsDir.listFiles(DirectoryFileFilter.DIRECTORY); to this: File[] directories = objectsDir.listFiles((FileFilter) DirectoryFileFilter.DIRECTORY); and now everything is working.
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25739328
answers question: http://stackoverflow.com/q/25739328
type: Answer
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/40407536
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25828722
has text: How have you tried those things you tried?

http://stackoverflow.com/comment/40223887
score: 0
comment on: http://stackoverflow.com/q/25728415
type: Comment
type: QuestionComment
has text: If the path and the name were identical it would have been the same file and you would be comparing it to itself... All version control systems have `diff` (-like) command to compare brunches... If you want to compare `jar`s I would suggest you unzip them first and then use BeyondCompare to compare dir structures

http://stackoverflow.com/comment/40393941
type: Comment
score: 0
type: QuestionComment
has text: The summary of this question makes sense, but the entire body confuses me...
comment on: http://stackoverflow.com/q/25820897

http://stackoverflow.com/comment/40276058
has text: I am not a 100% certain that it is a container issue.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25751204
type: AnswerComment

http://stackoverflow.com/comment/40277235
type: Comment
type: QuestionComment
has text: sorry if i misused the website. I just made an account because I was struggling so much. and Thanks for the tip Takendarkk.
score: 0
comment on: http://stackoverflow.com/q/25757043

http://stackoverflow.com/a/25847147
answers question: http://stackoverflow.com/q/25846683
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25846683
score: 2
has body: The representation of objects in the debugger is determined by their full class name, a hex value preceded by @ and their toString() method. For example, if you look at SecurityContextHolderAwareRequestWrapper.java, you can see the following: @Override public String toString() { return "SecurityContextHolderAwareRequestWrapper[ " + getRequest() + "]"; } In turn, the toString() method of the request is invoked via String concenation, and this gives you the format as you see it. The square bracket format is somewhat arbitrary, but it generally means that the object within the square brackets is contained by (referred to by, via composition) the outer object. So in this example, you can see you have a SecurityContextHolderAwareRequestWrapper which has-a FirewalledRequest which in turn has-a RequestFacade. Objects of classes without an overridden toString() method appear like RequestFacade@422b8dc8 - via the default implementation from java.lang.Object. The hex value is not a hashcode, so as far as I can see it must be a heap memory address offset. This allows you to identify references that refer to the same object (same hex value is same object).
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40442026
type: Answer
has comment: http://stackoverflow.com/comment/40441445

http://stackoverflow.com/comment/40279699
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25758591
score: 0
has text: You might have to access the driver stack to extract that information. Or try using api's of wireshark.

http://stackoverflow.com/a/25756925
has comment: http://stackoverflow.com/comment/40276853
downvote count: 0
has body: you can try 1.) String.valueOf(ch).codePointAt(0); 2.) cast the character with int
type: Answer
has comment: http://stackoverflow.com/comment/40276878
answers question: http://stackoverflow.com/q/25756900
score: 1
upvote count: 1

finalize
type: Tag
tag name: finalize
tags question: http://stackoverflow.com/q/25830592

http://stackoverflow.com/q/25822369
has body: I'm slowly stepping in Java world through Spring Framework (4.1.0) and need your help with Listeners. I have created application without deployment descriptor, all Spring related configuration is managed in @Configuration annotated classes. Everything is working but I can't find a way to register listeners. Question: How I can register listeners in Spring (4.1.0) based on Java @Configuration annotated classed ?
tagged with: java
type: Question
score: 5
tagged with: servlet-listeners
upvote count: 5
has title: How to register listener in Spring without deployment descriptor
has answer: http://stackoverflow.com/a/25822418
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/104029132
tagged with: spring
accepted answer: http://stackoverflow.com/a/25822418
tagged with: spring-mvc
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/10813993

http://stackoverflow.com/comment/137612983
type: AnswerComment
type: Comment
has text: No, it doesn't mean the socket was closed, unexpectedly or otherwise. It means the *connection* was *aborted,* and the question is 'why?'
comment on: http://stackoverflow.com/a/25868877
score: 0

http://stackoverflow.com/a/25819084
has comment: http://stackoverflow.com/comment/40399473
has comment: http://stackoverflow.com/comment/40390636
has comment: http://stackoverflow.com/comment/40409028
type: Answer
score: 1
has body: Below is some simple (but horribly inefficient) code to solve this problem. The "backtracking" part of this is implemented via recursion. Ever time you return from a method in Java you "backtrack" through the stack to wherever it was called from. This makes using the call stack to track your "backtrack" state for you really easy. Here's the basic idea. Let's say I'm searching some array A for the sum n. We start our search in the array at index i=0. Then we try two things: Try including the element A[i] in the running sum. We do this by searching the array from index i+1 for the value n-A[i]. We need to record this element in our running list of included elements. We'll call this list of all elements included in our running sum xs. Try not including the element A[i] in the running sum. We do this by searching the array from index i+1 for the current value of n. Since we didn't include A[i] we don't need to update xs. See how we search the whole array for the first case, backtrack and then do the search over again for the second case? Note that you need to have a preserved copy of xs around after "backtracking" to use in the second search. I think the simplest way to do this with the standard Java library is to undo the changes to xs when you backtrack. So, if you add some element x to the end of xs to do the "with"-search, then simply remove the last element from xs just before you do the "without"-search. Rather than trying to store all the answers in a datastructure, I just print an answer as soon as I find it. This is also to simplify the logic of this solution. import java.util.Deque; import java.util.ArrayDeque; public class SubarraySums { /** Program entry point */ public static void main(String[] args) { int[] array = { 1, 8, 7, 9, 5, 2 }; findSubarraySums(12, array); } /** Wrapper function for the search */ public static void findSubarraySums(int goal, int[] array) { // Search the whole array with an empty starting set search(goal, new ArrayDeque&lt;Integer&…
upvote count: 1
has comment: http://stackoverflow.com/comment/40391146
accepted answer of: http://stackoverflow.com/q/25817980
has comment: http://stackoverflow.com/comment/40390943
answers question: http://stackoverflow.com/q/25817980
has comment: http://stackoverflow.com/comment/40390690
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40452039
type: Comment
comment on: http://stackoverflow.com/a/25852710
score: 0
type: AnswerComment
has text: @user3024888 - Do you need to handle more than two `enum` values? If not, there's a much faster way of solving the problem.

http://stackoverflow.com/q/25782531
favorite count: 0
upvote count: 2
tagged with: rabbitmq
has title: Reply-To in SpringAMQP being set beforehand?
score: 2
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
has body: I am using SpringBoot to start a SpringAMQP application that connect to RabbitMQ queues. I would like to be able to send a message from the producer, specifying the reply-queue so that the consumer would only need to send without having to investigate the destination (hence not having to pass the reply data in the message itself). this is the configuration I have (shared between producer and consumer) private static final String QUEUE_NAME = "testQueue"; private static final String ROUTING_KEY = QUEUE_NAME; public static final String REPLY_QUEUE = "replyQueue"; private static final String USERNAME = "guest"; private static final String PASSWORD = "guest"; private static final String IP = "localhost"; private static final String VHOST = "/"; private static final int PORT = 5672; @Bean public RabbitTemplate rabbitTemplate() { RabbitTemplate template = new RabbitTemplate(connectionFactory()); amqpAdmin().declareQueue(new Queue(QUEUE_NAME)); amqpAdmin().declareQueue(new Queue(REPLY_QUEUE)); return template; } @Bean public AmqpAdmin amqpAdmin() { return new RabbitAdmin(connectionFactory()); } @Bean public ConnectionFactory connectionFactory() { CachingConnectionFactory connectionFactory = new CachingConnectionFactory(IP); connectionFactory.setUsername(USERNAME); connectionFactory.setPassword(PASSWORD); connectionFactory.setVirtualHost(VHOST); connectionFactory.setPort(PORT); return connectionFactory; } I am sending a message as follows : public Object sendAndReply(String queue, String content){ return template.convertSendAndReceive(queue, new Data(content), new MessagePostProcessor() { @Override public Message postProcessMessage(Message message) throws AmqpException { message.getMessageProperties().setReplyTo(ReplyTester.REPLY_QUEUE); return message; } }); } and awaiting a reply as follows: public void replyToQueue(String queue){ template.receiveAndReply(queue, new ReceiveAndReplyCallback&lt;Data, Data&gt;() { @Override public Data handle(Data payload) { System.out.print…
type: Question
tagged with: spring-amqp
accepted answer: http://stackoverflow.com/a/25782657
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/25782657

http://stackoverflow.com/q/25798983
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25799046
tagged with: java
tagged with: hibernate
tagged with: mysql
answer count: 1
accepted answer: http://stackoverflow.com/a/25799046
score: 0
has body: I am new to Hibernate and working on a test project, I have tried a lot of things to get this example working. But I am unsure why it fails, I am aware that the null pointer exception could be because I am trying to getQuestions on Survey but its empty. But I have seen so many tutorials online and followed them and all have the same approach. I have tried recreating the database tables, different versions of hibernate. Nothing has helped me get this resolved. If someone can take a look and guide me would be great help. I would appreciate your feedback. Also if I comment out the question part in Application.java then the survey object gets inserted in the database. I am not sure why the questions fail and don't get insert.Please guide me. This is my First model class: @Entity @Table(name="question") public class Question implements java.io.Serializable{ /** * */ private static final long serialVersionUID = 1L; @Id @GeneratedValue @Column(name = "id") private Long _id; @Column(name = "label") private String _label; @Column(name="type") private QuestionType _type; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name="survey_id") private Survey _survey; public Question() { } public Question(final Long id, final String label, final QuestionType type, final Survey survey,final Long surveyId) { _id = id; _label = label; _type = type; _survey = survey; Assert.notNull(_id, "_id cannot be null"); Assert.notNull(_label, "_label cannot be null"); Assert.notNull(_type, "_type cannot be null"); Assert.notNull(_survey, "_survey cannot be null"); } public Long getId() { return _id; } public void setId(Long id) { _id = id; } public String getLabel() { return _label; } public void setLabel(String label) { _label = label; } public QuestionType getType() { return _type; } public void setType(QuestionType type) { _type = type; } public Survey getSurvey() { return _survey; } public void setSurvey(Survey survey) { _survey = survey; } @Override public String toString() { return "Question [_…
tagged with: maven
has title: ERROR org.hibernate.util.JDBCExceptionReporter - Data truncated for column 'type'

http://stackoverflow.com/comment/40279487
type: Comment
has text: @MehulJoisar can you help me for above json format
score: 0
comment on: http://stackoverflow.com/q/25758106
type: QuestionComment

http://stackoverflow.com/q/25769766
has title: Error install Maven in Eclipse
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25784156
has comment: http://stackoverflow.com/comment/40300074
tagged with: java
has comment: http://stackoverflow.com/comment/40300656
type: Question
favorite count: 0
score: 0
answer count: 1
has body: I don't know why maven install error in Eclipse, the following picture: Thank all!

http://stackoverflow.com/q/25782687
type: Question
accepted answer: http://stackoverflow.com/a/25938029
tagged with: sorting
tagged with: comparable
has answer: http://stackoverflow.com/a/25938029
tagged with: comparator
has body: As I was going through the above interfaces I am not much clear about the syntax of these Interfaces after reading many sites on same topic. Consider the following code snippet : public class ComparableTest implements Comparable,Comparator { String name; int age; public ComparableTest(String name,int age){ this.name=name; this.age=age; } @Override public int compareTo(Object o){ // line 1 ComparableTest c=(ComparableTest)o; return name.compareTo(c.name); // line 2 } @Override public int compare(Object o1, Object o2){ // line 4 ComparableTest c1=(ComparableTest)o1; ComparableTest c2=(ComparableTest)o2; return return c1.name.compareTo(c2.name); } public static void main(String[] args) { ComparableTest ct1=new ComparableTest("Max",23); ComparableTest ct2=new ComparableTest("Alex",22); ComparableTest ct3=new ComparableTest("Zen",25); List lt=new ArrayList(); lt.add(ct1); lt.add(ct2); lt.add(ct3); Collections.sort(lt); // line 3 Collections.sort(lt,new ComparableTest("jack",98)); // line 5 } } 1) In line 3, Collections.sort(lt) with list as parameter calls compareTo which is having Object as parameter accepts the list lt. How ? Isn't the compareTo must have a List as Parameter. I know List is also type of Object but how Object o will accepts that List which contains an instances of some class.(Please exclude generics as i don't know now) 2) Suppose I call c1.comapreTo(c2) then it is clear c1 is this object and c2 is another object for comparison. So then in comapreTo(Object o) the following line is crystal clear public int compareTo(Object o) { //cast the Object o return c1.name.compareTo(c2.name); } But In line 2, I wrote only name.compareTo(c.name) and compared. What does name refer here. How Sorting is taking place? I read that it is current object but we call compareTo with Collections.sort not with any object. 3) As line 5 calls line 4, line 4 takes list lt as o1 and newly Object created as o2. I don't understand the object to be sorted are in list then why we are p…
answer count: 1
has title: Comparable and Comparator Interface
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40358310
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: collections

http://stackoverflow.com/a/25805916
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25788709
has body: A Java 8 solution using java.time api which will convert a given string to millisecond and millisecond to string date considering Time Zone: import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; public class SO25788709 { public static void main(String[] args) { String strDate = "2014-09-12 23:59:59"; String pattern = "yyyy-MM-dd HH:mm:ss"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); ZoneId zone = ZoneId.of("America/Los_Angeles"); long milli = getMillis(strDate, formatter, zone); System.out.println(milli); String retStrDate = getDateString(milli, formatter, zone); System.out.println(retStrDate); } private static long getMillis(String strDate, DateTimeFormatter formatter, ZoneId zone) { LocalDateTime localDateTime = LocalDateTime.parse(strDate, formatter); ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, zone); Instant instant = zonedDateTime.toInstant(); long milli = instant.toEpochMilli(); return milli; } private static String getDateString(long milli, DateTimeFormatter formatter, ZoneId zone) { Instant instant = Instant.ofEpochMilli(milli); ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(instant, zone); String strDate = zonedDateTime.format(formatter); return strDate; } }
type: Answer
downvote count: 0

http://stackoverflow.com/q/25859083
downvote count: 1
linked to: http://stackoverflow.com/q/1571265
tagged with: jodatime
has body: The title might sound a bit generic but here are the specifics of the question Why exactly a lot of APIS in Date class deprecated in favor of Calendar ? Why using Calendar is better ? Is is computationally efficient or some other reason ? I currently rely on JodaTime for most of the date manipulations. Does Calendar api does something better or different than JodaTime ?
has answer: http://stackoverflow.com/a/25861490
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40463409
has answer: http://stackoverflow.com/a/25859940
has comment: http://stackoverflow.com/comment/40463526
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40467246
answer count: 2
has comment: http://stackoverflow.com/comment/40463433
has comment: http://stackoverflow.com/comment/40463422
score: 0
tagged with: java
upvote count: 1
has title: What are some of the important things I need to know before Calendar API in java?

http://stackoverflow.com/q/25780189
favorite count: 0
has comment: http://stackoverflow.com/comment/40321203
has answer: http://stackoverflow.com/a/62281330
tagged with: decoding
has comment: http://stackoverflow.com/comment/40321349
has comment: http://stackoverflow.com/comment/40319032
has comment: http://stackoverflow.com/comment/40320669
has comment: http://stackoverflow.com/comment/40321581
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/62281330
has title: How to create an encoder? Decoder?
tagged with: java
has body: I am fairly new to programming in general and I was wondering how I could encode/decode text that is inputted. All letters must be brought down 3 letters for ex A -> D B -> E and so forth Ill put in some pseudocode for an example: INPUT MESSAGE: "LORYHBRX" Encoded Message:LORYHBRX Decoded Message:ILOVEYOU OUTPUT MESSAGE: "ILOVEYOU" Please help. So far I have import java.util.*; public class Encoder { public static void main(String[] args) { String a = "d"; String b = "e"; String c = "f"; String d = "g"; String e = "h"; String f = "i"; String g = "j"; String h = "k"; String i = "l"; String j = "m"; String k = "n"; String l = "o"; String m = "p"; String n = "q"; String o = "r"; String p = "s"; String q = "t"; String r = "u"; String s = "v"; String t = "w"; String u = "x"; String v = "y"; String w = "z"; String x = "a"; String y = "b"; String z = "c"; Scanner in = new Scanner(System.in); System.out.println("Please enter the text you wish to encode."); String place = in.nextLine(); System.out.println(place); } } I'm trying to convert what is inputted into the variables above. I think I am stating all those strings as variable but I do not know how to make them changeable by the input.
has comment: http://stackoverflow.com/comment/40321180
tagged with: eclipse
has answer: http://stackoverflow.com/a/25782315
type: Question
accepted answer: http://stackoverflow.com/a/25782315
answer count: 2
tagged with: encoding
tagged with: algorithm
has comment: http://stackoverflow.com/comment/40319715
score: 0
has comment: http://stackoverflow.com/comment/40321660
has comment: http://stackoverflow.com/comment/40319690
upvote count: 1
has comment: http://stackoverflow.com/comment/40319202
downvote count: 1

http://stackoverflow.com/comment/40283023
type: Comment
score: 0
has text: That's a strange layout the calculator buttons currently have. Why not go with a layout more like seen in [this answer](http://stackoverflow.com/a/7441804/418556)?
type: QuestionComment
comment on: http://stackoverflow.com/q/25759986

http://stackoverflow.com/a/25821937
has comment: http://stackoverflow.com/comment/40397973
has body: Change the following public static int lines(String filename) throws FileNotFoundException //change the return type to int instead of void { Scanner inputFile = new Scanner(filename); //filename instead of file int lines = 0; while (inputFile.hasNextLine()) { lines++; inputFile.nextLine(); // ---do---- } inputFile.close(); // after return it will become unreachable return lines; } Same applies to other methods
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25821845
has comment: http://stackoverflow.com/comment/40396566
downvote count: 0
type: Answer

http://stackoverflow.com/q/25742984
tagged with: session
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40250736
has title: org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session
has body: Hi i tried to resolve but i am failing to resolve it getting exception like this org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session: [com.omnypay.dao.bo.CloudSvrUsersProfile#284]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.omnypay.dao.bo.CloudSvrUsersProfile#284] Caused by: org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: my user class is @Entity @Table(name="CLOUD_SVR_USERS") @NamedQuery(name="CloudSvrUser.findAll", query="SELECT c FROM CloudSvrUser c") public class CloudSvrUser implements Serializable { @Id @GeneratedValue @Column(name="USER_ID") private long userId; it has some column and the oneto one relation like @OneToOne(mappedBy="user",fetch=FetchType.LAZY,cascade=CascadeType.ALL) private CloudSvrUsersProfile usersProfile; and getters&amp;setters and my profile class is @Entity @Table(name="CLOUD_SVR_USERS_PROFILE1") @NamedQuery(name="CloudSvrUsersProfile.findAll", query="SELECT c FROM CloudSvrUsersProfile c") public class CloudSvrUsersProfile implements Serializable { private static final long serialVersionUID = 1L; @Id @Column(name="USER_ID",nullable=false) @GeneratedValue(generator="gen") @GenericGenerator(name="gen", strategy="foreign", parameters=@Parameter(name="property", value="user")) private Long usersProfileId; //columns and @OneToOne @PrimaryKeyJoinColumn private CloudSvrUser user; @Transient private String emailId; and service impl class is @Transactional public void UpdateUserProfile(CloudSvrUsersProfile userProf) throws BusinessException { try{ CloudSvrUser dbUser = getUser(userProf); //CloudSvrUsersProfile dbUserProfile = dbUser.getUsersProfile(); //CloudSvrUsersProfile updatedProf=userProf.getUsersProfile(); if(dbUser != null){ //CloudSvrUsersProfile …
type: Question
has comment: http://stackoverflow.com/comment/40250730
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40251279
has answer: http://stackoverflow.com/a/25743932
upvote count: 1
tagged with: spring
answer count: 1
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40250888
has comment: http://stackoverflow.com/comment/40250834

http://stackoverflow.com/q/25769152
type: Question
answer count: 2
tagged with: point
tagged with: null
has comment: http://stackoverflow.com/comment/40299141
accepted answer: http://stackoverflow.com/a/25769488
has body: When i compile this to my android device it gives me a null pointer exception. i have been trying to find where the null pointer exception is, but without any luck. i have an activity with a button and an edittext. When you click the button the text in the edittext should end up as an item in a listview. Please help. log: http://i61.tinypic.com/14lq33n.jpg Source: package com.example.foodplannerbeta; import java.util.ArrayList; import android.app.Activity; import android.content.pm.ActivityInfo; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; public class Indkob2Activity extends Activity { private Button bt; private ListView lv; private ArrayList&lt;String&gt; al; private ArrayAdapter&lt;String&gt; adapter; private EditText et; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_indkob2); bt = (Button) findViewById(R.id.btncustomindkob); lv = (ListView) findViewById(R.id.listView1); et = (EditText) findViewById(R.id.customEdittrec); al = new ArrayList&lt;String&gt;(); adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, al); lv.setAdapter(adapter); bt.setOnClickListener(new View.OnClickListener() { public void onClick(View arg0) { al.add(et.getText().toString()); adapter.notifyDataSetChanged(); } }); } }
score: 0
possible better answer: http://stackoverflow.com/a/25769844
has comment: http://stackoverflow.com/comment/40298601
has comment: http://stackoverflow.com/comment/40299670
has comment: http://stackoverflow.com/comment/40298599
has answer: http://stackoverflow.com/a/25769488
tagged with: exception
tagged with: android
has answer: http://stackoverflow.com/a/25769844
type: AnsweredQuestion
has title: Need help to spot null pointer exception java
tagged with: java
has comment: http://stackoverflow.com/comment/40298950
has comment: http://stackoverflow.com/comment/40298799

http://stackoverflow.com/a/25823352
answers question: http://stackoverflow.com/q/25823293
score: 0
type: Answer
has body: There is nothing you should use instead of a.show(). That line should be where you put it, and uncommented. Additionally you need b.show() inside: public static void main(String args[]) { A a = new A(){ public void show(){ System.out.println("In anonymous Class"); A b =new A(){ public void show(){ System.out.println("In nested Anonymous Class"); } }; b.show(); } }; a.show(); }

http://stackoverflow.com/a/25833702
answers question: http://stackoverflow.com/q/25830373
type: Answer
has body: If you have a concern about memory, any regular expression that uses groups will consume more memory than those that don't. Capturing groups are a way to treat multiple characters as a single unit. They are created by placing the characters to be grouped inside a set of parentheses. For example, the regular expression ([0-9) creates a single group containing the numbers from 0 to 9. The portion of the input string that matches the capturing group will be saved in memory for later recall via back references. You could achieve the same using look behind by doing (?&lt;=part=\s)\d+; this version will match the same result the numbers using less memory. However, I noticed your expression above considered the possibility of space between the numbers if that is necessary the expression needs to be: (?&lt;=part=\s)[0-9 ]+. Another important thing to mention is the use \w prior to your numbers since \w matches [0-9A-Za-z_] and it seems that your expression wants to consider an space instead.
score: 0

http://stackoverflow.com/q/25860696
tagged with: file
has answer: http://stackoverflow.com/a/25861057
has comment: http://stackoverflow.com/comment/40466288
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40466132
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40466221
favorite count: 0
has body: I am reading different chunks of data from DB and writing each chunk into CSV file and adding that entry to zip file. Here are my questions: I am dealing with huge data, Is it advisable to open zip stream open in the beginning and closing at end of transaction? If I do so, will it hold all these data in RAM and cause any memory issues? Will there be any advantage if I keep these csv files in hard drive and zipping it at the end of transaction? If so, what is the best way to do it in java? Note: We are using Java 1.6 for our application.
tagged with: http://stackoverflow.com/tag/csv
has title: Best way to compress files
score: 2
tagged with: http://stackoverflow.com/tag/zip
upvote count: 2
has answer: http://stackoverflow.com/a/25861694
type: UnansweredQuestion

http://stackoverflow.com/q/25717913
type: Question
has title: Comparing to XML node by Node and Print the differences
tagged with: xml-parsing
upvote count: 0
answer count: 1
favorite count: 0
has body: How to Compare to XML Files Node by Node and to print the differences?
type: UnansweredQuestion
downvote count: 2
score: -2
has answer: http://stackoverflow.com/a/25718012
tagged with: java
tagged with: dom

http://stackoverflow.com/comment/40216233
has text: Is `res` a source folder? Try with `db.properties` directly instead.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25724508
score: 0

http://stackoverflow.com/comment/40357055
comment on: http://stackoverflow.com/q/25798876
has text: possible duplicate of [Calculate number of weekdays between two dates in Java](http://stackoverflow.com/questions/4600034/calculate-number-of-weekdays-between-two-dates-in-java). And [this](http://stackoverflow.com/q/2751302/642706). And [this](http://stackoverflow.com/q/15622413/642706). And [this](http://stackoverflow.com/q/12143194/642706). And [this](http://stackoverflow.com/q/8171968/642706).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25809900
score: 2
downvote count: 0
has body: You can also use XPath expressions to fetch the required data. So, the solution could be: String xml = " Add 400188711111 4 " + " 1111201090467034 "; DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = null; try { builder = builderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } Document document = builder.parse(new ByteArrayInputStream(xml.getBytes())); XPath xPath = XPathFactory.newInstance().newXPath(); String data = xPath.compile("/Record/sensdata").evaluate(document); System.out.println(data);
answers question: http://stackoverflow.com/q/25809538
type: Answer
upvote count: 2

http://stackoverflow.com/comment/40315553
type: QuestionComment
comment on: http://stackoverflow.com/q/25777287
score: 3
has text: 1) Your cipher looks to be too large. It should never be larger than your modulus. 2) That is how it's supposed to work, RSA encryption using some random padding so every encryption, even of the same plaintext, will be different. Also, you should only use the bcprov-jdk15on library, the -ext vesion is almost identical except it includes some legacy ciphers (like IDEA) you won't need.
type: Comment

http://stackoverflow.com/comment/40292213
type: AnswerComment
comment on: http://stackoverflow.com/a/25765724
has text: @Dmitry Bychenko: thanks, that was occasional C++11 influence :)
type: Comment
score: 0

http://stackoverflow.com/q/25864316
has answer: http://stackoverflow.com/a/25866191
type: AnsweredQuestion
downvote count: 0
tagged with: pretty-print
accepted answer: http://stackoverflow.com/a/25866191
favorite count: 0
type: Question
has title: Pretty print XML in java 8
has answer: http://stackoverflow.com/a/25865290
upvote count: 32
has answer: http://stackoverflow.com/a/42958172
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27681477
tagged with: java
answer count: 7
has answer: http://stackoverflow.com/a/25865324
has answer: http://stackoverflow.com/a/53679819
linked to: http://stackoverflow.com/q/33935718
has body: I have an XML file stored as a DOM Document and I would like to pretty print it to the console, preferably without using an external library. I am aware that this question has been asked multiple times on this site, however none of the previous answers have worked for me. I am using java 8, so perhaps this is where my code differs from previous questions? I have also tried to set the transformer manually using code found from the web, however this just caused a not found error. Here is my code which currently just outputs each xml element on a new line to the left of the console. import java.io.*; import javax.xml.parsers.*; import javax.xml.transform.*; import javax.xml.transform.dom.DOMSource; import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import org.xml.sax.InputSource; import org.xml.sax.SAXException; public class Test { public Test(){ try { //java.lang.System.setProperty("javax.xml.transform.TransformerFactory", "org.apache.xalan.xsltc.trax.TransformerFactoryImpl"); DocumentBuilderFactory dbFactory; DocumentBuilder dBuilder; Document original = null; try { dbFactory = DocumentBuilderFactory.newInstance(); dBuilder = dbFactory.newDocumentBuilder(); original = dBuilder.parse(new InputSource(new InputStreamReader(new FileInputStream("xml Store - Copy.xml")))); } catch (SAXException | IOException | ParserConfigurationException e) { e.printStackTrace(); } StringWriter stringWriter = new StringWriter(); StreamResult xmlOutput = new StreamResult(stringWriter); TransformerFactory tf = TransformerFactory.newInstance(); //tf.setAttribute("indent-number", 2); Transformer transformer = tf.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); transformer.trans…
possible better answer: http://stackoverflow.com/a/33541820
score: 32
tagged with: dom
has answer: http://stackoverflow.com/a/33541820

http://stackoverflow.com/comment/40198689
type: QuestionComment
has text: That doesn't make any sense. http://en.wikipedia.org/wiki/Base64 http://en.wikipedia.org/wiki/UTF-8
comment on: http://stackoverflow.com/q/25715001
score: 0
type: Comment

http://stackoverflow.com/comment/40441752
has text: They are your classes. I was simply trying to figure out, what you are asking. With that code (containing `x` as a method's local variable) this question does not make sense.
comment on: http://stackoverflow.com/q/25847219
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/124986089
type: QuestionComment
has text: Install the JDK, not the JRE. https://docs.oracle.com/en/java/javase/11/tools/jmap.html
score: 0
comment on: http://stackoverflow.com/q/25715067
type: Comment

http://stackoverflow.com/q/25740873
type: UnansweredQuestion
score: 0
tagged with: swing
tagged with: java
has body: I'm using Jframe form for this program and here's the button code I've tried. When I ran the program and clicked the button nothing happens. Pls help. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { ImageIcon icondir = new ImageIcon("C:\\Users\\Awesome\\Desktop\\myaJbQq.jpg"); ID_Background.setIcon(icondir); }
has comment: http://stackoverflow.com/comment/40247307
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25744523
has comment: http://stackoverflow.com/comment/40247426
has comment: http://stackoverflow.com/comment/40248353
has comment: http://stackoverflow.com/comment/40247192
has title: How can I set the icon of jlabel as background image using a jbutton?
has answer: http://stackoverflow.com/a/25741011
tagged with: netbeans
tagged with: jlabel
tagged with: jframe

http://stackoverflow.com/comment/40518807
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25889885
has text: Its research purpose..but can you tell me where exactly i should put instanse.put, instead of arrayList??
type: AnswerComment

http://stackoverflow.com/q/25723655
type: Question
has comment: http://stackoverflow.com/comment/40218074
tagged with: nio
tagged with: bytebuffer
score: 0
tagged with: udp
tagged with: channel
answer count: 1
has answer: http://stackoverflow.com/a/25733603
accepted answer: http://stackoverflow.com/a/25733603
has body: I am starting some Java NIO programming, and am building two separate Java programs. One is to create some random data to send by UDP, and the other is to receive this data and perhaps perform some processing on it. In each class, I have defined the SIZE of the data that is to be sent/received, and the number of bytes to send or receive at a time (per packet) at 8 bytes. When I have a SIZE of 1024 bytes, I can turn on the receiver (which by default waits on some packets to arrive), after which I turn on the sender which sends the packets, and the receiver correctly receives these packets and terminates when all packets are received. I then tried to set SIZE to 10 megabytes. I start the receiver, and then start the sender. The sender seems to be working fine and terminates after a few seconds. The receiver starts working and proceeds to read a number of packets (I have put some printlns around the code). However, somewhere in the process, the receiver seems to hang and stops receiving more packets. I do not know where the hanging occurs, except that it happens right after the buffer is cleared for a new read. Perhaps I'm using the library wrongly. Any help is much appreciated. The sender class is called UDPSender as shown below: public class UDPSender { public static void main(String[] args) { try { // Generate some data to send int SIZE=1024*1024*10; int bufferBytes = 8; byte[] b = new byte[SIZE]; new Random().nextBytes(b); String value = new String(b); //System.out.println(value); // Create Datagram channel for sending UDP packets DatagramChannel sendingChannel = DatagramChannel.open(); // Bind the channel to a specific sending socket address and port InetSocketAddress sendSocket = new InetSocketAddress("127.0.0.1", 9999); sendingChannel.socket().bind(sendSocket); //Target socket address InetSocketAddress targetSocket = new InetSocketAddress("127.0.0.1", 8888); //loop to send bufferBytes bytes at a time int location = 0; int bytesSent = 0; long startTime=0; long en…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40216872
tagged with: java
has comment: http://stackoverflow.com/comment/40214987
has title: Java DatagramChannel hangs

http://stackoverflow.com/a/64591962
downvote count: 0
answers question: http://stackoverflow.com/q/25863676
type: Answer
has body: Put this line in your Activity in the Manifest: ... and make sure you didn't put Toolbar in your layout <androidx.appcompat.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" />
upvote count: 1
score: 1

http://stackoverflow.com/q/25764735
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25764858
possible better answer: http://stackoverflow.com/a/25764855
has body: I am currently trying to get a feature working in a Java application I am making, however I'm uncertain how to implement this in a single line. I know that I could do something along the lines of (not exactly, but roughly): while(i&lt;995){ i=i+5 } However I am eager to implement this all into one line, such as in a single static int highestMult = *the equation* I would not be using this specifically for the highest multiple of 5 in 1,000, however upon my own research I could not find a desired solution for this specific case, therefore this is an example. The examples I have previously found all, generally, relate to finding only a highest multiple, not putting together the highest multiple, and a limit. If this is not knowledge from the back of your head, it'd also be a great help just to understand the logic behind how you came up with the solution, it could save me being stuck on similar issues in the future. Thanks,
has answer: http://stackoverflow.com/a/25764855
type: AnsweredQuestion
upvote count: 3
tagged with: math
tagged with: java
tagged with: equation
type: Question
answer count: 2
has title: Sum to determine the largest multiple of 5 under 1,000
has answer: http://stackoverflow.com/a/25764858
score: 3

http://stackoverflow.com/q/25798250
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40370623
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40352309
tagged with: mysql
possible better answer: http://stackoverflow.com/a/43200930
tagged with: eclipse
has answer: http://stackoverflow.com/a/33193390
type: Question
accepted answer: http://stackoverflow.com/a/33193390
has comment: http://stackoverflow.com/comment/40370856
answer count: 3
has title: Ping Failure When Trying To Connect to MySql Databse Using Eclipse
favorite count: 0
has comment: http://stackoverflow.com/comment/40353354
has comment: http://stackoverflow.com/comment/40352470
upvote count: 2
has body: So I am having a problem setting up a new connection within eclipse so that I can convert a current Maven project into a JPA project. I have a MySql database set up and can access it with WinSql. However, I get a ping failure when I try and connect with Eclipse using the New Connection Profile. All of the info is the same in the fields. I have mysql-connector-java-5.1.32-bin.jar added to my build path so I really don't know what else could be the problem. When the ping fails it gives me the following exception: java.lang.Exception: Connection failed with unspecified error. at org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverConnectionBase.java:110) at org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:54) at org.eclipse.datatools.connectivity.drivers.jdbc.JDBCConnection.open(JDBCConnection.java:96) at org.eclipse.datatools.enablement.internal.mysql.connection.JDBCMySQLConnectionFactory.createConnection(JDBCMySQLConnectionFactory.java:28) at org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(ConnectionFactoryProvider.java:83) at org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(ConnectionProfile.java:359) at org.eclipse.datatools.connectivity.ui.PingJob.createTestConnection(PingJob.java:76) at org.eclipse.datatools.connectivity.ui.PingJob.run(PingJob.java:59) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) Any ideas as to what could be causing this? I've looked around for a few hours and see a lot of similar questions but nothing seems to work. One other thing that might be important is that the MySql server is hosted on my universites server so I need to connect through a VPN to access it. I do this with Cisco AnyConnect and have no problems connecting with WinSql.
downvote count: 1
has answer: http://stackoverflow.com/a/51482652
has answer: http://stackoverflow.com/a/43200930

http://stackoverflow.com/a/25870908
answers question: http://stackoverflow.com/q/25870630
type: Answer
has body: To solve your exception you can use the overloaded method of Integer.parseInt using two parameters, then you can define the radix. Change this line: i = Integer.parseInt(iToBinary); To this: i = Integer.parseInt(iToBinary, 2);
score: 0

http://stackoverflow.com/comment/40410500
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25742422
has text: @svick Of course yes, I installed mediawiki and didn't change it.

http://stackoverflow.com/a/25842667
downvote count: 1
score: -1
upvote count: 0
has body: You could use lazy values. Google Guava provides some utilities to do that. e.g. class Foo { private final Spplier&lt;Data&gt; data = Suppliers.memoize(new Supplier&lt;Data&gt;() { public Data get() { // query database here... return data; }; }); public Foo() { } }
answers question: http://stackoverflow.com/q/25830907
type: Answer

http://stackoverflow.com/comment/40324193
has text: @reporter OP prints `student.getId()+"\t"+student.getName()` as response.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25782961
type: Comment

http://stackoverflow.com/comment/40236694
type: AnswerComment
has text: Thank you for the detailed comment. I am using the Joda-Time also. The reason why I am using also java.util.data is that I am using "Timer" class. Timer class is using java.util.Date. The problem is that the time zone of my laptop & server is different. So, I am calculating the time difference by Joda-time. And, then calculate the system date(i.e. java.util.Date). So, I can set up the timer at the correct time on Serverside. Then, the Timer is injected at the correct time from laptop side.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25734931

http://stackoverflow.com/a/25912795
has comment: http://stackoverflow.com/comment/45280245
has comment: http://stackoverflow.com/comment/40562626
type: Answer
has comment: http://stackoverflow.com/comment/40566737
has comment: http://stackoverflow.com/comment/40565810
has body: I'm not sure why you'd want such behavior, but you can kill the app on back press (or on finish). Calling android.os.Process.killProcess(android.os.Process.myPid()) is just like a forcing a stop from the task manager. Add this to your CordovaActivity and it should kill everything without any remains: @Override public void onBackPressed() { android.os.Process.killProcess(android.os.Process.myPid()); System.exit(0); }
answers question: http://stackoverflow.com/q/25868260
downvote count: 0
has comment: http://stackoverflow.com/comment/40567301
has comment: http://stackoverflow.com/comment/40588212
score: 1
has comment: http://stackoverflow.com/comment/40565082
has comment: http://stackoverflow.com/comment/45281365
has comment: http://stackoverflow.com/comment/40792212
upvote count: 1
has comment: http://stackoverflow.com/comment/40565231

http://stackoverflow.com/q/25721266
has body: I have VARCHAR in the database for colors. The format is rrr,ggg,bbb (example 225,225,0). How can I convert that String into java.awt.Color and visualize it in a JSF page?
has answer: http://stackoverflow.com/a/25721483
upvote count: 2
type: UnansweredQuestion
tagged with: oracle-adf
tagged with: java
type: Question
score: 2
has title: String to color
has answer: http://stackoverflow.com/a/25721430
downvote count: 0
tagged with: string
favorite count: 0
tagged with: colors
answer count: 3
has answer: http://stackoverflow.com/a/25721454

http://stackoverflow.com/q/25870095
accepted answer: http://stackoverflow.com/a/25874052
tagged with: postgresql
tagged with: spring-data-jpa
answer count: 1
downvote count: 0
has title: How to combine multiple date-between searches with CrudRepository of Spring Data JPA?
favorite count: 0
score: 8
upvote count: 8
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25874052
tagged with: java
has body: spring-data provides a way to generate SQL search by defining the method name. The following works fine: @Entity public class Book { Date from, to; } //CrudRepository&lt;Book&gt; findByFromDateBetween(Date departure, Date arrival); But why then does the following not work? findByFromDateBetweenAndToDateBetween(Date departure, Date arrival); To connect two date searches, I have to repeat the date: findByFromDateBetweenAndToDateBetween(Date departure, Date arrival, Date departure, Date arrival); Question: is it possible to reuse the params?
type: Question

http://stackoverflow.com/comment/40474178
has text: actually I need to give two options to the user..one to schedule job now..the other to schedule at a later point of time. I started using cron triggers as it gives the flexibility to use listeners and override jobToBeExecuted() method. So I thought If I can use the same trigger with a varying cron expression the It would be good, Or can I use A simple trigger for the job that needs to be executed now, and use another cron trigger for jobs scheduled later?
type: AnswerComment
comment on: http://stackoverflow.com/a/25862966
score: 0
type: Comment

http://stackoverflow.com/comment/40447000
comment on: http://stackoverflow.com/q/25849716
type: QuestionComment
has text: This is the URL: http://localhost:9080/smpaWeb/views/smpaError.jsp,
type: Comment
score: 0

http://stackoverflow.com/a/25823290
has comment: http://stackoverflow.com/comment/40397774
has body: If you want each letter on a line, how about : &lt;string name="infostring"&gt;"A\nB\nC\nD\nE"&lt;/string&gt; But I don't understand what you're trying to achieve here, it looks painful to do. There should be another solution for your bigger problem. To actually make a list of strings, you should check out ListView, which takes care of the scrolling and everything.
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25823125
score: 0
accepted answer of: http://stackoverflow.com/q/25823125
type: Answer
has comment: http://stackoverflow.com/comment/40397810

http://stackoverflow.com/a/25793191
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40343084
answers question: http://stackoverflow.com/q/25793098
has body: If you want primitive int values, do not call IntStream::boxed as that produces Integer objects by boxing. Simply use Random::ints which returns an IntStream: int[] array = new Random().ints(size, lowBound, highBound).toArray();
type: Answer
has comment: http://stackoverflow.com/comment/40343030
has comment: http://stackoverflow.com/comment/40342911
score: 62
upvote count: 62
accepted answer of: http://stackoverflow.com/q/25793098
has comment: http://stackoverflow.com/comment/40343820

http://stackoverflow.com/a/25785403
has comment: http://stackoverflow.com/comment/40329812
has comment: http://stackoverflow.com/comment/40329938
has comment: http://stackoverflow.com/comment/40329780
type: Answer
answers question: http://stackoverflow.com/q/25785026
has comment: http://stackoverflow.com/comment/40329905
has comment: http://stackoverflow.com/comment/40329850
has comment: http://stackoverflow.com/comment/40329651
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25785026
has body: when you use a BufferedReader reader and read your file line by line line = reader.readLine() then your line doesn't contain a line break ('\n' or '\r?\n')... so what will happen? String[] RowData = line.split("\\r?\\n"); the size of this array MUST ALWAYS be 1 and would be the same as the String line so ultimately date = RowData[0]; // equal to line value = RowData[1]; //index out of bounds - line has never been splitted an IndexOutOfBounds-Exception will be thrown here...

http://stackoverflow.com/a/25787096
answers question: http://stackoverflow.com/q/25785783
type: AcceptedAnswer
score: 0
type: Answer
has body: It seems, that you include the worklight-jee-library.jar in your WAR and in the shared resources folder. So either remove it from your WAR or the shared resources folder. This is the solution.
accepted answer of: http://stackoverflow.com/q/25785783

http://stackoverflow.com/comment/40199112
type: Comment
type: QuestionComment
has text: While you probably can, you would have to run any builds on other servers.
comment on: http://stackoverflow.com/q/25715145
score: 0

http://stackoverflow.com/a/25723904
type: Answer
downvote count: 0
has body: User accounts and permissions are stored on MongoDB (in the database system, to be precise). This means in order to authenticate, your application must connect to the database.
score: 1
has comment: http://stackoverflow.com/comment/40215422
has comment: http://stackoverflow.com/comment/40215171
accepted answer of: http://stackoverflow.com/q/25723369
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25723369

http://stackoverflow.com/a/25844172
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25843527
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25843527
has body: This can be easily solved by creating array of raw type: Tree&lt;String&gt;[] newChildrenArray = new Tree[newChildren.size()]; newChildrenArray.toArray(newChildren); myTree.addChildren(newChildrenArray);

http://stackoverflow.com/comment/74821208
comment on: http://stackoverflow.com/a/25862357
score: 0
type: AnswerComment
has text: This solved my problem after 4 hours of looking for why my tomcat sometimes imported the application.yml and sometimes not: `If spring.config.location contains directories (as opposed to files) they should end in / (and will be appended with the names generated from spring.config.name before being loaded). `
type: Comment

http://stackoverflow.com/q/25713336
favorite count: 0
tagged with: javafx-2
type: AnsweredQuestion
has title: How do you add a tick to javafx?
downvote count: 0
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25713361
tagged with: javafx
has comment: http://stackoverflow.com/comment/40195599
type: Question
has body: I was wondering how to add a tick to javafx. By tick i mean a repetitive thread that updates the scene. I have tried an normal thread but I keep getting error that is is not the application thread. I would like it to start in the initialize method here is a heavily simplified version of my MainContol class: package application; import java.net.URL; import java.util.ResourceBundle; import javafx.fxml.Initializable; public class MainControl implements Initializable{ public void initialize(URL arg0, ResourceBundle arg1) { // Tick goes here } }
has answer: http://stackoverflow.com/a/25713361
possible better answer: http://stackoverflow.com/a/25772731
has answer: http://stackoverflow.com/a/25772731
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/40195471
tagged with: initialization

http://stackoverflow.com/a/25825064
upvote count: 3
answers question: http://stackoverflow.com/q/25825028
type: Answer
has comment: http://stackoverflow.com/comment/40400771
score: 3
downvote count: 0
has body: How about making the constructor private? class A implements iA { public int returnNum() { return 10; } private A(){} public static iA getInstance(){ return new A(); } }
has comment: http://stackoverflow.com/comment/40402555
has comment: http://stackoverflow.com/comment/40402418
has comment: http://stackoverflow.com/comment/40400752

http://stackoverflow.com/a/25720323
has body: Your method: .replace("\\d{2}", ""); will fail to work because in Java String#replace doesn't take a regex. Try String#replaceAll OR String#replaceFirst You can use: String number = cursor.getString(col_number).replace(" ", "").replaceFirst("\\+\\d{2}", "0");
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40208725
answers question: http://stackoverflow.com/q/25720282
downvote count: 0

http://stackoverflow.com/q/25843064
type: UnansweredQuestion
tagged with: jprogressbar
tagged with: record
has answer: http://stackoverflow.com/a/25843499
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40434419
has title: How to show record from database into TextArea in java line by line
has comment: http://stackoverflow.com/comment/40434344
score: 0
tagged with: textarea
has comment: http://stackoverflow.com/comment/40434262
answer count: 1
has comment: http://stackoverflow.com/comment/40434452
has body: i want to show record from database line by line into TextArea. i tried this: String sql = "SELECT COUNT(*) FROM tweet"; ResultSet rs=stmt.executeQuery(sql); int row = 0; while(rs.next()){ row = rs.getInt("COUNT(*)"); } jTextField2.setText("" + row); jProgressBar1.setMaximum(row); jProgressBar1.setStringPainted(true); for(int i=1;i&lt;row;i++){ String sql1 = "SELECT tweet,date,location FROM tweet WHERE tweet_id='"+i+"'"; ResultSet rs2 = stmt.executeQuery(sql1); String tweet = ""; String date = ""; String location = ""; while(rs2.next()){ tweet = rs2.getString("tweet"); date = rs2.getString("date"); location = rs2.getString("location"); } jTextArea1.append(i + ") " + tweet + "\n" ); jProgressBar1.setValue(i); number++; } but it gives me output once all the process finished, help me. i want to show output execution line by line instead of all together. and how to use progress bar?
tagged with: jframe

http://stackoverflow.com/comment/40420143
comment on: http://stackoverflow.com/q/25835577
has text: You are failing to call `super.paintComponent(g)` too, in the overridden function. Moreover, there is no size defined for the extended `JPanel`.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/25853827
type: Answer
has comment: http://stackoverflow.com/comment/40475083
score: 1
has comment: http://stackoverflow.com/comment/40516694
upvote count: 2
downvote count: 1
answers question: http://stackoverflow.com/q/25850328
has body: I would argue first-off that Serializable and Cloneable are bad examples of marker interfaces. Sure, they're interfaces with methods, but they imply methods, such as writeObject(ObjectOutputStream). (The compiler will create a writeObject(ObjectOutputStream) method for you if you don't override it, and all objects already have clone(), but the compiler will again create a real clone() method for you but with caveats. Both of these are weird edge cases that really aren't good design examples.) Marker interfaces are generally used for one of two purposes: 1) As a shortcut to avoid an excessively long type, which can happen with lots of generics. For instance, say you have this method signature: public void doSomething(Foobar&lt;String, Map&lt;String, SomethingElse&lt;Integer, Long&gt;&gt;&gt;) { ... } That's messy and annoying to type, and more importantly, difficult to understand. Consider this instead: public interface Widget extends Foobar&lt;String, Map&lt;String, SomethingElse&lt;Integer, Long&gt;&gt;&gt; { } Then your method looks like this: public void doSomething(Widget widget) { ... } Not only is it clearer, but you can now Javadoc the Widget interface, and it's also easier to search for all occurrences in your code of Widget. 2) Marker interfaces can also be used as a way around Java's lack of intersection types. With a marker interface, you can require something to be of two different types, such as in a method signature. Say you have some interface Widget in your application, like we described above. If you have a method that requires a Widget that also happens to let you iterate over it (it's contrived, but work with me here), your only good solution is to create a marker interface that extends both interfaces: public interface IterableWidget extends Iterable&lt;String&gt;, Widget { } And in your code: public void doSomething(IterableWidget widget) { for (String s : widget) { ... } }

http://stackoverflow.com/comment/40401727
has text: Thank you sir, i found the answer using simpledateformat
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25825525
type: AnswerComment

http://stackoverflow.com/q/25725273
tagged with: bitmap
has answer: http://stackoverflow.com/a/25725703
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40217842
upvote count: 0
has answer: http://stackoverflow.com/a/25757730
score: -1
has comment: http://stackoverflow.com/comment/40278269
has comment: http://stackoverflow.com/comment/40217956
has answer: http://stackoverflow.com/a/25757928
has comment: http://stackoverflow.com/comment/40218000
answer count: 3
favorite count: 0
has body: My app is like a photo Album. In every activity is one picture and I can go from one activtiy to the next over a button. The pictures I use are 640x480 and not bigger than 150KB. But very often the app stops working because of an OutOfMemory-Error. Probably are the Bitmaps too large. What do I have to add into my code to add large Bitmaps efficently? Momentarily I even didn't define the Bitmaps in my Java-Code. They are only in XML-Code. I probably have to write s.th in my Java-Code. But what? package com.example.xxx; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; public class PictureOne extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.pictureone);} public void Picture0 (View view){ Intent i = new Intent(this, PageZero.class); startActivity(i);}} public void Picture2 (View view){ Intent i = new Intent(this, PageTwo.class); startActivity(i);}} XML-Code: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="200dp" android:layout_height="200dp" android:layout_centerInParent="true" android:layout_marginLeft="14dp" android:src="@drawable/pic1" /&gt; &lt;ImageView android:id="@+id/imageView4" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:src="@drawable/left" android:onClick="Picture0"/&gt; &lt;ImageView android:id="@+id/imageView4" android:layout_width="100dp" android:layout_height="100dp" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:src="@drawable/right" android:onClick="Picture2"/&gt; &lt;/RelativeLayout&gt;
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40217820
has title: Eclipse Android; Bitmap to large: OutOfMemory?

http://stackoverflow.com/q/25774066
tagged with: java
has title: error: package org.picketlink.idm.internal does not exist
score: 0
answer count: 1
type: UnansweredQuestion
has body: I changed my pom.xml to add picktlink-social so I changed my pom to remove picketlink-deltaspike, and addeda apache deltaspike because I had some redundancy issues with picktlink detlaspike, and for a while my app worked. So every once in a while when I did a mvn clean, I got this error ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project unikaimagen: Compilation failure: Compilation failure: [ERROR] /home/jdc/git/unikaimagen/src/main/java/ec/com/unikaimagen/init/IDMConfiguration.java:[33,34] error: package org.picketlink.idm.internal does not exist [ERROR] /home/jdc/git/unikaimagen/src/main/java/ec/com/unikaimagen/init/IDMConfiguration.java:[35,30] error: package org.picketlink.internal does not exist [ERROR] /home/jdc/git/unikaimagen/src/main/java/ec/com/unikaimagen/init/IDMConfiguration.java:[70,9] error: cannot find symbol [ERROR] symbol: class EEJPAContextInitializer [ERROR] location: class IDMConfiguration [ERROR] /home/jdc/git/unikaimagen/src/main/java/ec/com/unikaimagen/init/IDMConfiguration.java:[33,34] error: package org.picketlink.idm.internal does not exist [ERROR] /home/jdc/git/unikaimagen/src/main/java/ec/com/unikaimagen/init/IDMConfiguration.java:[35,30] error: package org.picketlink.internal does not exist [ERROR] /home/jdc/git/unikaimagen/src/main/java/ec/com/unikaimagen/init/IDMConfiguration.java:[70,9] error: cannot find symbol [ERROR] symbol: class EEJPAContextInitializer [ERROR] location: class IDMConfiguration [ERROR] /home/jdc/git/unikaimagen/src/main/java/ec/com/unikaimagen/init/IDMConfiguration.java:[110,25] error: cannot find symbol [ERROR] -&gt; [Help 1] So I changed the version of picketlink from 2.6.1 to 2.6.0 or 2.6.0 to 2.6.1 and it compiled again. But now that is not even working, This is my pom.xml http://pastebin.com/9bRMrGkv. org.picketlink.internal should be in picketlink-impl module, which is included in my pom.xml This is my IDMConfiguration.java http://pastebin.…
has answer: http://stackoverflow.com/a/26063125
tagged with: maven
type: Question

http://stackoverflow.com/comment/40284538
has text: BTW I am following this: http://stackoverflow.com/questions/21358466/gradle-to-execute-java-class-without-modifying-build-gradle If it works there why not for me?
type: QuestionComment
comment on: http://stackoverflow.com/q/25761283
score: 0
type: Comment

http://stackoverflow.com/a/25735009
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25734874
downvote count: 0
has body: Take a moment to think about your logic... Basically, you want to loop while currentNode is not null AND anObject is not equal to currentNode.data. When either of of those conditions become true, you want to exit the loop For example... int position = 0; Node currentNode = firstNode; while (currentNode != null &amp;&amp; !anObject.equals(currentNode.data)) { position++; currentNode = currentNode.next; } return currentNode == null ? -1 : position; Note, there are other ways to achieve it this, but this was just what popped into my head...

http://stackoverflow.com/a/25938029
type: Answer
downvote count: 0
score: 1
has body: In line 3 Collections.sort takes a list as parameter and compareTo(object o) is executed by the objects of the list taking as argument other objects of the list. In line 2 name is the atribute name of the object who executes the method. When you call collections.sort(lt) compareTo(Object o) is used to do the orderig and is executed by several objects of the list taking other objects of the list as arguments, it depends of the shorting algoritm that collections.sort() uses. For example in a list l with only two objects calling collections.sort(l) will make compareTo(Object o) be executed by one object taking the other as argument and the list will be in order. Bigger list will require more calls. collections.sort() acepts one parameter a list or a list and a Comparator.
accepted answer of: http://stackoverflow.com/q/25782687
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25782687

http://stackoverflow.com/q/25866582
favorite count: 0
has body: Is there a way to get the shuffle time required from each reduce task from the client side using the Hadoop API (Hadoop 1.2.1). I can get the execution time of the reduce tasks from the JobClient using the getReduceTaskReports(JobID jobID) method, but I wonder is there a way to get the percentage that corresponds to the shuffle time. Thanks in advance.
has comment: http://stackoverflow.com/comment/40598275
upvote count: 3
type: UnansweredQuestion
has title: Hadoop: Measuring shuffle time from JAVA
score: 3
tagged with: java
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/40476641
downvote count: 0
has comment: http://stackoverflow.com/comment/40476569
answer count: 1
has answer: http://stackoverflow.com/a/26040126

http://stackoverflow.com/comment/40420241
type: QuestionComment
has text: What sorting are you talking about?
comment on: http://stackoverflow.com/q/25835607
score: 0
type: Comment

http://stackoverflow.com/q/25782057
tagged with: dictionary
tagged with: collections
downvote count: 1
type: AnsweredQuestion
score: 3
accepted answer: http://stackoverflow.com/a/25782163
tagged with: java
tagged with: treemap
type: Question
upvote count: 4
possible better answer: http://stackoverflow.com/a/25782175
tagged with: hashmap
has answer: http://stackoverflow.com/a/25782175
has answer: http://stackoverflow.com/a/64614738
has answer: http://stackoverflow.com/a/25782149
has body: I have just started implementing data structures in Java and was wondering can we have a situation like this. Map&lt;HashMap&lt;String,String&gt;,String&gt; map = new HashMap&lt;HashMap&lt;String,String&gt;,String&gt;(); And if yes ,, please give a small example. If you don't found question relevant ,, please mention in comments,
has answer: http://stackoverflow.com/a/25782163
answer count: 4
favorite count: 0
has title: can we have a nested map as key within other map?

http://stackoverflow.com/a/25760352
accepted answer of: http://stackoverflow.com/q/25760025
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40284032
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25760025
has body: I agree all of the above solutions should work, however instead of using plain Servlets, why not using HttpClient libraries from Apache which make fairly simple to upload and download files ? There is even a library written on the top of HttpClient which is named Awake file which is opensource and allows secure upload and download of documents from Java Desktop applications and Android clients as well. Hope it helps

http://stackoverflow.com/q/25761438
tagged with: bufferedimage
type: AnsweredQuestion
tagged with: java
has body: I'm getting an integer value for the pixel in an image using this method: int colour = img.getRGB(x, y); Then I'm printing out the values and I see that black pixels correspond to a value like "-16777216", a kind of blue to something like "-16755216", etc. Can someone please explain me the logic behind this value?
tagged with: image-processing
tagged with: rgb
type: Question
upvote count: 53
has comment: http://stackoverflow.com/comment/102511057
downvote count: 0
has answer: http://stackoverflow.com/a/25761567
has answer: http://stackoverflow.com/a/25761579
score: 53
tagged with: colors
possible better answer: http://stackoverflow.com/a/25761560
has answer: http://stackoverflow.com/a/25761560
favorite count: 0
has title: Understanding BufferedImage.getRGB output values
accepted answer: http://stackoverflow.com/a/25761567
answer count: 5
has answer: http://stackoverflow.com/a/25761702
has answer: http://stackoverflow.com/a/25761598

http://stackoverflow.com/q/25765101
upvote count: 1
tagged with: business-objects
type: Question
has answer: http://stackoverflow.com/a/25765853
possible better answer: http://stackoverflow.com/a/25765861
tagged with: java
tagged with: javadoc
has answer: http://stackoverflow.com/a/25765861
tagged with: business-objects-sdk
answer count: 2
downvote count: 0
score: 1
has title: Where can I get the javadoc for the Crystal Reports java API
accepted answer: http://stackoverflow.com/a/25765853
favorite count: 0
has body: I'm working with objects such as the IReportAppFactory,ISessionMgr,IEnterpriseSession, IInfoStore, IReport and others from cecore.jar, celib.jar, ceplugins.jar, cesession.jar and rasapp.jar, but there is no Javadoc attached. I have tried scouring the internet for them to no avail. Any links for the Javadoc? Thanks!
tagged with: crystal-reports
type: AnsweredQuestion

http://stackoverflow.com/q/25718508
tagged with: apache
answer count: 1
has title: Getting an error when giving command like "mvn install"
score: 0
has answer: http://stackoverflow.com/a/25719306
type: UnansweredQuestion
tagged with: maven
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40205203
has body: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (unpack-xsd-files) on project jointIndustryJava: Either artifact or artifactItems is required -&gt; [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.8:unpack (unpack-xsd-files) on project jointIndustryJava: Either artifact or artifactItems is required at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.L…
has comment: http://stackoverflow.com/comment/40205898

http://stackoverflow.com/comment/40304142
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25769543
has text: So i have a `List<Socket> clients = new ArrayList<Socket>();` and after the `Socket client = server.accept` a `clients.add(client);` But what to do next? Do i have to put a for loop anywhere in the Handler?

http://stackoverflow.com/comment/40397839
comment on: http://stackoverflow.com/q/25823378
score: 1
has text: Or java 1.8 is java v8.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40286968
has text: "life cycles of intents" that makes no sense what-so-ever. Sorry. An Intent is just a data object that stores information that the Framework uses to launch components. There's no such thing as life-cycle on it.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25762200

http://stackoverflow.com/comment/40402712
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25826047
has text: Did you try doing a dry run on above piece of code?

http://stackoverflow.com/q/25823145
answer count: 0
has comment: http://stackoverflow.com/comment/40399438
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40397590
has title: java game development restricted number randomly objects
type: Question
tagged with: object
tagged with: project
score: 0
tagged with: random
has comment: http://stackoverflow.com/comment/40397506
has body: Im creating a game. I need to create objects randomly but i want them to come in a certain number. Here is my main class code for randomly created object private void randomTiles() { int randomXtile = new Random().nextInt(9500) + 20; int randomYtile = new Random().nextInt(12) + 0; Tile t = new Tile(randomXtile, randomYtile, 3); tilearray.add(t); } private void updateTiles() { randomTiles(); for (int i = 0; i &lt; tilearray.size(); i++) { Tile t = (Tile) tilearray.get(i); t.update(); } } private void paintTiles(Graphics g) { for (int i = 0; i &lt; tilearray.size(); i++) { Tile t = (Tile) tilearray.get(i); g.drawImage(t.getTileImage(), t.getTileX(), t.getTileY(), this); } } tile constructor is public Tile(int x, int y, int typeInt) { tileX = x * 40; tileY = y * 40; type = typeInt; r = new Rectangle(); if (type == 5) { tileImage = StartingClass.tiledirt; } else if (type == 8) { tileImage = StartingClass.tilegrassTop; } else if (type == 4) { tileImage = StartingClass.tilegrassLeft; } else if (type == 6) { tileImage = StartingClass.tilegrassRight; } else if (type == 2) { tileImage = StartingClass.tilegrassBot; } else if (type == 3) { tileImage = StartingClass.ice; hp = 2; } else { type = 0; } } and somewhere in my game object should come at certain coordinates. Can you help me about this ?
has comment: http://stackoverflow.com/comment/40397866

http://stackoverflow.com/q/25856139
has answer: http://stackoverflow.com/a/25856321
tagged with: java
has comment: http://stackoverflow.com/comment/40469575
has answer: http://stackoverflow.com/a/25856361
accepted answer: http://stackoverflow.com/a/25856361
has comment: http://stackoverflow.com/comment/40458163
score: 12
type: Question
has comment: http://stackoverflow.com/comment/58740901
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/40460997
has comment: http://stackoverflow.com/comment/40463328
favorite count: 0
has comment: http://stackoverflow.com/comment/40485108
duplicate of: http://stackoverflow.com/q/3954616
upvote count: 14
has comment: http://stackoverflow.com/comment/40457598
has title: Is there a java look and feel based on the flat design concept?
has comment: http://stackoverflow.com/comment/40492190
has comment: http://stackoverflow.com/comment/40485230
tagged with: look-and-feel
linked to: http://stackoverflow.com/q/3954616
tagged with: swing
has comment: http://stackoverflow.com/comment/40457861
has comment: http://stackoverflow.com/comment/40460771
linked to: http://stackoverflow.com/q/25721354
possible better answer: http://stackoverflow.com/a/25856321
type: AnsweredQuestion
has body: I have 5 java systems for engineering whose UI were developed using Swing. We started the development of these systems about 10 years ago and they have about 300K lines of code each. All these systems are in production environment. One question that bother us about the UI of these systems is that they look old when compared with large available UIs of cell phones, tablets and web sites. What do cell phones, tablets and web sites UI have in common ? Their look is based on the flat design concept. So, we´re starting a research to find low cost alternatives to give to our systems a modern look oriented to flat design. The first option we thought was to search a java L&amp;F that is implemented based in the flat design concept. But We did not find one. Does anyone knows if there is a java look and feel based, specifically, on the flat design concept ? Best regards, Cláudio.

http://stackoverflow.com/q/25766445
favorite count: 0
tagged with: ear
score: 1
tagged with: module
has body: Is it possible to load an added module at run-time? I have added an optional module to my EAR, I started JBoss and I added the optional module at run-time using CLI. To load that module though I had to restart JBoss which is not what I am looking for. Is there a way to load it without restart using JBoss CLI?
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/25766638
tagged with: java
tagged with: jboss
has title: JBoss - Loading a new module at runtime
type: Question
tagged with: runtime
answer count: 1
downvote count: 0

http://stackoverflow.com/a/25751211
has comment: http://stackoverflow.com/comment/40266186
has body: You are currently using StringUtils#join(T...). You seem to want to use StringUtils#join(double[], char). Simply change your " " to a ' '.
accepted answer of: http://stackoverflow.com/q/25751073
type: Answer
answers question: http://stackoverflow.com/q/25751073
downvote count: 0
score: 5
has comment: http://stackoverflow.com/comment/40266158
type: AcceptedAnswer
upvote count: 5

http://stackoverflow.com/comment/40352309
type: QuestionComment
has text: You have not shown the important bits, specifically how you have configured Eclipse's connection profile. Also have you verified that you can telnet to port 3306 and get a connection?
comment on: http://stackoverflow.com/q/25798250
score: 0
type: Comment

http://stackoverflow.com/a/25865743
has comment: http://stackoverflow.com/comment/40477073
upvote count: 1
has comment: http://stackoverflow.com/comment/40476382
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40475696
has comment: http://stackoverflow.com/comment/40504497
accepted answer of: http://stackoverflow.com/q/25865686
has comment: http://stackoverflow.com/comment/40476435
answers question: http://stackoverflow.com/q/25865686
type: Answer
has comment: http://stackoverflow.com/comment/40476338
score: 1
has comment: http://stackoverflow.com/comment/40475770
has body: Try to check Boot Completed action in onReceive(.....) like if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { Logs("ON Boot completed with System BroadcastReceiver"); //do your job } and also set &lt;intent-filter&gt; like to your OSBootReceiver in manifest.xml &lt;intent-filter&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;action android:name="android.intent.action.BOOT_COMPLETED" /&gt; &lt;/intent-filter&gt;
has comment: http://stackoverflow.com/comment/40476195
has comment: http://stackoverflow.com/comment/40475842

http://stackoverflow.com/q/25821480
accepted answer: http://stackoverflow.com/a/25821682
score: 2
upvote count: 2
linked to: http://stackoverflow.com/q/25828542
type: AnsweredQuestion
has body: Just a shot in the dark, but do I need a local interface to call a remote stateless EJB? when I try call the bean remotely through Netbeans: Netbeans doesn't allow a remote call, or any call, on this bean. Why not? Trying to do it manually, as below: What is the jndi global remote name for the Remote EJB which is deployed on glassfish? INFO: visiting unvisited references INFO: visiting unvisited references INFO: EJB5181:Portable JNDI names for EJB MyRemoteSessionClass: [java:global/RemoteSalutation-ejb/MyRemoteSessionClass!net.bounceme.dur.glassfish.MyRemoteSession, java:global/RemoteSalutation-ejb/MyRemoteSessionClass] INFO: RemoteSalutation-ejb was successfully deployed in 941 milliseconds. If possible, I would rather specify the class in the properties file rather than hard-coded. In any event, different variations result in a lookup failure. Here's the stack-trace: run-deploy: Copying 1 file to /home/thufir/NetBeansProjects/RemoteLookup/dist Copying 2 files to /home/thufir/NetBeansProjects/RemoteLookup/dist/RemoteLookupClient Warning: /home/thufir/NetBeansProjects/RemoteLookup/dist/gfdeploy/RemoteLookup does not exist. Sep 13, 2014 1:35:41 AM net.bounceme.dur.remote.RemoteLookup run INFO: java.naming.factory.initial com.sun.enterprise.naming.impl.SerialInitContextFactory Sep 13, 2014 1:35:41 AM net.bounceme.dur.remote.RemoteLookup run INFO: java.naming.factory.url.pkgs com.sun.enterprise.naming Sep 13, 2014 1:35:41 AM net.bounceme.dur.remote.RemoteLookup run INFO: java.naming.factory.state com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl Sep 13, 2014 1:35:46 AM net.bounceme.dur.remote.RemoteLookup main SEVERE: Lookup failed for ' java:comp/env//RemoteSalutation-ejb/MyRemoteSessionClass!net/bounceme/dur/glassfish/MyRemoteSession' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, remote=net.bounceme.ix.Foo, org.omg.CORBA.ORBInitialHost=localhost, java.naming.security.principal=user, org.omg.CORB…
has title: selected bean is not in the same module or enterprise application
tagged with: jndi
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25821682
tagged with: ejb
answer count: 1
downvote count: 0
tagged with: glassfish
favorite count: 0
tagged with: remote-execution

http://stackoverflow.com/a/25729585
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25728317
type: Answer
has body: How about ExpectedException#expectMessage? @Rule ExpectedException expectedException = ExpectedException.none(); @Test public void yourTest() { // One overload takes a string to test "contains". expectedException.expectMessage("foo"); // The other takes a Hamcrest matcher. startsWith is a Hamcrest core matcher. expectedException.expectMessage(startsWith("Bar")); // If you include the latest Hamcrest source, you can use the brand-new // MatchesPattern matcher, which is the regex solution you're looking for. expectedException.expectMessage(new MatchesPattern( new Pattern("Baz.+\[[0-9]+\]"))); systemUnderTest.doExceptionThrowingCode(); } See the documentation for StartsWith, or the new code (17 days old!) for MatchesPattern.
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25728317

easymock
tags question: http://stackoverflow.com/q/25848460
tag name: easymock
type: Tag

http://stackoverflow.com/q/25757030
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40277303
tagged with: loops
has answer: http://stackoverflow.com/a/25757525
has comment: http://stackoverflow.com/comment/40297919
accepted answer: http://stackoverflow.com/a/25757525
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25757563
has title: Custom String split method in java
score: 0
tagged with: split
answer count: 2
has comment: http://stackoverflow.com/comment/40277022
tagged with: arrays
tagged with: string
has body: I am trying to implement a custom split string method and I am getting lost in for loops. I will post my code so far and hopefully someone can tell me where I am going wrong. I know there are better ways to do this, but I am just wondering why I can't seem to get the for loops to read properly. Basically I want to be able to set multiple delimiters at once. So I was populating a an array of just the delimiters and trying to compare each character in the full string with each entry in the delimiter Array. If it was not a delimiter, it added it to a string, if it was, it broke off the loop and took the string it created and added it to the first entry in the string array. This should continue until the character array was done. Here is my code: String[] charArray = new String[s.length()]; String[] stringArray = new String[s.length()]; String[] delimArray = new String[regex.length()]; // Fill array with delimiter values for (int i=0; i &lt; delimArray.length; i++) { delimArray[i] = Character.toString(regex.charAt(i)); } // Fill array with all values in string by character for (int i=0; i &lt; charArray.length; i++) { charArray[i] = Character.toString(s.charAt(i)); } for (int i=0; i &lt; stringArray.length; i++) { String s1 = ""; for (int k=0; k &lt; charArray.length; k++) { for (int j=0; j &lt; delimArray.length; j++) { if (charArray[k] != delimArray[j]) { s1 = s1 + charArray[k]; } else if (charArray[k] == delimArray[j]) { stringArray[i+1] = delimArray[j]; break; } } s1 = s1 + charArray[k]; } stringArray[i] = s1; }
possible better answer: http://stackoverflow.com/a/25757563

http://stackoverflow.com/a/25808029
score: 25
upvote count: 25
has comment: http://stackoverflow.com/comment/40437865
has body: This has nothing to do with Hibernate. You're missing jandex from your classpath, which is required in Weld 2.2.x. Verify that you end up with a jandex 1.2 jar on your classpath after building. Since you're using maven, add this to your pom.xml: org.jboss jandex 1.2.2.Final Also related: Why is Hibernate 4.2 using jandex and classmate if its Maven POM defines them as test scope?
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25797866
type: Answer
answers question: http://stackoverflow.com/q/25797866

http://stackoverflow.com/q/25798419
type: UnansweredQuestion
type: Question
has title: Provide a user-request when homeButton in actionbar was pressed
tagged with: java
has answer: http://stackoverflow.com/a/27187777
score: 0
answer count: 2
has body: i want to provide a appropriate onUp-Navigation. Like shown in following codesnippet for onBackPressed(), i want to do a request, if the user really want to go back to the parent activity (because data maybe not saved, so i want to warn), when the homebutton in the actionBar was pressed. For onbackPressed it works fine. public void onBackPressed() { // Mal ein anderer Weg für einen Bestätigungs new AlertDialog.Builder(this) .setTitle("Really Exit?") .setMessage("Are you sure you want to exit?") .setNegativeButton(android.R.string.no, null) .setPositiveButton(android.R.string.yes, new OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { NewAndEditActivity.super.onBackPressed(); } }).create().show(); } But when i try to run this: @Override public boolean onNavigateUp() { // TODO Auto-generated method stub // Mal ein anderer Weg für einen Bestätigungs new AlertDialog.Builder(this) .setTitle("Really Exit?") .setMessage("Are you sure you want to exit?") .setNegativeButton(android.R.string.no, null) .setPositiveButton(android.R.string.yes, new OnClickListener() { public void onClick(DialogInterface arg0, int arg1) { NewAndEditActivity.super.onNavigateUp(); } }).create().show(); return false; } The Diaolog is shown shortly, but the process "go back" goes on. Have one of you any idea? Thanks a lot! Edit: I found a solution. Apparently i have to undo teh parent-activity declaration for this activity. after that, no auto-progress occured and i can provide a appropriate user-request.
tagged with: android
has answer: http://stackoverflow.com/a/25799542

http://stackoverflow.com/comment/40238475
comment on: http://stackoverflow.com/q/25735952
score: 0
has text: I was at the interview last week, and I asked the person why do not you use Netbeans? He said that it is not as generic as eclipse. I thought it is good to share this with you :)
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40244491
has text: I havent really tried much. Iam new to regex and i needed help to solve this small problem in my project
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25726637

http://stackoverflow.com/comment/40245688
comment on: http://stackoverflow.com/a/25739973
has text: If your input is in format for example `2014-12-10`,then you should provide format as `yyyy-MM-dd` , if your input is `2014.12.10` format will be `yyyy.MM.dd`, note the capital `MM` for month , `mm` is for minutes
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25825060
has title: How to set not editable JTable cells when JRadioButton is selected?
tagged with: jradiobutton
tagged with: swing
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40434949
tagged with: java
has comment: http://stackoverflow.com/comment/40417500
upvote count: 1
has answer: http://stackoverflow.com/a/25844458
type: Question
has body: I have a JTable with some rows. How can i block edit row just when radiobutton unlock is selected? Below a small project to use as a working example Update ElencoPersoneFrame class package test; import java.awt.*; import java.util.*; import javax.swing.*; public class ElencoPersoneFrame extends JFrame { private PersonaTableModel tableModel; private JTable table; private JScrollPane scrollPane; JRadioButton rdbtnFilm = new JRadioButton("Editable"); JRadioButton rdbtnSerieTv = new JRadioButton("Not editable"); public ElencoPersoneFrame() { super ("Elenco Persone"); setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); setSize(400, 250); ArrayList&lt;Persona&gt; listaPersone = new ArrayList&lt;Persona&gt;(); listaPersone.add(new Persona("Mario", "Rossi", 1972, false)); listaPersone.add(new Persona("Giacomo", "Bianchi", 1946, false)); listaPersone.add(new Persona("Roberto", "Verdi", 1985, true)); tableModel = new PersonaTableModel(listaPersone); table = new JTable(tableModel); scrollPane = new JScrollPane(table); JPanel rdpnl=new radioPanel(); getContentPane().add(rdpnl, BorderLayout.NORTH); getContentPane().add(scrollPane, BorderLayout.CENTER); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { ElencoPersoneFrame f = new ElencoPersoneFrame(); f.setVisible(true); } }); } } Persona class package test; public class Persona { private String nome; private String cognome; private int annoNascita; private boolean disoccupato; /*costruttore*/ public Persona(String nome, String cognome, int annoNascita, boolean disoccupato) { this.nome = nome; this.cognome = cognome; this.annoNascita = annoNascita; this.disoccupato = disoccupato; } public String getNome() { return nome; } public String getCognome() { return cognome; } public int getAnnoNascita() { return annoNascita; } public boolean isDisoccupato() { return disoccupato; } public void setNome(String nome) { this.nome = nome; } public void setCognome(String cognome) { this.cogno…
tagged with: jtable
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/25844458
possible better answer: http://stackoverflow.com/a/25826577
favorite count: 0
has answer: http://stackoverflow.com/a/25826577

http://stackoverflow.com/comment/40393621
score: 0
has text: But now my question is (and it fits the previous comments too): if my code works with `==` (that is the two objects are the same), doesn't that automatically mean also that the two authors or titles values are the same? In short, why in my case it's not the same if I use `equals()` or `==`?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25820612

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/25855517

http://stackoverflow.com/q/25836192
has comment: http://stackoverflow.com/comment/40421488
has comment: http://stackoverflow.com/comment/40421275
has comment: http://stackoverflow.com/comment/40421596
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40421413
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25844066
score: 1
has title: Reduce-Side Join ArrayIndexOutOfBounds Exception using Java
tagged with: java
has comment: http://stackoverflow.com/comment/40421634
tagged with: mapreduce
has comment: http://stackoverflow.com/comment/40421299
has comment: http://stackoverflow.com/comment/40421367
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40421347
favorite count: 0
accepted answer: http://stackoverflow.com/a/25844066
tagged with: exception
has body: trying to run a Reduce Side join on 3 datasets. Unfortunalyy, i keep getting an ArrayIndex exception. I have tried to handle it with a try &amp; Catch, but to no avail. Can someone please recommend a solution? package Joins; import java.io.IOException; import java.util.*; import java.util.Map.Entry; import org.apache.hadoop.io.*; import org.apache.hadoop.mapreduce.Reducer; public class JoinReducer extends Reducer&lt;Text, Text, Text, Text&gt; { Map&lt;String, String&gt; divStkJoin = new HashMap&lt;String, String&gt;(); Map&lt;String, String&gt; divStkMetaJoin = new HashMap&lt;String, String&gt;(); Map&lt;String, String&gt; stockData = new HashMap&lt;String, String&gt;(); Map&lt;String, String&gt; metaData = new HashMap&lt;String, String&gt;(); Map&lt;String, String&gt; divData = new HashMap&lt;String, String&gt;(); Text k = new Text(); Text v = new Text(); public void setup(Context context) { metaData.clear(); divData.clear(); stockData.clear(); divStkJoin.clear(); divStkMetaJoin.clear(); } public void reduce(Text keys, Iterable&lt;Text&gt; values, Context context) { Iterator it = values.iterator(); while(it.hasNext()){ String [] keyLine = keys.toString().split(","); String valueLine = values.toString(); try { if(keyLine[4].equals("_s")) { String keyLineStock = keyLine[0] + "," + keyLine[1] +"," + keyLine[2] + "," + keyLine[3]; stockData.put(keyLineStock, valueLine); } else if(keyLine[4].equals("_d")) { String keyLineDiv = keyLine[0] + "," + keyLine[1] +"," + keyLine[2] + "," + keyLine[3]; divData.put(keyLineDiv, valueLine); } else if (keyLine[1].equals("_m")) { String keyLineMeta = keyLine[0]; metaData.put(keyLineMeta, valueLine); } else return; } catch (ArrayIndexOutOfBoundsException e){return;} } //JOINS for(Entry&lt;String, String&gt; entryStock: stockData.entrySet()) for(Entry&lt;String, String&gt; entryDiv: divData.entrySet()) { if(entryStock.getKey().equals(entryDiv.getKey())) { divStkJoin.put(entryStock.getKey(), entryStock.getValue()+ ","+ entryDiv.getValue…

http://stackoverflow.com/a/25768902
has comment: http://stackoverflow.com/comment/40461526
has body: You can use java.net.HttpURLConnection to send SOAP messages. e.g.: public static void main(String[] args) throws Exception { String xml = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n" + "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\r\n" + " <soap:Body>\r\n" + " \r\n" + " USD \r\n" + " CNY \r\n" + " \r\n" + " </soap:Body>\r\n" + "</soap:Envelope>"; Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("username", "password".toCharArray()); } }); URL url = new URL("http://www.webservicex.net/CurrencyConvertor.asmx"); URLConnection conn = url.openConnection(); conn.setDoOutput(true); conn.setRequestProperty("Content-Type", "text/xml; charset=utf-8"); conn.setRequestProperty("SOAPAction", "http://www.webserviceX.NET/ConversionRate"); // Send the request XML OutputStream outputStream = conn.getOutputStream(); outputStream.write(xml.getBytes()); outputStream.close(); // Read the response XML InputStream inputStream = conn.getInputStream(); Scanner sc = new Scanner(inputStream, "UTF-8"); sc.useDelimiter("\\A"); if (sc.hasNext()) { System.out.print(sc.next()); } sc.close(); inputStream.close(); }
answers question: http://stackoverflow.com/q/25768181
accepted answer of: http://stackoverflow.com/q/25768181
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40336184
has text: This does work for printing these values and it comes perfectly. What I have to pass each row of these 4 values to an sql query for all combinations to find if it exists in the database. How do I do that?(Really new to this).
type: Comment
comment on: http://stackoverflow.com/a/25787524
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40454962
type: QuestionComment
type: Comment
has text: As @JBNizet said, spawn a thread that will send the email indendently so the servlet can return immediately.
score: 0
comment on: http://stackoverflow.com/q/25854077

http://stackoverflow.com/comment/40335927
has text: Yes, you'd mentioned that in your post. But wasn't clear if this was only an internal network redirect or external. If this is for external access, then adding a record on your nameserver will do the trick. If not, then internal DNS will be required and we can go from there.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25789730

http://stackoverflow.com/comment/40487083
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25872055
has text: Why would you need to keep track of the `JPanel`s' name and position when a mapping doesn't require them?

http://stackoverflow.com/q/25849274
type: UnansweredQuestion
tagged with: playframework-2.0
has answer: http://stackoverflow.com/a/25850645
type: Question
has body: I want to test a method that process value of query string. I use Mockito to mock objects. I tried to mock Request object and set its query string but it seems that there's no method to set query string. My question is how to mock query string in Request? Edit: I use Java 8 and Play 2.3
tagged with: java
has answer: http://stackoverflow.com/a/26196808
score: 0
answer count: 2
tagged with: playframework
has title: Mock query string in Play request
tagged with: mockito

http://stackoverflow.com/comment/40345630
type: QuestionComment
has text: So before calling `save` if you inspect the fields of `paper` they are filled? Also try to enable SQL logging (adding `db.default.logStatements=true` and `logger.com.jolbox=DEBUG` to application.conf) so you can see the SQL sttm that is executed
type: Comment
comment on: http://stackoverflow.com/q/25789008
score: 0

http://stackoverflow.com/comment/40211733
type: QuestionComment
has text: You should save the data either in database or standalone class which are being displayed inside ListView then perform filter on that data instead of trying to access the ListView.
type: Comment
comment on: http://stackoverflow.com/q/25721880
score: 0

http://stackoverflow.com/a/43278381
score: 32
upvote count: 32
has comment: http://stackoverflow.com/comment/123913444
has comment: http://stackoverflow.com/comment/75630998
downvote count: 0
has body: Make sure your class is declared as public and not 'default' public class MyClassTest as opposed to: class MyClassTest When creating a new test class via IntelliJ shortcut the generated class was not declared as public and that caused the error.
type: Answer
answers question: http://stackoverflow.com/q/25770563

http://stackoverflow.com/comment/40238858
type: Comment
comment on: http://stackoverflow.com/q/25715610
type: QuestionComment
has text: Do you know of any examples?
score: 0

http://stackoverflow.com/q/25827652
score: 0
tagged with: keypress
answer count: 2
linked to: http://stackoverflow.com/q/17884384
has answer: http://stackoverflow.com/a/25924054
has comment: http://stackoverflow.com/comment/40406124
tagged with: linux
has comment: http://stackoverflow.com/comment/40407529
has comment: http://stackoverflow.com/comment/40414938
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40405656
has comment: http://stackoverflow.com/comment/40405978
accepted answer: http://stackoverflow.com/a/25924054
tagged with: java
has answer: http://stackoverflow.com/a/25835421
has title: java keylistener on linux
has comment: http://stackoverflow.com/comment/40405708
tagged with: swing
linked to: http://stackoverflow.com/q/22741215
type: Question
possible better answer: http://stackoverflow.com/a/25835421
has comment: http://stackoverflow.com/comment/40405741
has body: I'm trying to write a game in java3d on Linux and for that I need a proper KeyListener. Did anyone of you know how to do it? I'm currently using following code, I found somewhere on the net. It's working pretty good, holding down just one key, but as soon, as I press more than one (like space and w) it will do unexpected things... public class RepeatingReleasedEventsFixer implements AWTEventListener { private final HashMap&lt;Integer, ReleasedAction&gt; _map = new HashMap&lt;Integer, ReleasedAction&gt;(); public void install() { Toolkit.getDefaultToolkit().addAWTEventListener(this, AWTEvent.KEY_EVENT_MASK); } public void remove() { Toolkit.getDefaultToolkit().removeAWTEventListener(this); } @Override public void eventDispatched(AWTEvent event) { assert event instanceof KeyEvent : "Shall only listen to KeyEvents, so no other events shall come here"; assert assertEDT(); // REMEMBER THAT THIS IS SINGLE THREADED, so no need for synch. // ?: Is this one of our synthetic RELEASED events? if (event instanceof Reposted) { // -&gt; Yes, so we shalln't process it again. return; } // ?: KEY_TYPED event? (We're only interested in KEY_PRESSED and KEY_RELEASED). if (event.getID() == KeyEvent.KEY_TYPED) { // -&gt; Yes, TYPED, don't process. return; } final KeyEvent keyEvent = (KeyEvent) event; // ?: Is this already consumed? // (Note how events are passed on to all AWTEventListeners even though a previous one consumed it) if (keyEvent.isConsumed()) { return; } // ?: Is this RELEASED? (the problem we're trying to fix!) if (keyEvent.getID() == KeyEvent.KEY_RELEASED) { // -&gt; Yes, so stick in wait /** * Really just wait until "immediately", as the point is that the subsequent PRESSED shall already have been * posted on the event queue, and shall thus be the direct next event no matter which events are posted * afterwards. The code with the ReleasedAction handles if the Timer thread actually fires the action due to * lags, by cancelling the action itself upon the PRESSED. */ final T…
tagged with: keylistener

http://stackoverflow.com/a/25898718
type: Answer
downvote count: 0
score: 1
has body: I think that the main problem is that you want to instantiate your service directly (with new) and not with Spring: MovieService movieService = new MovieServiceImpl(); When you do this, your MovieServiceImpl instance is constructed but not initialised (the field @Autowired MovieDao is null). If you want to instantiate properly your object with field injection, you need to use Spring. As explained in the documentation or in this example, you can automatically detect all your annotated beans and initialize them in your context with the component scanning. Example In your case, using annotiations on (@Component, @Service, etc) and in (@Autowired, @Inject, etc) your beans, your project could look like this: Spring configuration app-context.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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"&gt; &lt;!-- Use component scanning to auto-discover your beans (by annotation) and initialize them --&gt; &lt;context:component-scan base-package="com.se325.a01" /&gt; &lt;!-- No need to declare manually your beans, because beans are auto-discovered thanks to &lt;context:component-scan/&gt; --&gt; &lt;/beans&gt; Entry point of your application App.java package com.se325.a01; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.se325.a01.model.Movie; import com.se325.a01.service.MovieService; public class App { public static void main(String[] args) { // Let's create the Spring context based on your app-context.xml ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"app-context.xml"}); // Now your context is ready. All beans are initialised. // You can retrieve and use your MovieService MovieService movieService = context.getBean("movieS…
answers question: http://stackoverflow.com/q/25839186
accepted answer of: http://stackoverflow.com/q/25839186
type: AcceptedAnswer
upvote count: 1

http://stackoverflow.com/comment/40439862
type: Comment
has text: Hey Young, this is what i am trying now.. JSONObject jsonMain = new JSONObject(jsonString); JSONArray dataArray = jsonMain.getJSONArray("data"); for(int i = 0; i < dataArray.length(); i++) {JSONObject tagObject = dataArray.getJSONObject(i); String mandatory_tag = tagObject.getString("mandatory_tag"); String id = tagObject.getString("id"); if(myMap.containsKey(mandatory_tag)) { List<String> values = myMap.get(mandatory_tag); if (values!=null) {values.add(id); } else { values = new ArrayList<String>(); values.add(id);}}}
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25844043

http://stackoverflow.com/comment/40466537
type: Comment
type: QuestionComment
has text: @user2864740 how do i print text to the screen in an android program?
comment on: http://stackoverflow.com/q/25860893
score: 0

http://stackoverflow.com/a/25730434
upvote count: 2
answers question: http://stackoverflow.com/q/25730288
has body: You don't necessarily need to do anything in the build file to set this up; the build file generates Java .class files, and you can feed them to Java directly from the command line. You can add a main method to any class: package com.example.foo; class MyClass { ... public static void main(String [] args) { ... } } The main method will be happily ignored util you invoke it via the Java command line. You can do this by setting your classpath to the intermediate build directory and telling the Java command line which class to start: java -classpath app/build/intermediates/classes/debug/ com.example.foo.MyClass where you pass in the path to the build/intermediates/classes/debug directory in your app module's build output, and the fully-qualified name of the class. Note that if you're running a release build that uses ProGuard, this main method could get stripped out if it's not otherwise referenced in the code. Make sure you don't access any Android classes or you'll get a runtime error. As an aside, you might find it worthwhile to separate out your Java-only code into a Java-only module in the build. Among other things, it would let you use JUnit to write nice test cases for the classes within; if you're asking this question because you want to do some testing of your parser, you might find it convenient to do so within the auspices of a unit test.
has comment: http://stackoverflow.com/comment/40229171
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25730288

http://stackoverflow.com/comment/40358223
comment on: http://stackoverflow.com/a/25786758
score: 0
type: Comment
has text: hi friend, i checked both types using filters and include jsp but both wont work because i set condition sessioncount>2 but it goes more than 2 but it should redirect to error.jsp know
type: AnswerComment

http://stackoverflow.com/q/25767458
has body: I'm creating a program for my gui number converter. I want my program to ask user a binary string and if he does not enter a binary number, the program will show him error message and will ask him to enter again. The problem is that I can add restriction to alphabets but when it comes to numbers then it fails or it keeps showing the error message. import java.util.*; public class test { Scanner key = new Scanner(System.in); String in; int b; public test(){ do{ System.out.println("Enter the binary string of 5 numbers"); in = key.nextLine(); int i,j; char ch; for (i=0 ; i&lt;=5 ; i++){ b = 0; ch = in.charAt(i); j = ch; if (Character.isDigit(ch) &amp;&amp; ch&lt;=0 &amp;&amp; ch&gt;=1) b = 1; else System.out.println("Please enter a binary number (1 , 0)"); break; //b = 1; } }while(b != 1); int c; c = Integer.parseInt(in); System.out.println("your number is: " + c ); } public static void main (String args[]){ test obj = new test(); } }
has answer: http://stackoverflow.com/a/25767657
favorite count: 0
linked to: http://stackoverflow.com/q/12809914
accepted answer: http://stackoverflow.com/a/25767527
has comment: http://stackoverflow.com/comment/40295789
upvote count: 1
type: AnsweredQuestion
has title: I can't restrict my program to accept only binary numbers
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40295681
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25767527
has answer: http://stackoverflow.com/a/25767565
answer count: 3
possible better answer: http://stackoverflow.com/a/25767657

http://stackoverflow.com/comment/40388855
type: Comment
type: QuestionComment
has text: @Mitvailer yeah exactly. 1+4 and 2+3 would be correct outputs for this case
comment on: http://stackoverflow.com/q/25817980
score: 0

http://stackoverflow.com/a/25733840
score: 0
has body: Reading "not divisible by x or y" as "divisible by neither x nor y": for (int i = 1; i &lt;= n; ++i) { if (i%x!=0 &amp;&amp; i%y!=0) { System.out.println(i); } }
type: Answer
answers question: http://stackoverflow.com/q/25733732

http://stackoverflow.com/q/25837934
downvote count: 0
has answer: http://stackoverflow.com/a/25926198
has title: MatOfPoint to MatOfPoint2f Size Opencv java
has body: I'm working on Java OpenCV project and I want to find the mayor and minor axis of a shape. Im usng fitEllipse method, but Eclipse throws the following error: OpenCV Error: Incorrect size of input array (Number of points should be >= 5) in cvFitEllipse2, file ........\opencv\modules\imgproc\src\shapedescr.cpp, line 799 The size later conversion is 1x1. Why this happen? List&lt;MatOfPoint&gt; contours = new ArrayList&lt;MatOfPoint&gt;(); Imgproc.findContours(sourceImg, contours, new Mat(),Imgproc.RETR_LIST,Imgproc.CHAIN_APPROX_SIMPLE); for(int i=0; i&lt; contours.size();i++){ //Conversion between MatOfPoint to MatOfPoint2f MatOfPoint2f temp=new MatOfPoint2f(contours.get(i).toArray()); RotatedRect elipse1=Imgproc.fitEllipse(temp); }
answer count: 2
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/25926198
has answer: http://stackoverflow.com/a/25838536
accepted answer: http://stackoverflow.com/a/25838536
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: opencv

http://stackoverflow.com/comment/40333354
type: Comment
score: 2
comment on: http://stackoverflow.com/a/25788489
type: AnswerComment
has text: Nice spotting ! Although this would not fix the `FileNotFoundException`

http://stackoverflow.com/comment/40277476
comment on: http://stackoverflow.com/q/25757256
type: Comment
type: QuestionComment
has text: `if(max) func1(a); else func2(a);` can work, but it's not a good style in Java. If you absolutely want it to work, just ignore the `return` values for the two functions
score: 1

http://stackoverflow.com/a/25831114
upvote count: 1
answers question: http://stackoverflow.com/q/25827856
type: Answer
downvote count: 0
score: 1
has body: First method makes the UI thread sleep .This result in stopping of all the functioning and UI interaction of the activity. The second method uses another thread .Since it's the other thread which sleeps all the UI parts of the main UI thread works fine and the code works as intended.

http://stackoverflow.com/comment/40423853
type: QuestionComment
type: Comment
has text: I think I now understand based on what @kapep has said.
score: 1
comment on: http://stackoverflow.com/q/25837419

http://stackoverflow.com/a/25860783
has comment: http://stackoverflow.com/comment/40475026
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 6
has body: A number of significant drawbacks: If you ever want to change the polling frequency (i.e. do it every 2 minutes, or every 10 minutes), you have to change the program. This is especially difficult if you have an irregular polling schedule, something like once every 5 minutes on Monday through Friday, but once every 15 minutes on Saturday and Sunday. Sure, you don't think your program will ever need to do that, but requirements evolve. As you say, killing the process is the only way to stop the program. And killing it in mid-process might be a bad thing. You could of course add some cancel logic, but that's additional development time. The program is occupying memory while it's sitting there doing nothing (most of the time). This is a waste of resources. Probably not a huge deal when you're working with a system that has many gigabytes of memory, but it becomes an issue when you're working on embedded systems with limited memory. You're wasting your time writing your own scheduling, which you then have to debug and maintain, when there's already a perfectly good scheduler built into the operating system. I call this program a "catnap program" because it acts just like a cat: it sleeps most of the time, waking up now and then to stretch and maybe bat a string around for a few minutes, and then goes back to sleep. Programs are not cats.
answers question: http://stackoverflow.com/q/25859178
upvote count: 6
accepted answer of: http://stackoverflow.com/q/25859178

integer
tags question: http://stackoverflow.com/q/25865578
tags question: http://stackoverflow.com/q/25773721
tags question: http://stackoverflow.com/q/25774874
tags question: http://stackoverflow.com/q/25715899
tags question: http://stackoverflow.com/q/25816427
tags question: http://stackoverflow.com/q/25804550
tag name: integer
tags question: http://stackoverflow.com/q/25773422
tags question: http://stackoverflow.com/q/25751376
tags question: http://stackoverflow.com/q/25755821
type: Tag
tags question: http://stackoverflow.com/q/25818998
tags question: http://stackoverflow.com/q/25852163
tags question: http://stackoverflow.com/q/25788266

http://stackoverflow.com/comment/40494170
has text: Thanks for comment. You are right, it's two separate problems and I'm not making it clear enough.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25840173
score: 0

http://stackoverflow.com/q/25786269
has comment: http://stackoverflow.com/comment/40329844
has comment: http://stackoverflow.com/comment/40329834
tagged with: java
tagged with: look-and-feel
accepted answer: http://stackoverflow.com/a/25786522
tagged with: indexoutofboundsexception
has title: Change to Look and Feel of customized JFileChooser raises an exception
has comment: http://stackoverflow.com/comment/40330482
upvote count: 1
has comment: http://stackoverflow.com/comment/40331161
has comment: http://stackoverflow.com/comment/40330710
has comment: http://stackoverflow.com/comment/40330328
tagged with: jfilechooser
has comment: http://stackoverflow.com/comment/40330738
has comment: http://stackoverflow.com/comment/40329706
has comment: http://stackoverflow.com/comment/40337182
has comment: http://stackoverflow.com/comment/40329494
linked to: http://stackoverflow.com/q/25538213
has answer: http://stackoverflow.com/a/25786514
has body: When i open the dialog box through CustomizedJFileChooser. JfileChooser look and Feel not good. so, for look and feel i am adding the code UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); it raise the exception. Here is my code, public class FileChooser extends JFrame { private JPanel contentPane; MyFileChooser jc; public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); FileChooser frame = new FileChooser(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public FileChooser() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); jc = new MyFileChooser(); JButton btnOpen = new JButton("open"); contentPane.add(btnOpen, BorderLayout.NORTH); btnOpen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int returnVal = jc.showOpenDialog(FileChooser.this); } }); pack(); } } class MyFileChooser extends JFileChooser{ public MyFileChooser() { JComboBox comboBox = new JComboBox(); comboBox.setModel(new DefaultComboBoxModel(new String[] { "text", "binary" })); JPanel panel1 = (JPanel)this.getComponent(3); JPanel panel2 = (JPanel) panel1.getComponent(3); Component c1=panel2.getComponent(0); Component c2=panel2.getComponent(1); panel2.removeAll(); panel2.add(new JLabel("Document Name: ")); panel2.add(comboBox); panel2.add(c1); panel2.add(c2); } } Here stack trace of excetpion: java.lang.ArrayIndexOutOfBoundsException: No such child: 3 at java.awt.Container.getComponent(Container.java:327) at MyFileChooser.&lt;init&gt;(FileChooser.java:62) at FileChooser.&lt;init&gt;(FileChooser.java:41) at FileChooser$1.run(FileChooser.java:27) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251) at java.awt.EventQueue.dispatchEve…
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40358503
score: 1
has answer: http://stackoverflow.com/a/25786522
favorite count: 0
possible better answer: http://stackoverflow.com/a/25786514
linked to: http://stackoverflow.com/q/24290210
type: Question
answer count: 2
tagged with: swing

http://stackoverflow.com/comment/40283070
score: 0
has text: Oh. I guess it would be useful if I changed the method to execute a method in the bean it casts to.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25760430

http://stackoverflow.com/q/25846488
has answer: http://stackoverflow.com/a/25852424
has body: What would be the simplest approach to add/customize a tooltip on a JFreeChart DialPlot (in a Java Swing application)? While it is fairly straightforward to customize tooltips on other chart types (e.g. implement CategoryToolTipGenerator for category charts), I couldn't find any documentation on how to achieve this on dial / meter charts. Many thanks for any hint!
accepted answer: http://stackoverflow.com/a/25852424
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40444885
favorite count: 0
has comment: http://stackoverflow.com/comment/40445548
linked to: http://stackoverflow.com/q/16163964
has title: JFreeChart DialPlot tooltip
score: 1
tagged with: java
upvote count: 1
tagged with: swing
tagged with: jfreechart
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/25726636
has body: The problem is that you are referencing a bean without instantiating it. Correct your code this way: NOTE You also have to be sure the jar is deployed in your project binaries.
answers question: http://stackoverflow.com/q/25723473
type: Answer
score: 0

jersey
tags question: http://stackoverflow.com/q/25743108
tags question: http://stackoverflow.com/q/25741636
tags question: http://stackoverflow.com/q/25797650
tags question: http://stackoverflow.com/q/25844646
tags question: http://stackoverflow.com/q/25815829
tags question: http://stackoverflow.com/q/25783364
tags question: http://stackoverflow.com/q/25736819
tags question: http://stackoverflow.com/q/25794516
tags question: http://stackoverflow.com/q/25769531
tags question: http://stackoverflow.com/q/25755130
tags question: http://stackoverflow.com/q/25794258
tags question: http://stackoverflow.com/q/25749472
tag name: jersey
tags question: http://stackoverflow.com/q/25802920
tags question: http://stackoverflow.com/q/25830428
tags question: http://stackoverflow.com/q/25860490
tags question: http://stackoverflow.com/q/25789580
tags question: http://stackoverflow.com/q/25872644
tags question: http://stackoverflow.com/q/25772747
tags question: http://stackoverflow.com/q/25837852
tags question: http://stackoverflow.com/q/25809310
tags question: http://stackoverflow.com/q/25749598
tags question: http://stackoverflow.com/q/25825990
tags question: http://stackoverflow.com/q/25743853
tags question: http://stackoverflow.com/q/25798308
tags question: http://stackoverflow.com/q/25727147
tags question: http://stackoverflow.com/q/25763711
type: Tag
tags question: http://stackoverflow.com/q/25757655
tags question: http://stackoverflow.com/q/25753982
tags question: http://stackoverflow.com/q/25784563

http://stackoverflow.com/comment/40273032
type: Comment
comment on: http://stackoverflow.com/q/25754469
score: 0
has text: @DavidConrad yes it does...maybe I should try to replace those on the C# side with a different character?
type: QuestionComment

http://stackoverflow.com/comment/40334061
has text: @HarshitSyal That is a good approach. Start with the simplest solution and optimise for performance based on specific requirements and measures. Often you might guess what could be a bottleneck later, but often this turns out to be the 5th or 10th biggest bottleneck, and spending more time finding and working on the top one will make more difference.
comment on: http://stackoverflow.com/a/25746479
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/30646144
score: 0
has body: Even JBoss 6 doesn't support websockets out of box. But you can use Atmosphere library to get asynchronous communication on JBoss 6. Check out this link which has list of supported servers. https://github.com/Atmosphere/atmosphere/wiki/Supported-WebServers-and-Browsers Better, upgrade your server version. It's too old.
type: Answer
answers question: http://stackoverflow.com/q/25864762

http://stackoverflow.com/q/25838611
type: UnansweredQuestion
tagged with: swing
tagged with: java
linked to: http://stackoverflow.com/q/3256269
type: Question
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/40427060
has title: Difficulty with implementing a Swing Timer in java
has comment: http://stackoverflow.com/comment/40427737
has answer: http://stackoverflow.com/a/25839676
tagged with: timer
has comment: http://stackoverflow.com/comment/40425998
has body: In this java game, I have an animation class that renders frames from a spritesheet. For the attack specifically, I made a different render method (renderAttack) because I want it to render all 16 frames of the animation, with 30 milliseconds in between each. I was looking into how to do delay the drawImage call, and decided a Swing Timer may be the best option. However, I am having the hardest time putting this in. Here is what I am trying to do, WITHOUT the timer: public class Animation { public void renderAttack(Graphics g, int x, int y, int width, int height) { for(int index = 0; index &lt; 16; index++) { g.drawImage(images[index], x, y, width, height, null); //wait 30ms } } } To wait those 30 ms, I tried using the timer here. And as of now I have this: public class Animation { public void renderAttack(Graphics g, int x, int y, int width, int height) { ActionListener taskPerformer = new ActionListener(); Timer timer = new Timer(30, taskPerformer); timer.start(); } } However, where would this go, and what is the ActionEvent that it takes in? And how can I pass in the index variable? public void actionPerformed(ActionEvent e) { g.drawImage(images[index], x, y, width, height, null); } Hopefully this made any sense...I'll fix it step by step for now.

http://stackoverflow.com/a/25810876
answers question: http://stackoverflow.com/q/25808956
upvote count: 1
has comment: http://stackoverflow.com/comment/40382596
has body: I have such a hashmap but I'm just able to fill 2 rows... You have a problem with your TableModel. Here is an example that uses: Map&lt;Integer, Map&lt;Integer, Object&gt;&gt; data = new HashMap&lt;Integer, HashMap&lt;Integer, Object&gt;&gt;(); as the data storage for the TableModel: import java.awt.*; import java.awt.event.*; import java.util.*; import javax.swing.*; import javax.swing.table.*; public class TableSparse extends JPanel { public TableSparse(int row, int column) { setLayout( new BorderLayout() ); TableModel model = new SparseTableModel(row, column); JTable table = new JTable(model); table.setAutoResizeMode( JTable.AUTO_RESIZE_OFF ); JScrollPane scrollPane = new JScrollPane( table ); add( scrollPane ); model.setValueAt("one", 0, 0); model.setValueAt("two", 5, 5); } class SparseTableModel extends AbstractTableModel { Map&lt;Integer, Map&lt;Integer, Object&gt;&gt; data = new HashMap&lt;Integer, Map&lt;Integer, Object&gt;&gt;(); int rows; int columns; public SparseTableModel(int rows, int columns) { this.rows = rows; this.columns = columns; } @Override public int getRowCount() { return rows; } @Override public int getColumnCount() { return columns; } @Override public boolean isCellEditable(int row, int column) { return true; } @Override public Object getValueAt(int row, int column) { // Check for row Integer key = new Integer(row); Map&lt;Integer, Object&gt; rows = data.get(key); if (rows == null) return null; // Now check for column key = new Integer(column); return rows.get(key); } @Override public void setValueAt(Object value, int row, int column) { // Remove cell data if (value.toString().equals("")) { removeCellData(row, column); return; } // Save cell data Integer key = new Integer(row); Map&lt;Integer, Object&gt; rows = data.get(key); if (rows == null) { rows = new HashMap&lt;Integer, Object&gt;(); data.put(key, rows); } key = new Integer(column); rows.put(key, value); } private void removeCellData(int row, int column) { Integer rowKey = new Integer…
type: AcceptedAnswer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40384763
accepted answer of: http://stackoverflow.com/q/25808956
type: Answer

http://stackoverflow.com/a/25813398
has comment: http://stackoverflow.com/comment/70419260
answers question: http://stackoverflow.com/q/25798200
has comment: http://stackoverflow.com/comment/40380177
has comment: http://stackoverflow.com/comment/40386828
type: Answer
has comment: http://stackoverflow.com/comment/40379950
has comment: http://stackoverflow.com/comment/40379433
upvote count: 34
has comment: http://stackoverflow.com/comment/87884004
has comment: http://stackoverflow.com/comment/40391148
has comment: http://stackoverflow.com/comment/40381346
has comment: http://stackoverflow.com/comment/40390899
has body: EDIT: Here's a slightly better version of the same idea as below that will playback directly as you record AudioFormat format = new AudioFormat(8000.0f, 16, 1, true, true); TargetDataLine microphone; SourceDataLine speakers; try { microphone = AudioSystem.getTargetDataLine(format); DataLine.Info info = new DataLine.Info(TargetDataLine.class, format); microphone = (TargetDataLine) AudioSystem.getLine(info); microphone.open(format); ByteArrayOutputStream out = new ByteArrayOutputStream(); int numBytesRead; int CHUNK_SIZE = 1024; byte[] data = new byte[microphone.getBufferSize() / 5]; microphone.start(); int bytesRead = 0; DataLine.Info dataLineInfo = new DataLine.Info(SourceDataLine.class, format); speakers = (SourceDataLine) AudioSystem.getLine(dataLineInfo); speakers.open(format); speakers.start(); while (bytesRead &lt; 100000) { numBytesRead = microphone.read(data, 0, CHUNK_SIZE); bytesRead += numBytesRead; // write the mic data to a stream for use later out.write(data, 0, numBytesRead); // write mic data to stream for immediate playback speakers.write(data, 0, numBytesRead); } speakers.drain(); speakers.close(); microphone.close(); } catch (LineUnavailableException e) { e.printStackTrace(); } Bear with me because this is really rough, but it gets the recorded audio playing through speakers; In order to make it sound better, you will need to add threads, and optimize the input/output streams. http://www.developer.com/java/other/article.php/1579071/Java-Sound-Getting-Started-Part-2-Capture-Using-Specified-Mixer.htm package audio; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.TargetDataLine; public class…
score: 34
has comment: http://stackoverflow.com/comment/40390886
accepted answer of: http://stackoverflow.com/q/25798200
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/69665117
downvote count: 0
has comment: http://stackoverflow.com/comment/87883618
has comment: http://stackoverflow.com/comment/69669009
has comment: http://stackoverflow.com/comment/40402428

http://stackoverflow.com/comment/40474628
type: Comment
score: 0
has text: @M.Deinum yeah I've noticed and updated the thread but this is not the issue the actual code uses CreateUserRequest (updated above) without any annotations.
comment on: http://stackoverflow.com/q/25863782
type: QuestionComment

http://stackoverflow.com/comment/40215223
has text: Thanks for the reply Vignesh. I have added the xml in my project.if it is wrong,where should I add the XML file?
comment on: http://stackoverflow.com/q/25723459
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40265009
type: QuestionComment
has text: 64bit Amazon Linux 2014.03 v1.0.2 running Tomcat 7 Java 7
comment on: http://stackoverflow.com/q/25744217
score: 0
type: Comment

http://stackoverflow.com/a/25715829
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25715653
accepted answer of: http://stackoverflow.com/q/25715653
type: AcceptedAnswer
downvote count: 0
has body: The \d* matches zero(!) or more digits, that's why it returns an empty string as a match at 0 and 1, it the matches 34 at position 2 and an empty string again at position 4 and 5. At that point what is left to match against is an empty string. And this empty string also matches \d* (because an empty string contains zero digits), that's why there is another match at position 6. To contrast this try using \d+ (which matches one or more digits) as the pattern and see what happens then.
type: Answer

http://stackoverflow.com/q/25723096
upvote count: 0
score: -1
has title: The second do while loop in this code. I need somebody to explain what it is actually doing in more simple terms
has comment: http://stackoverflow.com/comment/40213525
has comment: http://stackoverflow.com/comment/40213558
has body: The second do while loop in this code: do { ignore = (char) System.in.read(); } while(ignore != '\n'); I cannot comprehend what it actually does. All I understand is that when I take it out and run the program and guess an incorrect letter, program will print out 3 lines of the text "Guess letter now". Why does it do that 3 times without that code in place. What does that code even do? So I am confused and just cannot work it out. public class GuessChar { public static void main(String args[]) throws java.io.IOException { char ch ,ignore, answer = 'k'; do { System.out.println("Guess the letter now"); ch = (char) System.in.read(); do { ignore = (char) System.in.read(); } while(ignore != '\n'); if(ch == answer) System.out.println("WELL DONE"); } while(ch != answer); } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/25723757
has comment: http://stackoverflow.com/comment/40213614
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25723280
tagged with: java
has answer: http://stackoverflow.com/a/25723280
downvote count: 1
type: Question
tagged with: do-while
answer count: 2
has answer: http://stackoverflow.com/a/25723757

http://stackoverflow.com/q/25757969
type: Question
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25758067
has comment: http://stackoverflow.com/comment/40278751
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/40278632
type: UnansweredQuestion
has body: This is my code: for (int i = 0; i &lt; s1.length(); i++) { if (!Character.isDigit(s1.charAt(i))) if (!(s1.charAt(i) == '.')) { JOptionPane.showMessageDialog(null, "You must enter a number"); System.exit(0); } This code detects all characters except digits or ".". If it detects any other character it will tell you "you must enter a number" and then close. Now my question is: If I write two decimal points like 2.2.3 it will not detect the error. My second question: How can I make my program to detect three decimal places and show a message.
downvote count: 1
has title: Counting decimal "points" and decimal places
has comment: http://stackoverflow.com/comment/40278656
tagged with: java

http://stackoverflow.com/comment/40203717
score: 0
type: Comment
type: QuestionComment
has text: @user3316794 It looks like you have initialized the array correctly as you are not getting ArrayIndexOutOfBoundException. Check your deal() method in mydeck.deal() . Is it returning a valid BlackJackCard object or is it returning a null reference which I believe is the cause of NPE
comment on: http://stackoverflow.com/q/25717421

http://stackoverflow.com/comment/40401032
comment on: http://stackoverflow.com/a/25824214
type: Comment
has text: Also, originally I had myArray1.length; in the outer loop. You changed it to myArray1[i].length; - why did you make that change? I did it and I am getting an ArrayIndexOutOfBoundsException.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25827300
has answer: http://stackoverflow.com/a/25827350
favorite count: 0
tagged with: readline
has title: Bufferedreader readLine () take infinite input...WHY?
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40405027
score: -2
tagged with: java
type: Question
answer count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/25827861
tagged with: bufferedreader
has body: why my bufferedreader readLine() method take infinite input how to solve this prolbem...if anybody find any error in program.....welcome for response import java.io.*; import java.util.*; public class average { public static void main(String[] args){ int j,sum=0,count=0; String[] input=null; System.out.println("Enter the number of test cases"); Scanner in=new Scanner(System.in); int t=Integer.parseInt(in.nextLine()); System.out.println(t); System.out.println("Enter the number of contestent and there score"); BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); try { String line = stdin.readLine(); System.out.print('\n'); while (line != null &amp;&amp; line.length()!= 0 ) input = line.split(" "); } catch (IOException e) { System.out.println("Something wrong happend try again"+e); } for(int i=1;i&lt;=input.length;i++) sum+=Integer.parseInt(input[i]); System.out.println(sum); int avg=sum/(Integer.parseInt(input[0])); for (int i=1;i&lt;=input.length;i++) { if(Integer.parseInt(input[i])==avg) count++; } System.out.println("The number of contestent who got average marks is"+count ); } }

permutation
tags question: http://stackoverflow.com/q/25782608
tags question: http://stackoverflow.com/q/25831939
tag name: permutation
tags question: http://stackoverflow.com/q/25789477
type: Tag
tags question: http://stackoverflow.com/q/25820073
tags question: http://stackoverflow.com/q/25854054

http://stackoverflow.com/comment/40405491
type: Comment
type: QuestionComment
has text: I don't see that you can do anything except reduce the size of your object. The reset() method only helps if you're writing multiple objects.
comment on: http://stackoverflow.com/q/25827299
score: 0

http://stackoverflow.com/q/25865910
type: AnsweredQuestion
score: 2
tagged with: java
has body: I'm using a ThreadPoolExecutor in some code, and I supply it with a BlockingQueue&lt;Runnable&gt;. I get a compiler error saying can't resolve constructor. So I tried casting queue explicitly to BlockingQueue&lt;Runnable&gt;. However, I'm getting a compiler error by the ThreadPoolExecutor's constructor: Inconvertible types, cannot cast PriorityBlockingQueue&lt;MyRunnable&gt; to BlockingQueue&lt;Runnable&gt; This is happening even though PriorityBlockingQueue implements BlockingQueue and MyRunnable implements Runnable. I'm using Java 7 on Android. Code: public class Test { PriorityBlockingQueue&lt;MyRunnable&gt; queue = new PriorityBlockingQueue&lt;&gt;(...); //compiler error without cast ThreadPoolExecutor executor = new ThreadPoolExecutor(..., queue, ...); //compiler error with cast ThreadPoolExecutor executor = new ThreadPoolExecutor(..., (BlockingQueue&lt;Runnable&gt; queue, ...); public static class MyRunnable implements Runnable {...} Temporary Solution: In order to get it to compile, I've changed the cast to (BlockingQueue), but I get a unchecked case warning (which I suppressed). I know that I can make queue a BlockingQueue&lt;Runnable&gt; but then I have to cast in a bunch of places throughout my code which I'd rather not do. Is there something that I'm missing, or is the unchecked warning my best shot.
has comment: http://stackoverflow.com/comment/40475267
type: Question
tagged with: casting
downvote count: 0
has answer: http://stackoverflow.com/a/25866066
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/25866066
has title: Java BlockingQueue<Runnable> Inconvertible Types
tagged with: polymorphism
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/40410380
comment on: http://stackoverflow.com/a/25830202
score: 0
type: Comment
has text: @Yk26: You're running different code in DrJava. Check which file you're using, save, and recompile.
type: AnswerComment

http://stackoverflow.com/comment/40266982
has text: Please remove that point,related to floating point as time will be bounded and won't ever be something like `0.333...`... I already mentioned that your answer seems correct,but floating point condition doesn't suit this question.
comment on: http://stackoverflow.com/a/25751446
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40301437
comment on: http://stackoverflow.com/a/25770354
has text: I've tried implementing your suggestion as reflected in the original question now. My didRangeBeaconsInRegion() is never called. Did I do something wrong or am I missing something?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25834516
type: Question
has comment: http://stackoverflow.com/comment/40432096
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25842080
has comment: http://stackoverflow.com/comment/40421727
accepted answer: http://stackoverflow.com/a/25842080
has title: Formatting issues in View - Vaadin
tagged with: vaadin7
type: AnsweredQuestion
has body: I have created a view as below: The menu Layout or the left vertical layout does not have the entire Layout filled in Blue color. Its only Blue till the respective Buttons are present. I need to have the entire Menu Layout in Blue Color and retain the Buttons in same position as it is now. So, to achieve it I uncommented the below code in the view menuLayout.setSizeFull(); But the entire menu layout becomes very bad to look as below. please see the below snapshot Could someone please help on this? The code used is as below: public class AppointmentView extends CustomComponent implements View,Button.ClickListener { private static final long serialVersionUID = 1L; public static final String NAME = "Appointment"; private VerticalLayout mainLayout = new VerticalLayout(); private VerticalLayout upperSection = new VerticalLayout(); private HorizontalSplitPanel lowerSection = new HorizontalSplitPanel(); private VerticalLayout menuLayout = new VerticalLayout(); private VerticalLayout contentLayout = new VerticalLayout(); private Button newContact = new NativeButton("Add contact"); private Button search = new NativeButton("Search"); private Button share = new NativeButton("Share"); private Button help = new NativeButton("Help"); private NavigationTree tree = new NavigationTree(); public AppointmentView() { setSizeFull(); upperSection.addComponent(new Label("")); menuLayout.addComponent(new Label("")); contentLayout.addComponent(new Label("")); menuLayout.setSpacing(true); //menuLayout.setSizeFull(); menuLayout.setStyleName(Reindeer.LAYOUT_BLUE); lowerSection.addComponent(menuLayout); lowerSection.addComponent(contentLayout); lowerSection.setSizeFull(); upperSection.setStyleName(Reindeer.LAYOUT_BLUE); upperSection.addComponent(createToolbar()); lowerSection.setSplitPosition(30); menuLayout.addComponent(createVerticalToolbar()); mainLayout.addComponent(upperSection); mainLayout.addComponent(lowerSection); mainLayout.setSizeFull(); mainLayout.setExpandRatio(lowerSection, 1); se…
tagged with: java
tagged with: vaadin

http://stackoverflow.com/comment/40402955
type: AnswerComment
score: 0
type: Comment
has text: hi aeshang i hope you will find out, how to fix this issue.
comment on: http://stackoverflow.com/a/25826017

google-app-engine
tags question: http://stackoverflow.com/q/25823633
tags question: http://stackoverflow.com/q/25835576
tag name: google-app-engine
tags question: http://stackoverflow.com/q/25787324
tags question: http://stackoverflow.com/q/25826330
type: Tag
tags question: http://stackoverflow.com/q/25821403
tags question: http://stackoverflow.com/q/25801440
tags question: http://stackoverflow.com/q/25809076
tags question: http://stackoverflow.com/q/25796777
tags question: http://stackoverflow.com/q/25756862
tags question: http://stackoverflow.com/q/25756955
tags question: http://stackoverflow.com/q/25716711
tags question: http://stackoverflow.com/q/25725281
tags question: http://stackoverflow.com/q/25824421
tags question: http://stackoverflow.com/q/25754522
tags question: http://stackoverflow.com/q/25746419
tags question: http://stackoverflow.com/q/25783381
tags question: http://stackoverflow.com/q/25872497
tags question: http://stackoverflow.com/q/25838405
tags question: http://stackoverflow.com/q/25871244
tags question: http://stackoverflow.com/q/25833295
tags question: http://stackoverflow.com/q/25734278
tags question: http://stackoverflow.com/q/25842362
tags question: http://stackoverflow.com/q/25758283
tags question: http://stackoverflow.com/q/25725996
tags question: http://stackoverflow.com/q/25718191
tags question: http://stackoverflow.com/q/25792398
tags question: http://stackoverflow.com/q/25764104
tags question: http://stackoverflow.com/q/25733005
tags question: http://stackoverflow.com/q/25748095
tags question: http://stackoverflow.com/q/25790563
tags question: http://stackoverflow.com/q/25739638
tags question: http://stackoverflow.com/q/25716611
tags question: http://stackoverflow.com/q/25777129
tags question: http://stackoverflow.com/q/25827493
tags question: http://stackoverflow.com/q/25803917
tags question: http://stackoverflow.com/q/25723446

http://stackoverflow.com/comment/40237014
has text: @casting: We are not getting any errors before this. This is the error we get: 14:31:46,394 [ACTIVE] ExecuteThread: '26' for queue: 'weblogic.kernel.Default (self-tuning)' ERROR - SQLException Caught: Connection has been administratively disabled. Try later. 14:31:48,231 [ACTIVE] ExecuteThread: '23' for queue: 'weblogic.kernel.Default (self-tuning)' ERROR Exception getting Current Date of database: Connection has been administratively destroyed. Reconnect.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25717234

code-duplication
tag name: code-duplication
tags question: http://stackoverflow.com/q/25720548
type: Tag

http://stackoverflow.com/a/25823292
answers question: http://stackoverflow.com/q/25809293
type: Answer
score: 0
has body: For my NoThree game, I print the timer as follows: gameTime += delta; float minutes = (float)Math.floor(gameTime / 60.0f); float seconds = gameTime - minutes * 60.0f; labelTime.setText(String.format("%.0fm%.0fs", minutes, seconds)); I think it works pretty nicely.

http://stackoverflow.com/a/25949732
type: Answer
answers question: http://stackoverflow.com/q/25872468
has body: Your json structure is not good but below code will handle it. (Your json structure is bad because it should return a json object when it has one item but it returns an array. Also it should return an array when there are more then one order items but it returns different objects for items.) String orders = "[{\"order_items\":[{\"product_id\":\"1\",\"title\":\"product_1\"}]},{\"order_items\":{\"0\":{\"product_id\":\"2\",\"title\":\"product_2\"},\"1\":{\"product_id\":\"3\",\"title\":\"product_3\"}}}]"; JsonArray baseJsonArray = new JsonParser().parse(orders).getAsJsonArray(); Gson gson = new Gson(); if (baseJsonArray != null &amp;&amp; baseJsonArray.size() &gt; 0) { List&lt;OrderItem&gt; orderItemList = new ArrayList&lt;OrderItem&gt;(); for (JsonElement jsonElement : baseJsonArray) { JsonElement ordersJsonElement = ((JsonObject) jsonElement).get("order_items"); if (ordersJsonElement instanceof JsonArray) { JsonArray orderItemsJsonArray = (JsonArray) ordersJsonElement; for (JsonElement orderItemJsonObject : orderItemsJsonArray) { OrderItem orderItem = gson.fromJson(orderItemJsonObject, OrderItem.class); orderItemList.add(orderItem); } } else if (ordersJsonElement instanceof JsonObject) { JsonObject orderItemJsonObject = (JsonObject) ordersJsonElement; int jsonTag = 0; while (true) { JsonElement orderItemJsonElement = orderItemJsonObject.get(String.valueOf(jsonTag)); if (orderItemJsonElement == null) { break; } else { OrderItem orderItem = gson.fromJson(orderItemJsonElement, OrderItem.class); orderItemList.add(orderItem); } jsonTag++; } } } OrderItem pojo class: static class OrderItem { String product_id, title, quantity, product_picture; }
score: 0

http://stackoverflow.com/q/25837010
has answer: http://stackoverflow.com/a/25838176
tagged with: playframework
has title: play framework- how to send post request using java code in play framework
has comment: http://stackoverflow.com/comment/40424831
answer count: 1
has body: Currently I'm switching to play framework to develop but I'm new to this wonderful framework. I just want to send a post request to remote server and get response. If I use Jersey, it would be quite easy, just like this: WebResource resource = client.resource("http://myfirstUrl"); resource.addFilter(new LoggingFilter()); Form form = new Form(); form.add("grant_type", "authorization_code"); form.add("client_id", "myclientId"); form.add("client_secret", "mysecret"); form.add("code", "mycode"); form.add("redirect_uri", "http://mysecondUrl"); String msg = resource.accept(MediaType.APPLICATION_JSON).post(String.class, form); and then I can get the msg which is what I want. But in Play framework, I cannot find any libs to send such post request. I believe this should be a very simple feature and Play should have integrated it. I've tried to search and found most use case are about the Form in view leve. Could anyone give me some help or examples? Thanks in advance!
accepted answer: http://stackoverflow.com/a/25838176
favorite count: 0
downvote count: 1
type: AnsweredQuestion
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40422978
type: Question
upvote count: 4

http://stackoverflow.com/a/25737947
answers question: http://stackoverflow.com/q/25737778
score: 0
has body: You could try something like this. public static void main(String[] arraycard1,String[] arraycard2,String[] arraycard3) { String[] arraycard1 = {"1","open","red","diamond"}; String[] arraycard2 ={"1","solid","green","diamond"}; String[] arraycard3 ={"1","open","purple","oval"}; System.out.println("Is array 1 equal to array 2?? " +Arrays.equals(arraycard1, arraycard2)); System.out.println("Is array 1 equal to array 3?? " +Arrays.equals(arraycard1, arraycard3)); System.out.println("Is array 2 equal to array 3?? " +Arrays.equals(arraycard2, arraycard3)); } RESULT Is array 1 equal to array 2?? false Is array 1 equal to array 3?? false Is array 2 equal to array 3?? false
type: Answer

http://stackoverflow.com/a/26545640
upvote count: 2
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25868484
accepted answer of: http://stackoverflow.com/q/25868484
has body: By "Default metric", I assume you are indicating OS specific metrics like cpu steal time, memory free, memory used, etc. These metrics are enabled by default in ganglia while you are done with ganglia installation. Now, from my level of experience, I have learned that HBASE emits all related metrics directly to the server on which gmetad is installed. Yes, it is true that these hbase related metrics are not first delivered to the gmond installed on the same machine. This is true for hadoop based metrics also. Note: ganglia-server is the FQDN of the machine on which gmetad is installed. To be more precise, gmond installed on the ganglia-server never asks or digs any specific metric from Hbase. gmond of ganglia-server just sits and keep listening to the default port 8649 and collect whatever metrics arrive. It could be sent by hbase, hadoop or gmond installed on any remote server. So, from the ganglia side, one is helpless to be selective on such metrics. Graphs are built by rrdtool for whatever metrics are collected by gmond on ganglia-server. So, one may assume that metrics could be chosen by configuring from the source where it is emitted. HBase is the source here. But, unfortunately, as far as I have known, this could not be changed. You can simply enable hbase related metrics by inserting following lines in the file "hadoop-metrics2-hbase.properties", which is found in "conf" directory under the HBASE_HOME directory: *.sink.ganglia.class=org.apache.hadoop.metrics2.sink.ganglia.GangliaSink31 *.sink.ganglia.period=10 hbase.sink.ganglia.period=10 hbase.sink.ganglia.servers=ganglia-server:8649 Note: Restart hbase after changing hadoop-metrics2-hbase.properties. Please note that this has been tested with hbase version 0.98.7. I Hope it helps you.
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/40199031
type: Comment
has text: No, careful with the definition of _reachable_. [`A reachable object is any object that can be accessed in any potential continuing computation from any live thread.`](http://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.6.1) After `tempFile.file`, the object referenced by `tempFile` is no longer reachable by any computation in the code above.
comment on: http://stackoverflow.com/a/25715110
type: AnswerComment
score: 0

http://stackoverflow.com/q/25781789
upvote count: 1
possible better answer: http://stackoverflow.com/a/26032113
tagged with: java
has comment: http://stackoverflow.com/comment/40774510
has comment: http://stackoverflow.com/comment/40774496
tagged with: mobile
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27417908
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40555351
favorite count: 0
has comment: http://stackoverflow.com/comment/40781764
type: Question
has title: android activity not showing in only main activity and not showing properly
tagged with: android
has comment: http://stackoverflow.com/comment/40774558
accepted answer: http://stackoverflow.com/a/27417908
has answer: http://stackoverflow.com/a/26032113
has body: action bar not showing in main activity while the same code present for another activity and another thing action bar overflow not showing by list in right corner image 1 : main activity with menu key pressed image 2 : show message activity code for main activity: public class MainActivity extends ActionBarActivity { EditText t; public final static String sendMessageextra="com.example.example2.textmessage"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); t=(EditText) findViewById(R.id.textmessage); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.activity_main_actions, menu); return super.onCreateOptionsMenu(menu); } public void sendMessage(View v){ Intent sendmessageintent=new Intent(this,showMessage.class); String messagestring=t.getText().toString(); sendmessageintent.putExtra(sendMessageextra, messagestring); startActivity(sendmessageintent); } } show message activity: public class showMessage extends Activity{ TextView t; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.sendmessage); t=(TextView) findViewById(R.id.showmessage); showmessage(); } @Override public boolean onCreateOptionsMenu(Menu menu) { super.onCreateOptionsMenu(menu); MenuInflater inflater=getMenuInflater(); inflater.inflate(R.menu.activity_main_actions, menu); return true; } public void showmessage(){ Intent intent=getIntent(); String message=intent.getStringExtra(MainActivity.sendMessageextra); t.setText(message); Log.i("Set New Text Box", "Text BOx"); } } activity main actions.xml: <?xml version="1.0" encoding="utf-8"?> <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" android:showAsAction="ifRoom" android:actionViewClass="android.widget.SearchView"/> <item android:id="@+id/action_location_found" android:icon="@drawable/…
answer count: 2

http://stackoverflow.com/q/25724252
has comment: http://stackoverflow.com/comment/40215904
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25724465
has comment: http://stackoverflow.com/comment/40215740
tagged with: java
linked to: http://stackoverflow.com/q/7925698
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40217038
score: 0
answer count: 1
has title: Is there a way to retrieve information from the camera on an android device?
favorite count: 0
has answer: http://stackoverflow.com/a/25724465
tagged with: android
has body: What I'm wondering is if I snap a picture of an analog gauge is there a way I can get the camera to pull information about the position of the needles on the gauge? Take an analog alarm clock for instance. If I wanted to snap a picture of the clock and based on the position of the hour and minute hands receive a digital time where would I start? If anyone has any information on this subject or can point me in a direction that would be excellent.
upvote count: 1

http://stackoverflow.com/q/25840811
has title: how to create and save edittext from alert?
score: 0
answer count: 2
has body: I am still trying to learn java android so I am sure this is easy but I am trying to save the text from an alert started from an onclicklistener using the edit text to rename a button (tabButton). Do I have to create a seperate layout or will this work? I am getting an error at final EditText input = new EditText(this); Like I said I am still learning so a good explanation is appreciated. Here is my src so far. public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Tab buttons controlled final Button getTabButton = (Button) findViewById(R.id.tab1); final AlertDialog.Builder alert = new AlertDialog.Builder(this); getTabButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // Tab1 button was clicked. alert.setTitle("Title"); alert.setMessage("Message"); // Set an EditText view to get user input final EditText input = new EditText(this); alert.setView(input); alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { Editable tabname = input.getText(); // Do something with value! tabname = } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { // Canceled. } }); alert.show(); } }); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
tagged with: android
has answer: http://stackoverflow.com/a/25840863
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25840942
tagged with: java
type: Question

http://stackoverflow.com/comment/40508225
has text: i am getting an error on executing this `Missing or invalid array index expression. At line:1 char:108 + $CpuValue = ((Get-Counter "\Process($ProcessName)\% Processor Time").CounterSamples.CookedValue)/$CpuCores[ <<<< Deci mal]::Round($CpuValue, 3) + CategoryInfo : ParserError: ([:String) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : MissingArrayIndexExpression` can you pls help me here
comment on: http://stackoverflow.com/a/25876108
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40358654
has text: @MartinFrank what do you mean here?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25801706
score: 0

http://stackoverflow.com/q/25755503
has comment: http://stackoverflow.com/comment/40274486
upvote count: 1
answer count: 1
has body: I have recieved the following error while trying to run my application: Unable to start activity ComponentInfo - Binary XML file line #8: Error inflating class Below is the logcat message: 09-10 00:07:18.029: E/AndroidRuntime(2591): FATAL EXCEPTION: main 09-10 00:07:18.029: E/AndroidRuntime(2591): Process: com.dooba.beta, PID: 2591 09-10 00:07:18.029: E/AndroidRuntime(2591): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.dooba.beta/com.dooba.beta.matchOptionActivity}: android.view.InflateException: Binary XML file line #8: Error inflating class &lt;unknown&gt; 09-10 00:07:18.029: E/AndroidRuntime(2591): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 09-10 00:07:18.029: E/AndroidRuntime(2591): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 09-10 00:07:18.029: E/AndroidRuntime(2591): at android.app.ActivityThread.access$800(ActivityThread.java:135) 09-10 00:07:18.029: E/AndroidRuntime(2591): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 09-10 00:07:18.029: E/AndroidRuntime(2591): at android.os.Handler.dispatchMessage(Handler.java:102) 09-10 00:07:18.029: E/AndroidRuntime(2591): at android.os.Looper.loop(Looper.java:136) 09-10 00:07:18.029: E/AndroidRuntime(2591): at android.app.ActivityThread.main(ActivityThread.java:5017) 09-10 00:07:18.029: E/AndroidRuntime(2591): at java.lang.reflect.Method.invokeNative(Native Method) 09-10 00:07:18.029: E/AndroidRuntime(2591): at java.lang.reflect.Method.invoke(Method.java:515) 09-10 00:07:18.029: E/AndroidRuntime(2591): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 09-10 00:07:18.029: E/AndroidRuntime(2591): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 09-10 00:07:18.029: E/AndroidRuntime(2591): at dalvik.system.NativeStart.main(Native Method) 09-10 00:07:18.029: E/AndroidRuntime(2591): Caused by: android.view.InflateException: Binary XML file line #8: Error inflati…
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40274465
favorite count: 0
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/40274426
has comment: http://stackoverflow.com/comment/40274448
tagged with: android
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has title: Unable to start activity ComponentInfo - Binary XML file line #8: Error inflating class <unknown>
has answer: http://stackoverflow.com/a/25755754
type: Question
has comment: http://stackoverflow.com/comment/40277210
has comment: http://stackoverflow.com/comment/40274564
tagged with: android-layout

http://stackoverflow.com/q/25850950
upvote count: 2
has title: Spring Framework under high load with @Async methods
answer count: 1
favorite count: 0
tagged with: spring
tagged with: asynchronous
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/25851727
type: Question
tagged with: java
has body: I am building highly available &amp; scalable web application. It will also handle quite significant load. The question is, how @Async methods work in Spring Framework? I am planning to use@Async method for the logging ( send the logs to some external logging server ). And I wonder how the system will behave if a lot of threads ( ie users ) will start to call these methods? As far as I understand Spring takes pre-created threads from the thread's executor. But what happen, if there are only 3 threads, but 1000 simultaneous users? Will @Async method be blocked, unless some thread become available and start doing the job? Or the "job" will be placed in queue and the main thread will continue to run as expected? Any help will be highly appreciated.
has answer: http://stackoverflow.com/a/25851727

http://stackoverflow.com/q/25866309
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40476130
accepted answer: http://stackoverflow.com/a/25867208
downvote count: 1
type: Question
tagged with: math
has body: Is there any way to find out if a given set points can form a regular polygon?I,e suppose i have 6 points i want to find out if these points can form a regular hexagon Thanks in advance for any help
answer count: 1
has title: Find if a set of points can form a regular polygon or not?
has comment: http://stackoverflow.com/comment/40476994
favorite count: 0
has answer: http://stackoverflow.com/a/25867208
upvote count: 2
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40476955
has comment: http://stackoverflow.com/comment/40476751

http://stackoverflow.com/comment/40465829
has text: can you give me the pathway. as in. res>android>images>res-long-hdpi or res>res-long-hdpi
score: 0
comment on: http://stackoverflow.com/a/25854109
type: Comment
type: AnswerComment

http://stackoverflow.com/a/25734304
upvote count: 1
has body: Might you be looking at something like a logger? enabling this (for Java) or this (for Python) might be a good solution for you. It logs to your console in the devserver, or directly to your admin console in production
downvote count: 0
has comment: http://stackoverflow.com/comment/40239443
type: Answer
answers question: http://stackoverflow.com/q/25734278
score: 1

http://stackoverflow.com/comment/40328137
comment on: http://stackoverflow.com/q/25784606
type: Comment
has text: hello pri , please share your code we can see what is your approach when you are populating table , why do you need to space between results ?
type: QuestionComment
score: 0

http://stackoverflow.com/q/25755446
has answer: http://stackoverflow.com/a/25755670
tagged with: java
type: AnsweredQuestion
favorite count: 0
accepted answer: http://stackoverflow.com/a/25755670
type: Question
has title: Query on usage of this variable in Recursion
score: 10
upvote count: 11
answer count: 1
downvote count: 1
tagged with: recursion
has body: After calling method, node.nth(5) in below code, public class List_Node { int item; List_Node next; public List_Node() { this.item = 0; this.next = null; } public List_Node(int item, List_Node next) { this.item = item; this.next = next; } public List_Node(int item) { this(item, null); } public void insertAfter(int item) { this.next = new List_Node(item, this.next); } public List_Node nth(int position) { if (position == 1) { return this; } else if((position &lt; 1) || (this.next == null)) { /* error checking */ return null; } else { return this.next.nth(position - 1); } } public static void main(String[] args){ List_Node node = new List_Node(0); List_Node temp = node; for (int item = 1; item &lt; 5; item++) { temp.insertAfter(item); temp = temp.next; } System.out.println(node.nth(5).item); } } Below is the stack frame that I can imagine for nth() method after 4 recursive calls. My question: As per the above diagram, Assuming the instance of being in activation record S5 with value of pos as 1, I would like to understand, What happens, when java executes return this? Does java assign the value of this in S5 as value of this in S4? Because there is no assignment statement (as such) in else{} block of nth() method. Note: Please ignore Java coding style, as am new learner.

http://stackoverflow.com/a/25829114
has comment: http://stackoverflow.com/comment/43043107
has body: It looks like there is some stale data in the p2 repository cache of Eclipse/STS. I would recommend to do the following: make sure that you have the 4.4-based update site of STS only (among the Eclipse Luna one), but not another STS update site for a different Eclipse version. go to the main STS directory and delete the content of "p2/org.eclipse.equinox.p2.repository/cache" while STS is NOT running. restart This should remove the stale data and you should be able to continue with STS updates (to 3.6.1, for example).
has comment: http://stackoverflow.com/comment/43055219
type: Answer
has comment: http://stackoverflow.com/comment/77931551
downvote count: 0
score: 16
answers question: http://stackoverflow.com/q/25824902
upvote count: 16

http://stackoverflow.com/comment/40360326
comment on: http://stackoverflow.com/q/25760491
type: Comment
has text: @RainerSchwarze I'll take a note about this, thank you. For OpenOffice format I don't have such problem.
score: 0
type: QuestionComment

http://stackoverflow.com/q/25845530
has comment: http://stackoverflow.com/comment/40459377
score: 0
answer count: 2
tagged with: sftp
has body: I have a query with respect to SFTP. I have used sftp for a file transfer functionality (in a java scheduler program). The program would transfer a file from one location to other remote location using sftp. All the files are getting transferred successfully except files with name contains asterisk in it. Asterisk is considered as wildcard characters in sftp. But, is there a way to configure sftp so that it would accept * and transfer file with name contains asterisk in it? Any help would be appreciable. Note: I have used com.zehon.sftp.SFTP API as the SFTP client. I have used the following method from this api: public static int sendFile(java.lang.String localFilePath, java.lang.String sftpDestFolder, java.lang.String serverName, java.lang.String username, java.lang.String password) throws FileTransferException Thanks Marshal
possible better answer: http://stackoverflow.com/a/25845764
has comment: http://stackoverflow.com/comment/40439911
has title: SFTP failed to process file with name contains asterisk
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25914986
accepted answer: http://stackoverflow.com/a/25914986
has answer: http://stackoverflow.com/a/25845764
tagged with: java
has comment: http://stackoverflow.com/comment/40534029
type: Question
has comment: http://stackoverflow.com/comment/40445682
has comment: http://stackoverflow.com/comment/40440352

http://stackoverflow.com/q/25851905
has body: I am begine use Vaadin 7. I want use easy way to create many entity forms and tables via Vaadin 7. And my question is Have code package com; import com.vaadin.addon.jpacontainer.JPAContainer; import com.vaadin.addon.jpacontainer.JPAContainerFactory; import com.vaadin.data.fieldgroup.FieldGroup; import com.vaadin.server.VaadinRequest; import com.vaadin.ui.*; public class TestVaadinApplication extends UI { @Override protected void init(VaadinRequest request) { VerticalLayout tableLayout = new VerticalLayout(); final Table table = new Table("table with data from JPAContainer"); final JPAContainer&lt;UserEntity&gt; userDataSource = JPAContainerFactory.makeJndi(UserEntity.class); table.setContainerDataSource(userDataSource); table.setSizeFull(); tableLayout.addComponent(table); tableLayout.addComponent(new Button("add user entity", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { final Window editEntityWindow = new Window(); editEntityWindow.setModal(true); editEntityWindow.setClosable(true); final FieldGroup fieldGroup = new FieldGroup(userDataSource.createEntityItem(new UserEntity())); FormLayout formLayout = new FormLayout(); formLayout.addComponent(fieldGroup.buildAndBind("nameCaption", "name")); formLayout.addComponent(fieldGroup.buildAndBind("loginCaption", "login")); formLayout.addComponent(new Button("SaveEntity", new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { try { fieldGroup.commit(); editEntityWindow.close(); table.refreshRowCache(); } catch (FieldGroup.CommitException e) { e.printStackTrace(); Notification.show("Error!", Notification.Type.ERROR_MESSAGE); } } })); editEntityWindow.setContent(formLayout); TestVaadinApplication.this.addWindow(editEntityWindow); } })); setContent(tableLayout); } } And when I press button SaveEntity nothing happening - Entity not adding. Jpa is work fine. What I am doing wrong?
tagged with: vaadin7
accepted answer: http://stackoverflow.com/a/26058085
type: AnsweredQuestion
tagged with: jpacontainer
score: 0
tagged with: java
type: Question
has title: JpaContainer add Item throught form
answer count: 1
has answer: http://stackoverflow.com/a/26058085

http://stackoverflow.com/comment/40526922
comment on: http://stackoverflow.com/a/25871817
type: AnswerComment
score: 0
type: Comment
has text: @Joehot200 have you considered bundling the jre with your game? Look into Install4j and exec4j. There are others like AdvancedInstaller, etc that are free. This way you can guarantee your app will run on the expected jre. if you leave it up to the users, things might look funny or not render correct depending on the jre version, etc. (also, java6 is far EOL'd... )

http://stackoverflow.com/comment/40471003
comment on: http://stackoverflow.com/a/25859256
has text: Oh, and unfortunately, I don't have enough rep to vote up the answer yet. I plan to, if and when I get enough rep. Subtracting maxConsecutiveVowels and adding consecutiveVowels to word.length in the for loop was the missing piece. I was getting a word with three consecutive vowels before that. @nmore, your code is elegant and inspirational. I clearly have a lot to learn, and I plan to work hard and learn it!
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40315593
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25772400
has text: Please explain that how i don't have a proper number?? and I suppose that this is the part of my above question becoz i need to create an executable jar file from my main class , but with this exception that jar does not work (it is not opened by clicking)

http://stackoverflow.com/a/25821591
type: Answer
has comment: http://stackoverflow.com/comment/40629427
accepted answer of: http://stackoverflow.com/q/25798596
score: 0
answers question: http://stackoverflow.com/q/25798596
type: AcceptedAnswer
has body: In reviewing GemFire's source code, there is no way (e.g. GemFire Distributed Configuration System property) to avoid the NPE... 1744: if (value == null) { 1745: throw new NullPointerException(LocalizedStrings 1746: .LocalRegion_VALUE_MUST_NOT_BE_NULL.toLocalizedString()); 1747: } Sorry, your data repository must return a non-null value, unfortunately. This is even true for GemFire 8 (new release). In the short term, you can always work around this limitation by extending Spring Data GemFire's CacheManager.getCache() method to return a wrapped version of Cache that discards null values on put(key, value), which is a bit extra work, or wait for JIRA-327.

http://stackoverflow.com/comment/40259052
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25744916
has text: Sorry, I don't understand your last comment. What do you mean by "have both c threads to work"?
score: 0

http://stackoverflow.com/comment/40426439
has text: I'm not totally following the code. I see how you start AddCountry from MyCountries, but I don't see how AddCountry returns to MyCountries.
score: 0
comment on: http://stackoverflow.com/q/25835078
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25962406
type: Answer
has body: You're using the tiles attribute "page-title" as a string, while the default behaviour is to treat it as a template (and that template can't be found and you've chosen to ignore that failure). Either declare the attribute as type="string", eg <put-attribute name="page-title" value="" type="string"/> <put-attribute name="page-title" value="Homepage" type="string" /> Or explicitly use the attribute as a string, eg <tiles:getAsString name="title" />
answers question: http://stackoverflow.com/q/25769654
score: 0

http://stackoverflow.com/q/25754613
upvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25759862
tagged with: mat
answer count: 1
downvote count: 0
has title: How do I display a Mat in a window in Java OpenCV?
linked to: http://stackoverflow.com/q/16494916
favorite count: 0
has answer: http://stackoverflow.com/a/25759862
has comment: http://stackoverflow.com/comment/40273176
has body: I've got a Mat made in OpenCV's Java release. Now I need to view this in a window. How can this be done? I feel like it should be pretty simple. I find tons of examples for Python and C++, but no straightforward Java example. Any help here?
tagged with: opencv
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/25817921
has comment: http://stackoverflow.com/comment/40443089
has body: This is due to screen density variations. There are several things you can do to fix this: Use different images for each density (but I'm assuming you're looking for another solution) Use DisplayMetrics to get the actual width of the screen and then set width/height accordingly. This code: buttonX.setHeight(buttonX.getWidth()); probably doesn't work because you are calling it before the layout is drawn, and therefore the width is not the drawn width. You can fix this using ViewTreeObserver like here: How can you tell when a layout has been drawn? Use an XML attribute like scaleType="centerFit" Personally, I find these confusing because scaleType attributes don't always seem to behave the same way to me. You might have to try different ones, but sometimes they come in handy if you need an XML only solution.
has comment: http://stackoverflow.com/comment/40389091
has comment: http://stackoverflow.com/comment/40440080
type: Answer
accepted answer of: http://stackoverflow.com/q/25817789
answers question: http://stackoverflow.com/q/25817789
type: AcceptedAnswer
score: 0

http://stackoverflow.com/comment/40318019
score: 0
type: AnswerComment
has text: I am not very familiar with persistence, so thank you for the info. I figured shiro realms dealt with everything, not just reading from it... I've heard that Spring takes a lot of learning, but I've spent a lot of time with Shiro. I like it, but the documentation is lacking a lot. I guess in a sense I can take the generated password and use an SQL query to add it to a DB, or should I use some sort of persistence API? It seems that persistence is something preferred these days, but I'm new to this so I don't know. Why do you like spring more than shiro? thanks
type: Comment
comment on: http://stackoverflow.com/a/25778429

http://stackoverflow.com/comment/40258100
has text: My label provider implements a getText method, the color should be changed when an option from the context menu is selected....I can't use my label provider because this will actually color the row on selection right ?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25746801
type: Comment

android-asynctask
tags question: http://stackoverflow.com/q/25863256
tags question: http://stackoverflow.com/q/25741370
tags question: http://stackoverflow.com/q/25864227
tags question: http://stackoverflow.com/q/25787897
type: Tag
tags question: http://stackoverflow.com/q/25725184
tags question: http://stackoverflow.com/q/25803754
tags question: http://stackoverflow.com/q/25752210
tag name: android-asynctask
tags question: http://stackoverflow.com/q/25829383
tags question: http://stackoverflow.com/q/25845878
tags question: http://stackoverflow.com/q/25745772
tags question: http://stackoverflow.com/q/25775609
tags question: http://stackoverflow.com/q/25714758
tags question: http://stackoverflow.com/q/25718315
tags question: http://stackoverflow.com/q/25799954
tags question: http://stackoverflow.com/q/25837331
tags question: http://stackoverflow.com/q/25748782
tags question: http://stackoverflow.com/q/25823406
tags question: http://stackoverflow.com/q/25828271
tags question: http://stackoverflow.com/q/25759447
tags question: http://stackoverflow.com/q/25840595

http://stackoverflow.com/comment/40249535
comment on: http://stackoverflow.com/q/25742226
has text: i didn't code that. i'm working on a existing code. My boss coded it
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40350785
type: QuestionComment
has text: If you have a solution, please post it and accept it. Saying _SOLVED_ in the title is pointless.
comment on: http://stackoverflow.com/q/25754136
score: 0
type: Comment

http://stackoverflow.com/comment/40305572
has text: ObjectOutputStream is not multi-threaded. You need to close it from the thread which is writing it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25772754
score: 0

http://stackoverflow.com/comment/40342076
type: Comment
has text: how can you be that fast? I was writing a comment about the GridBagLayout when this appeared xD
comment on: http://stackoverflow.com/a/25792998
type: AnswerComment
score: 1

http://stackoverflow.com/comment/40400577
has text: That's what my original thinking was, must have just missed it in the documentation. I'll rewrite the code to reflect that then. I knew about the 1000 item limit too. Thanks!
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25819187

http://stackoverflow.com/q/25748025
score: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
has answer: http://stackoverflow.com/a/25748172
has answer: http://stackoverflow.com/a/25749682
tagged with: java
type: Question
answer count: 2
has title: Removing a JPanel from a JFrame from a different class(and adding a new one)
has body: Ok guys, need a bit of help with this. So, I'm busy writing a game in Java, using a main menu to go to different sub-games(each of which has its own class), but I ran into this problem: I have a main JFrame, which (in theory) each sub-game (and the main menu) add different JPanels too, and obviously remove the previous one. This is the code for the main menu(mainp is the JPanel): frame.add(mainp); mainp.setLayout(new BorderLayout()); getContentPane().add(mainp); GridBagLayout lay = new GridBagLayout(); GridBagConstraints cons = new GridBagConstraints(); Game.mainp.setLayout(lay); cons.weightx = 0.5; cons.gridx = 0; cons.gridy = 0; Game.mainp.add(ringsb, cons); cons.weightx = 0.5; cons.gridx = 0; cons.gridy = 1; Game.mainp.add(xob, cons); All good so far(ringsb and xob are buttons), but then when I run this code(from a different class(and file)): ringsp.setLayout(lay); cons.weightx = 0.5; cons.gridx = 0; cons.gridy = 0; ringsp.add(Item1, cons); cons.weightx = 0.5; cons.gridx = 0; cons.gridy = 1; ringsp.add(Item2, cons); cons.weightx = 0.5; cons.gridx = 0; cons.gridy = 2; ringsp.add(Item3, cons); Game.frame.remove(Game.mainp); Game.frame.add(ringsp); I don't get any errors, it just doesn't do what it should :( (Game was the name of the other class). Any help??

http://stackoverflow.com/a/25844301
score: 2
has comment: http://stackoverflow.com/comment/40443168
has comment: http://stackoverflow.com/comment/40437691
upvote count: 2
has body: "BBB" case: the "mainTest()" method calls directly the "transactionTest()" method, omitting the aspect. If you want to invoke the dynamically created proxy of the "transactionTest()" method, I suppose, you could do it through self bean reference (injected). Also as far as I remember, the spring manual used to suggest to call such methods via interface references (again using injected interface references). Note: this is a really bad design! Implementation example (per request): &lt;bean id="controller" class="test.Controller"&gt; &lt;property name="jdbcTemplate" ref="jdbcTemplate"/&gt; &lt;property name="instance" ref="controller" /&gt; &lt;/bean&gt; public class Controller { private JdbcTemplate jdbcTemplate; private Controller instance; public void mainTest() { instance.transactionTest(); } public void transactionTest() { System.out.println("Transaction active = " + TransactionSynchronizationManager.isActualTransactionActive() ); } public JdbcTemplate getJdbcTemplate() { return jdbcTemplate; } public void setJdbcTemplate(JdbcTemplate jdbcTemplate) { this.jdbcTemplate = jdbcTemplate; } public Controller getInstance() { return instance; } public void setInstance(Controller instance) { this.instance = instance; } } Transaction active = true This behaviour is well documented in the spring manual (I recall it in the Aspects section), so you should definitely read it: http://docs.spring.io/spring-framework/docs/current/spring-framework-reference/html/aop.html section 9.6.1 More over, this question has already been covered here: One Service method invoke inner multiple method for Spring transaction
accepted answer of: http://stackoverflow.com/q/25784873
has comment: http://stackoverflow.com/comment/40444525
has comment: http://stackoverflow.com/comment/40443947
answers question: http://stackoverflow.com/q/25784873
has comment: http://stackoverflow.com/comment/40439858
has comment: http://stackoverflow.com/comment/40445370
has comment: http://stackoverflow.com/comment/40443010
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40372253
has text: yes u can check here JVM Spec - Section 2.11.1:http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-2.html#jvms-2.11.1
type: Comment
comment on: http://stackoverflow.com/a/25809301
score: 0
type: AnswerComment

http://stackoverflow.com/a/35268615
downvote count: 0
has body: This thread is already about one year old, but maybe I can still help some guys, because I just had the same problem and found out a way how to set your own default MessageFactory. It's a bit tricky, maybe someone else knows a better way without creating so much classes. But for me it works: Create your own MessageFactory (extend from AbstractMessageFactory or just use the MessageFactory interface) Create a new LoggerContext (extend from the LoggerContext class or use the LoggerContext interface Override newInstance(LoggerContext, String, MessageFactory) and return your previously defined MessageFactory if argument messageFactory is null Create a new ContextSelector (extend from ClassLoaderContextSelector or just use the ContextSelector interface). Override the method createContext(String, URI) and return a new instance of your previously defined LoggerContext Create a file log4j.component.properties in your classpath and set the property Log4jContextSelector to the fully-qualified-name of your in step 3 created contextSelector Alternative: Don't create the file, just set the system property Log4jContextSelector to the fqn Some code examples (without any comments): MessageFactory: public final class OwnMessageFactory extends AbstractMessageFactory { public static final OwnMessageFactory INSTANCE = new OwnMessageFactory(); @Override public Message newMessage(final String message, final Object... params) { return new OwnDataMessage(message, params); } } LoggerContext: public class OwnLoggerContext extends LoggerContext { // constructors protected Logger newInstance(final LoggerContext ctx, final String name, MessageFactory messageFactory) { if (null == messageFactory) messageFactory = OwnMessageFactory.INSTANCE; return super.newInstance(ctx, name, messageFactory); } } ContextSelector: public class OwnContextSelector extends ClassLoaderContextSelector { @Override protected LoggerContext createContext(String name, URI configLocation) { return new OwnLoggerContext(name, …
type: Answer
has comment: http://stackoverflow.com/comment/130289983
answers question: http://stackoverflow.com/q/25845120
upvote count: 5
score: 5

http://stackoverflow.com/comment/40338865
type: Comment
has text: I am solving a problem and it has indicated that sort the numbers in increasing order without making a new object. Can you explain more how I can fix it?
type: AnswerComment
comment on: http://stackoverflow.com/a/25790497
score: 0

http://stackoverflow.com/q/25840826
tagged with: java
answer count: 3
downvote count: 1
has body: In the following code, I don't understand why when a1.k() is called, this.x in class C returns 100 instead of 1. My understanding is that this refers to the current object, but the static type of the current variable a1 is A. So shouldn't this.x returns 1, which is the variable for A type? I mean a1.x should return 1, right? Many thanks! class A { public int x = 1; public String k() { return "A" + this.x; } } class B extends A { public int x = 10; ... } class C extends B { public int x = 100; public String k() { return "C" + this.x; } } class TestABC { public static void main(String[] args) { A a1 = new C(); C c1 = new C(); System.out.println(a1.k()); } }
possible better answer: http://stackoverflow.com/a/25840987
has answer: http://stackoverflow.com/a/25840987
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25841030
upvote count: 0
has comment: http://stackoverflow.com/comment/40430362
tagged with: types
tagged with: this
favorite count: 0
has comment: http://stackoverflow.com/comment/40430520
has comment: http://stackoverflow.com/comment/40430231
tagged with: static
has comment: http://stackoverflow.com/comment/40430659
type: Question
has answer: http://stackoverflow.com/a/25841068
tagged with: subclass
linked to: http://stackoverflow.com/q/25830601
linked to: http://stackoverflow.com/q/9852831
has comment: http://stackoverflow.com/comment/40430216
score: -1
accepted answer: http://stackoverflow.com/a/25841068
has title: subclass and keyword this in java

http://stackoverflow.com/q/25801360
has comment: http://stackoverflow.com/comment/40359411
linked to: http://stackoverflow.com/q/20716939
has title: Getting exception No Hibernate Session bound to thread. I am using spring mvc
tagged with: spring
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40358042
tagged with: spring-mvc
linked to: http://stackoverflow.com/q/18608611
tagged with: java
tagged with: hibernate
duplicate of: http://stackoverflow.com/q/20716939
type: Question
has comment: http://stackoverflow.com/comment/40358005
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40391614
has answer: http://stackoverflow.com/a/25801947
has comment: http://stackoverflow.com/comment/40358363
has body: package com.ibs.dao; import org.hibernate.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; import com.ibs.entity.LoginEntity; @Repository public class LoginDaoImpl implements LoginDaoInterface { @Autowired SessionFactory sessionFactory; public boolean validateLogin(LoginEntity loginEntity) { String eid=loginEntity.getEid(); LoginEntity log=(LoginEntity)sessionFactory.getCurrentSession().load(LoginEntity.class, eid); if(log.getPassword().equals(loginEntity.getPassword())) { return true; } else { return false; } } } My spring-servlet-config looks like <?xml version="1.0" encoding="UTF-8"?> <beans xmlns= ......... .......... <context:annotation-config/> <context:component-scan base-package="com.ibs"/> com.ibs.entity.LoginEntity org.hibernate.dialect.OracleDialect true Error details: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63) org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:700) com.ibs.dao.LoginDaoImpl.validateLogin(LoginDaoImpl.java:20)

http://stackoverflow.com/comment/40332463
score: 0
comment on: http://stackoverflow.com/q/25787831
type: Comment
type: QuestionComment
has text: my approach is not working

http://stackoverflow.com/comment/40216735
comment on: http://stackoverflow.com/q/25721818
has text: After suggestions from M Denium, Xstian and Sezin Karli I changed the call in Main() from : cont.transactionTest(); to cont.mainTest(); and added public void mainTest() { try{ transactionTest(); }catch (NoClassesException e){ System.out.println(e.getMessage() ); } } into the Controller to allow the transaction to complete before I catch the NoClassesException() but the row was still inserted into the dB. Note - I tried to edit the original post to include these changes but the editor kept complaining about format errors. Any other suggestions extremely welcome.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40409136
has text: Thanks for giving me that link about the students with homework. I do want to understand, but my TA is unfortunately only available when I'm in another class, and the Java help lab people don't help with concepts and have extremely limited availability. If you have any other resources for REALLY new-to-programming people, I'd appreciate any tips. The book we have isn't explaining things well and the Oracle docs seem to assume you have some other basic programming experience (at least it seems that way to me). Thanks.
comment on: http://stackoverflow.com/q/25800452
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40430442
type: Comment
comment on: http://stackoverflow.com/a/25840987
type: AnswerComment
score: 0
has text: Thanks! I know the k() in class C should be called, instead of the k() in class A. But why this.x returns 100? I thought the instance variable is bounded to the static type.

http://stackoverflow.com/comment/40353904
type: AnswerComment
type: Comment
has text: I find it bad practice to break from a loop if you dont need to, you adding more exit paths to the loop, more 'logic' and more room for error.
comment on: http://stackoverflow.com/a/25799035
score: 0

http://stackoverflow.com/comment/41334961
type: AnswerComment
score: 0
type: Comment
has text: Didn't have time over weekend. If it isn't too late, I'll modify that parser for you, if you really need it.
comment on: http://stackoverflow.com/a/26264816

http://stackoverflow.com/comment/40344837
score: 0
has text: If you prefer a different path or different name you need to use `-Dlog4j.configuration=relative_path_to_file.xml`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25793747

http://stackoverflow.com/comment/40265662
type: QuestionComment
score: 1
has text: I'm new to programming, but i found it's a return double second. In that way it makes sense to /1000 because most of the values are 0.001 - 0.005. Thanks !
comment on: http://stackoverflow.com/q/25750945
type: Comment

http://stackoverflow.com/a/25734966
type: Answer
has comment: http://stackoverflow.com/comment/40236484
upvote count: 1
answers question: http://stackoverflow.com/q/25734874
has comment: http://stackoverflow.com/comment/40236414
score: 1
has comment: http://stackoverflow.com/comment/40236378
has body: Note: This solution will continue to look for items until it gets to the end of the list. This means that it will return the position of the last matching item in the list and may be better suited for a getLastPosition() method. You have to update the currentNode every iteration of the loop, not only if it matches: for(int i = 0; i &lt; length; i++) { if(anObject.equals(currentNode.data)) { position = i + 1; //currentNode = currentNode.next; // NOT HERE } currentNode = currentNode.next; // HERE }
has comment: http://stackoverflow.com/comment/40236430
downvote count: 0
has comment: http://stackoverflow.com/comment/40236386
has comment: http://stackoverflow.com/comment/40236452

http://stackoverflow.com/q/25802784
has answer: http://stackoverflow.com/a/25808177
has comment: http://stackoverflow.com/comment/40360547
has comment: http://stackoverflow.com/comment/40360938
has comment: http://stackoverflow.com/comment/40360485
downvote count: 0
answer count: 1
has title: How to listen to graphic environment or device changes in java
favorite count: 0
tagged with: listener
type: UnansweredQuestion
score: 2
linked to: http://stackoverflow.com/q/26912360
has body: In java one can get the current graphics environment using GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment(); and than loop through the devices using GraphicsDevice[] screenDevices = graphicsEnvironment.getScreenDevices(); for (int i = 0; i &lt; screenDevices.length; i++) { GraphicsDevice graphicsDevice = screenDevices[i]; ... } But the number of GraphicDevices can change at runtime, e.g. by plugging in an USB-monitor. Or the user can change a GraphicsDevice's resolution or move it relative to another graphics device if there are multiple monitors. How can I listen to changes of the GraphicsEnvironment and the GraphicDevices? EDIT I tried to implement the change detection using a daemon thread that inspects the graphics environment at a specific interval, but it doesn't work. It doesn't work because the GraphicsEnvironment is hold in a statc variable and initialized only once. Also the sub classes of GraphicsEnvironment cache the GraphicDevices. So new GraphicDevices will only be detected if the jvm process is restarted.
upvote count: 2
tagged with: java
type: Question
tagged with: graphics
has comment: http://stackoverflow.com/comment/42376243

http://stackoverflow.com/a/38002156
upvote count: 7
type: Answer
has body: The following worked for me: sudo apt-get install openjdk-8-jdk openjdk-8-dbg
downvote count: 0
score: 7
answers question: http://stackoverflow.com/q/25715067

http://stackoverflow.com/comment/40411567
has text: Is it that, if I schedule a runnable, then itwill execute only if my app is running?
comment on: http://stackoverflow.com/a/25830916
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40359927
type: QuestionComment
score: 1
has text: Read [this](http://docs.spring.io/spring-ws/site/reference/html/security.html)
comment on: http://stackoverflow.com/q/25802400
type: Comment

http://stackoverflow.com/q/25782995
favorite count: 0
tagged with: playframework-2.2
upvote count: 2
has body: I develop a little server in PlayFramework2/Java which has to retrieve data from multiple WS (REST/JSON), manipulate the data from theses WS, then compose and return a result. I know how to call one WS, manipulate the data and return response. But I don't know how how to call successively several web-services, handle the data between every call and generate an aggregated answer. Please help.. Thanks in advance
tagged with: web-services
type: AnsweredQuestion
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/25802444
type: Question
downvote count: 0
has title: Multiple WS call in one action, how to handle Promise objects in java play framework?
answer count: 1
has answer: http://stackoverflow.com/a/25802444

http://stackoverflow.com/comment/40441313
type: QuestionComment
has text: @OP: see also `ThreadLocal`
type: Comment
comment on: http://stackoverflow.com/q/25847219
score: 1

http://stackoverflow.com/comment/40368790
type: Comment
comment on: http://stackoverflow.com/a/25807693
has text: @DavidWallace 1.3999999762 is the correct number rounded to the 10th digit
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40232049
score: 0
comment on: http://stackoverflow.com/q/25732649
type: Comment
type: QuestionComment
has text: @LouisWasserman The input list is created/retrieved in several places. In my opinion, it makes sense to create one single utility function. That said, I can see your point. However, that's not really my question :). I am wondering if there are smart ways to combine filtering, sorting en limiting in single steps.

http://stackoverflow.com/q/25759477
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25759552
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: hash
has comment: http://stackoverflow.com/comment/40281206
tagged with: soap
has body: Is it possible to send an MD5 hash computed String over SOAP? Whenever I do something like String key = md5(something) and try to send key via a Java SOAP client, I always get the error message Message: An invalid XML character (Unicode: 0xsomething) was found in the element content of the document. I'am aware that computing md5 on a string presumably produces invalid XML characters. The Question is to know whether there is a way let that go through anyway. I am using the MessageDisgest class of Java to compute MD5 strings. Best regards. Edmond
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40281232
accepted answer: http://stackoverflow.com/a/25759552
tagged with: md5
upvote count: 1
has title: Send a hash value over soap

http://stackoverflow.com/comment/73002030
score: 1
has text: Note that this does not play well with XHTML DOCTYPE declarations (it tries to fetch them); once removed, this solution works very well. Also note that because of other imports I had to use org.w3c.dom.Document and org.w3c.dom.Node explicitly instead of Document and Node, and instead of the ByteArrayInputStream you can use InputSource inputSource = new InputSource(new StringReader(code)); (passing in inputSource to DocumentBuilder.parse()).
type: AnswerComment
comment on: http://stackoverflow.com/a/33541820
type: Comment

http://stackoverflow.com/comment/53955271
comment on: http://stackoverflow.com/a/25836327
score: 0
type: Comment
has text: [link](http://www.codehandling.com/2012/12/instagram-login-using-oauth-20-in-java.html?showComment=1410533697778#c5776110322675828773) the example should be sufficient however you want to make sure to apply the fixed that I mentioned in the answer. Good luck!
type: AnswerComment

http://stackoverflow.com/q/25865560
has comment: http://stackoverflow.com/comment/40476748
has comment: http://stackoverflow.com/comment/40474697
has comment: http://stackoverflow.com/comment/40478932
has comment: http://stackoverflow.com/comment/40474577
tagged with: http://stackoverflow.com/tag/rdf
tagged with: tdb
has answer: http://stackoverflow.com/a/25869933
has comment: http://stackoverflow.com/comment/40485872
type: AnsweredQuestion
score: 0
tagged with: java
has title: Error when I load RDF triples in TDB Triple Store
has comment: http://stackoverflow.com/comment/40477002
type: Question
tagged with: triplestore
has body: I have a question for you: I have loaded my file RDF in TDB Triple Store: Dataset dataset = TDBFactory.createDataset(directory); Model model = dataset.getNamedModel("http://nameFile"); TDBLoader.loadModel(model, file ); Now, I would like to realize a procedure which checks whether the graph is on the Triple Store or not. I have written this code: String queryStr = "select * {graph &lt;http://nameFile&gt; { ?s ?p ?o }}"; Dataset dataset = TDBFactory.createDataset(directory); Query query = QueryFactory.create(queryStr); QueryExecution qexec = QueryExecutionFactory.create(query, dataset); qexec.getContext().set(TDB.symUnionDefaultGraph, true); /*Execute the Query*/ ResultSet results = qexec.execSelect(); if (!results.hasNext()) { Model model = dataset.getNamedModel("http://nameFile"); TDBLoader.loadModel(model, label); } else { Model model = dataset.getNamedModel("http://nameFile"); } StmtIterator stmti = model.listStatements(); while (stmti.hasNext()) { Statement statement = stmti.nextStatement(); System.out.println(statement); } I have seen that this code fails with this error: Exception in thread "main" java.lang.UnsupportedOperationException: Quad: subject cannot be null at com.hp.hpl.jena.sparql.core.Quad.(Quad.java:62) at com.hp.hpl.jena.tdb.lib.TupleLib.quad(TupleLib.java:162) at com.hp.hpl.jena.tdb.lib.TupleLib.quad(TupleLib.java:153) at com.hp.hpl.jena.tdb.lib.TupleLib.access$100(TupleLib.java:45) at com.hp.hpl.jena.tdb.lib.TupleLib$4.convert(TupleLib.java:87) at com.hp.hpl.jena.tdb.lib.TupleLib$4.convert(TupleLib.java:83) at org.apache.jena.atlas.iterator.Iter$4.next(Iter.java:322) at org.apache.jena.atlas.iterator.Iter$4.next(Iter.java:322) at org.apache.jena.atlas.iterator.Iter.next(Iter.java:920) at com.hp.hpl.jena.util.iterator.WrappedIterator.next(WrappedIterator.java:94) at com.hp.hpl.jena.util.iterator.Map1Iterator.next(Map1Iterator.java:45) at com.hp.hpl.jena.util.iterator.WrappedIterator.next(WrappedIterator.java:94) at com.hp.hpl.jena.rdf.model.impl…
tagged with: jena
accepted answer: http://stackoverflow.com/a/25869933
has comment: http://stackoverflow.com/comment/40476213
answer count: 1

http://stackoverflow.com/q/25821238
has body: I am trying to create beautiful speech bubbles in swing but the result is not very good...I mean I want something better and more beautiful! here is the code i'm using: import javax.swing.*; import java.awt.*; import java.awt.geom.Area; import java.awt.geom.RoundRectangle2D; public class BubbleTest { public static void main(String[] args) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | javax.swing.UnsupportedLookAndFeelException e) { e.printStackTrace(); } LeftArrowBubble leftArrowBubble = new LeftArrowBubble(); JOptionPane.showMessageDialog(null, leftArrowBubble); RightArrowBubble rightArrowBubble = new RightArrowBubble(); JOptionPane.showMessageDialog(null, rightArrowBubble); } private static class LeftArrowBubble extends JPanel { private int strokeThickness = 5; private int padding = strokeThickness / 2; private int radius = 10; private int arrowSize = 6; @Override protected void paintComponent(final Graphics g) { final Graphics2D graphics2D = (Graphics2D) g; RenderingHints qualityHints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); qualityHints.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); graphics2D.setRenderingHints(qualityHints); graphics2D.setColor(new Color(80, 150, 180)); graphics2D.setStroke(new BasicStroke(strokeThickness)); int x = padding + strokeThickness + arrowSize; int width = getWidth() - arrowSize - (strokeThickness * 2); int height = getHeight() - strokeThickness; graphics2D.fillRect(x, padding, width, height); RoundRectangle2D.Double rect = new RoundRectangle2D.Double(x, padding, width, height, radius, radius); Polygon arrow = new Polygon(); arrow.addPoint(14, 6); arrow.addPoint(arrowSize + 2, 10); arrow.addPoint(14, 12); Area…
answer count: 1
has comment: http://stackoverflow.com/comment/40394455
has comment: http://stackoverflow.com/comment/40394827
downvote count: 2
has comment: http://stackoverflow.com/comment/40394343
tagged with: drawing
favorite count: 0
upvote count: 5
has comment: http://stackoverflow.com/comment/40394993
tagged with: shapes
has comment: http://stackoverflow.com/comment/40395193
accepted answer: http://stackoverflow.com/a/25822083
tagged with: swing
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/25822083
type: Question
has title: Draw Beautiful Speech Bubbles in Swing
tagged with: graphics

http://stackoverflow.com/q/25838513
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40425766
accepted answer: http://stackoverflow.com/a/25838552
type: Question
tagged with: casting
downvote count: 0
has title: Java: Better way to convert Double object to float
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25838552
has body: Suppose I'm given a Double object d and a function that takes in a primitive float, is there a better way to pass on object do to the function than by double casting? Double fakePi = 3.14 void function(float num) {} function(fakePi): Returns a compiling error as function does not take Double object as argument function((float) fakePi): Returns a compiling error as Double cannot be converted to a float function((float) (double) fakePi): Compiles and runs without error Although this works, my instincts tells me that there are better ways to do this and that I should avoid doing multiple type castings, especially since float, double, Double are closely related to each other.

http://stackoverflow.com/q/25769520
score: 0
tagged with: jpa
answer count: 1
has answer: http://stackoverflow.com/a/25773572
tagged with: persistence
tagged with: persistence-unit
type: UnansweredQuestion
tagged with: java
tagged with: openjpa
type: Question
has title: Packaging persistence.xml outside of jar with OpenJPA
has body: So I'm using JPA (OpenJPA 2.3.0 implementation) in perhaps a rather unconventional way. I'm writing a piece of software that will maintain some personnel data and assign work to said personnel. What type of work it assigns is undefined - the user must extend a mapped superclass, add any additional mappings for that class, and my software will basically take it from there. We have several systems that follow this pattern, and we only wanted to write the assignment code once. However, there are small differences in what gets assigned - some system assign a case, other assign a smaller piece of a case, others assign based on a customer, etc. To get maximum configurability, I put all the metadata for my persistent entities into a mapping file instead of using annotations. Since the programmer using my software would have to extend that mapped superclass and add their own mapping to the persistence unit, I didn't want to package persistence.xml or my mapping XML into the jar I'm creating. I figured the programmer could include those files somewhere in their ear. I wrote the entire thing using Java SE, not EE, so I'm creating the EntityManagerFactory myself instead of injecting it. My organization is using Websphere Application Server 7.0 which implements Java EE 5. Looking at the documentation for JPA in Java EE 5, it seemed my user would have to package the persistence.xml and mapping XML files into a separate jar which could be placed in the ear's library folder. They could then refer to my jar file in persistence.xml. Something like the following (the name of my software is WAM): <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> wamMapping.xml wam-1.0.0.jar I tried to write a quick and dirty web service in this manner. I added my persi…
has comment: http://stackoverflow.com/comment/40299305

http://stackoverflow.com/comment/40297876
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25768214
has text: possible duplicate of [Can't execute jar- file: "no main manifest attribute"](http://stackoverflow.com/questions/9689793/cant-execute-jar-file-no-main-manifest-attribute)

http://stackoverflow.com/comment/40395248
has text: Check out this link it will guide you with full explanation on how to create android application and register it for push notification on GCM server and how to 3rd party App Server to handle and throw push notification http://www.androidhive.info/2012/10/android-push-notifications-using-google-cloud-messaging-gcm-php-and-mysql/
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25821813

http://stackoverflow.com/comment/40389604
comment on: http://stackoverflow.com/a/25818567
type: Comment
has text: Isn't your answer saying that `java wtv` and `java -cp . wtv` are the same?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40210489
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/25721397
has text: Side note: Use `equals` to compare Strings, not `==`. Rumors saying that programmers who use `==` are suffering in hell.

http://stackoverflow.com/comment/40508882
type: Comment
has text: Also, I discovered tonight that the file contains 3 words with 5 consecutive vowels each (cooeeing, miaoued & queueing), and none with 6. So, the instructions are incomplete: they say find "the" word with 5 consecutive vowels. I figured out that if I change if (consecutiveVowels > maxConsecutiveVowels) in the for loop to if (consecutiveVowels >= maxConsecutiveVowels) I get the last word with the most consecutive vowels instead of the first word with the most consecutive vowels. I really want to figure out how to get all three words to show up, but I have other homework due tomorrow..
score: 0
comment on: http://stackoverflow.com/a/25859256
type: AnswerComment

http://stackoverflow.com/comment/40260626
score: 1
comment on: http://stackoverflow.com/q/25747736
has text: I never see `getReportDoseStat()` called, can you clarify your question? What output do you want? What output are you getting?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40447947
type: AnswerComment
comment on: http://stackoverflow.com/a/25850920
has text: `country` shall be `trim()`-med as well before splitted.
type: Comment
score: 2

media-player
tags question: http://stackoverflow.com/q/25832081
type: Tag
tag name: media-player

http://stackoverflow.com/a/25838851
has comment: http://stackoverflow.com/comment/40428816
has comment: http://stackoverflow.com/comment/40427864
has comment: http://stackoverflow.com/comment/40427156
has body: I just give you this example to give you an idea and start you up Code: public class NewClass { public static void main(String... args) { JButton jb = new JButton("Enter"); jb.setEnabled(false); JTextField jt = new JTextField(15); JFrame jf = new JFrame(); jf.setSize(200, 100); FlowLayout layout = new FlowLayout(); jf.setLayout(layout); jf.add(jb); jf.add(jt); jf.setLocationRelativeTo(null); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setVisible(true); jt.addKeyListener((new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { JTextField textField = (JTextField) e.getSource(); String text = textField.getText(); textField.setText(text.toUpperCase()); if(!textField.getText().isEmpty()) jb.setEnabled(true); else jb.setEnabled(false); } })); } } output: Explanation: There are many ways to accomplish what you want. For example, Key Listener and Document Listener. The good practice is to use Document Listener because it is not depended on activities. Note: there are other good ways to solve your issue but I thought this way is more easier for you to understand Take a look at this comment A DocumentListener would be better as that lets you react to any changes to the text, whether or not they were triggered by a key press (e.g. a paste from the clipboard), and you don't have to worry about key presses that don't cause the text to change. – Ian Roberts Source: http://docs.oracle.com/javase/tutorial/uiswing/events/keylistener.html Using Document Listener Approach which is good practice and recommended Code: import java.awt.FlowLayout; import javax.swing.*; import javax.swing.event.*; import javax.swing.text.Document; public class DocumentListenerSample { public static void main(String args[]) { JButton jb = new JButton("Enter"); jb.setEnabled(false); JTextField jt = new JTextField(15); JFrame jf = new JFrame(); jf.setSize(200, 100); FlowLayout layout = new FlowLayout(); jf.setLayout(layout); jf.add(jb); jf.add(jt); jf.setLocationRelativeTo(null); jf.setDe…
has comment: http://stackoverflow.com/comment/40427959
has comment: http://stackoverflow.com/comment/40427991
downvote count: 0
has comment: http://stackoverflow.com/comment/40427822
type: Answer
has comment: http://stackoverflow.com/comment/40426736
has comment: http://stackoverflow.com/comment/40428853
score: 1
has comment: http://stackoverflow.com/comment/40426674
has comment: http://stackoverflow.com/comment/40427854
answers question: http://stackoverflow.com/q/25838674
has comment: http://stackoverflow.com/comment/40427890
upvote count: 1

http://stackoverflow.com/q/25864376
downvote count: 0
has comment: http://stackoverflow.com/comment/40472805
has comment: http://stackoverflow.com/comment/40472853
tagged with: android
tagged with: android-activity
has comment: http://stackoverflow.com/comment/40474621
favorite count: 0
answer count: 0
has title: calculate the time taken for change of activity in android
type: UnansweredQuestion
upvote count: 1
has body: i have calculated the current running activity in an android mobile and detected the name of the application using the code below.. for (ActivityManager.RunningTaskInfo aTask : alltasks) { task=aTask.baseActivity.getPackageName(); try{ ai=pm.getApplicationInfo(task,0);} catch (final NameNotFoundException e) { ai = null; } final String applicationName = (String) (ai != null ? pm.getApplicationLabel(ai) : "(unknown)"); This will return the name of any application that is run in the mobile device...But is there any function to detect the change in activity of the current running application using its name? i need to calculate the time taken to change from one activity to another for current running application.
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40472941
type: Question
has comment: http://stackoverflow.com/comment/40473042
tagged with: mobile
tagged with: function
has comment: http://stackoverflow.com/comment/40474817

http://stackoverflow.com/comment/107430820
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25760305
has text: If there are 100+ project jars, then in which jar's web-fragment should one put the static resources?
score: 0

http://stackoverflow.com/comment/40457012
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25855132
has text: @DavidConrad Exactly. But that makes no difference regarding the damage such a `Throwable` may have caused to the runtime. In most cases it is irrelevant if the thread where a serious exception happened dies because the damage affects *all* threads.

http://stackoverflow.com/q/25852387
answer count: 1
tagged with: maven-3
type: UnansweredQuestion
score: 0
tagged with: maven
has answer: http://stackoverflow.com/a/25862990
has title: Can I drag in extra Maven dependencies for different WAR plugin executions
tagged with: java
has body: I have a pom that is supposed to build 2 different WARs (one will add a classifier). I can have 2 &lt;execution&gt; blocks in the WAR plugin configurations and this works fine, but I need to drag in different dependencies between the executions. For example, the first execution would build the default WAR containing the modern libs, and the other would build a legacy-compatible WAR using old libs. This would mean the dependencies would differ between the WAR plugin executions. Is this achievable? The end goal is to produce both WARs in one go. I know this sounds counter-Maven, but why would the WAR plugin allow multiple executions if not to support similar scenarios.
type: Question

http://stackoverflow.com/q/25757021
has title: SQLData Oracle Type accessing via not the owner
tagged with: java
has answer: http://stackoverflow.com/a/25859166
accepted answer: http://stackoverflow.com/a/25859166
type: Question
tagged with: database
score: 0
answer count: 1
tagged with: oracle-database
has body: I have a little issue, my Java code currently works fine when using the owner of the Oracle Types using the SQLData interface. but when I change the database user to not the owner I am getting a class cast exception as the returned type is a STRUCT not the Java class. I have granted execute on the types and created public synonyms, but I am still having the issues. Any ideas? Cheers, Steve
type: AnsweredQuestion
tagged with: mapping

http://stackoverflow.com/comment/40242219
type: Comment
type: QuestionComment
has text: @dimoniy Why not using maven-shade-plugin? What's the matter?
score: 0
comment on: http://stackoverflow.com/q/25728855

http://stackoverflow.com/comment/40370210
comment on: http://stackoverflow.com/a/25803654
type: AnswerComment
has text: It just gives a 'null' word in the catch block. Changes means changes in the size of butons and panels
score: 0
type: Comment

http://stackoverflow.com/q/25744681
linked to: http://stackoverflow.com/q/25753953
favorite count: 0
tagged with: fragment
has answer: http://stackoverflow.com/a/25744919
accepted answer: http://stackoverflow.com/a/25744919
type: AnsweredQuestion
tagged with: android-fragments
score: 7
tagged with: java
type: Question
upvote count: 7
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40255295
has body: I am pretty new to Android Apps, so I hope I can find some help here. I have already searched for my problem in here and found something, but that does not work. I want to add a Fragment to a FrameLayout but it does not work. My goal ist to create a Frame (/Framework?) that is always present and the user can interact with it and inside this Frame in a specific "window" I want to display pages/fragments, five in total, and beeing able to switch the pages/fragments at any time, so I have an always present Frame and inside this dynamically changing pages. But for now I am stuck at the very beginning with adding a simple fragment to this Frame (which is already working btw.) This is all the relevant code I hope: The error occurs in the MainActivity.java (getSupportFragmentManager().beginTransaction().add(R.id.mainFrame, homeFragment).commit();) where it tells me: Error:(25, 55) error: no suitable method found for add(int,HomeFragment) method FragmentTransaction.add(Fragment,String) is not applicable (argument mismatch; int cannot be converted to Fragment) method FragmentTransaction.add(int,Fragment) is not applicable (argument mismatch; HomeFragment cannot be converted to Fragment) I already tried to cast homeFragment to Fragment, but that did not work. MainActivity.java import android.app.FragmentTransaction; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.FragmentActivity; public class MainActivity extends FragmentActivity { FragmentTransaction fragmentTransaction; HomeFragment homeFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); homeFragment = new HomeFragment(); **getSupportFragmentManager().beginTransaction().add(R.id.mainFrame, homeFragment).commit();** } activity_main.xml &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android…
tagged with: android
has title: Android: Adding a simple Fragment
tagged with: frame

http://stackoverflow.com/comment/40356244
score: 0
has text: yeah.. public class ValidateServlet extends HttpServlet{ private static final long serialVersionUID = 1563760349997052176L; @Override public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HashMap<String, String> map = new HashMap<String, String>(); map.put("lithusha", "lithusha"); map.put("rajesh","rajesh"); map.put("souji", "souji"); String strUserName = request.getParameter("username"); String strPassword = request.getParameter("pwd"); String strErrMsg = null; try { if } }
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25800313

http://stackoverflow.com/comment/40462498
has text: @KickButtowski: Don't take things to chat unless they're off topic. This is on topic. Taking this to chat doesn't help anyone coming to this thread and trying to solve a similar problem. Also you're being downovoted because you didn't provide nearly enough information in your question, and you continually respond with things like "didn't work"
type: AnswerComment
comment on: http://stackoverflow.com/a/25858433
score: 0
type: Comment

http://stackoverflow.com/comment/40262154
comment on: http://stackoverflow.com/q/25744749
score: 0
type: Comment
type: QuestionComment
has text: @cmbaxter Yes, that's what I'm suggesting. This way you don't even need "seed" nodes, you can just look up any node for the appropriate cluster at start time. Machines die and move around a lot if you're using something like AWS so not tying yourself to fixed network locations saves a lot of headache.

http://stackoverflow.com/q/25790489
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25851479
has title: Get resource for reader from stepExecutionContext
tagged with: spring-batch
answer count: 1
downvote count: 0
favorite count: 0
has body: I want to implement partition step in my spring-batch application. I've written a partitioner and try to use it in my step. My partitioner scanning file system directory and gets files to read, one file for every execution context. So I want to set this files from step execution context to resource property of my readers. I've found the solution for xml-based configuration. It is something like this: &lt;bean id="itemWriter" class="org.springframework.batch.item.file.FlatFileItemWriter" scope="step"&gt; &lt;property name="resource" value="file:#{stepExecutionContext[startId]}.csv" /&gt; ... &lt;/bean&gt; But I'm using java based configuration. How can I implement this in java code?
has answer: http://stackoverflow.com/a/25851479
upvote count: 1
tagged with: spring
type: AnsweredQuestion

jogl
tag name: jogl
tags question: http://stackoverflow.com/q/25815797
tags question: http://stackoverflow.com/q/25817293
type: Tag
tags question: http://stackoverflow.com/q/25805049
tags question: http://stackoverflow.com/q/25713023
tags question: http://stackoverflow.com/q/25746110
tags question: http://stackoverflow.com/q/25793030

http://stackoverflow.com/comment/40308121
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25774019
type: QuestionComment
has text: @Override protected void onStart ( ) { super.onStart ( ) ; }

http://stackoverflow.com/a/25713229
downvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25713157
has comment: http://stackoverflow.com/comment/40195254
score: 115
has comment: http://stackoverflow.com/comment/57347797
has comment: http://stackoverflow.com/comment/45403314
has comment: http://stackoverflow.com/comment/51322689
has comment: http://stackoverflow.com/comment/40195448
has comment: http://stackoverflow.com/comment/45392258
has comment: http://stackoverflow.com/comment/57347884
has body: You are using the same notification ID (the value is always 1) for all your notifications. You probably should separate out the notification ID into a separate singleton class: public class NotificationID { private final static AtomicInteger c = new AtomicInteger(0); public static int getID() { return c.incrementAndGet(); } } Then use NotificationID.getID() instead of NOTIFICATION_ID in your code. EDIT: As @racs points out in a comment, the above approach is not enough to ensure proper behavior if your app process happens to be killed. At a minimum, the initial value of the AtomicInteger should be initialized from some activity's saved state rather than starting at 0. If the notification IDs need to be unique across restarts of the app (again, where the app process may be killed off), then the latest value should be saved somewhere (probably to shared prefs) after every increment and restored when the app starts.
type: AcceptedAnswer
upvote count: 117
accepted answer of: http://stackoverflow.com/q/25713157

http://stackoverflow.com/comment/40271048
type: Comment
comment on: http://stackoverflow.com/a/25753046
type: AnswerComment
has text: @Boshokai Requirement 2. sais so.
score: 0

http://stackoverflow.com/q/25796592
tagged with: letters
answer count: 5
upvote count: 3
possible better answer: http://stackoverflow.com/a/25796752
type: Question
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/25796949
has title: Program to convert numbers to letters
has answer: http://stackoverflow.com/a/25796771
has answer: http://stackoverflow.com/a/25796911
has body: Im trying to crate a program that does this: 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 AA AB AC AD....ZZ AAA AAB AAC The way I approached this is hard to put into words but I'll try explaining I tried creating a base 27 system and make A represent 1, B->2 C->3, and AA->28 The problem is that every 27 letters where I get an @ representing 0. I also tried making A represent 0 and having a base 26 system but 27 would be BA when I need it to be AA public class aaa { public static void main(String args[]) { int counter=29; for(int x=0;x&lt;=counter;x++) { int quotient, remainder; String result=""; quotient=x; while (quotient&gt;0) { remainder=quotient%27; result = (char)(remainder+64) + result; quotient = (int)Math.floor(quotient/27); } System.out.print(result+ " "); } } } This prints out 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 A@ AA AB I want the program to do this 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 AA AB AC
downvote count: 0
linked to: http://stackoverflow.com/q/5060921
tagged with: radix
has answer: http://stackoverflow.com/a/25796773
has answer: http://stackoverflow.com/a/25796752
favorite count: 0
accepted answer: http://stackoverflow.com/a/25796911

http://stackoverflow.com/a/25883969
answers question: http://stackoverflow.com/q/25805580
has comment: http://stackoverflow.com/comment/40570591
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: have you tried using raw sockets? It should run faster as it's on a lower layer static boolean exists(String serverUrl) { final Socket socket; try { URL url = new URL(serverUrl); socket = new Socket(url.getHost(), url.getPort()); } catch (IOException e) { return false; } try { socket.close(); } catch (IOException e) { // will never happen, it's thread-safe } return true; }

http://stackoverflow.com/comment/40475545
comment on: http://stackoverflow.com/a/25857846
has text: Thanks. No XML — that explains why I did not find anything. But printf will do the trick for me. All my problems solved.
score: 0
type: AnswerComment
type: Comment

nginx
tags question: http://stackoverflow.com/q/25850440
tag name: nginx
tags question: http://stackoverflow.com/q/25759954
type: Tag
tags question: http://stackoverflow.com/q/25846120

http://stackoverflow.com/comment/40204370
comment on: http://stackoverflow.com/a/25718039
score: 0
type: AnswerComment
has text: `there is once + rmean and once - rmean` I think this is mathematically incorrect
type: Comment

http://stackoverflow.com/q/25844196
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
has body: I have a table with a currency amount in one column. The difficulty is that each row can have a different currency. I have set up a default cell editor which does the validaion in stopCellEditing which works fine. If the data is invalid the editor does not stop but the value is reverted to its original value rather than leave the invalid data in the cell. I have set the Focus Lost behaviour: ftf.setFocusLostBehavior(JFormattedTextField.PERSIST); I have looked at the example for cell editors (see Specifying Formatters and Using Formatter Factories) and it works because it uses an integer format: //Set up the editor for the integer cells. integerFormat = NumberFormat.getIntegerInstance(); NumberFormatter intFormatter = new NumberFormatter(integerFormat); intFormatter.setFormat(integerFormat); intFormatter.setMinimum(minimum); intFormatter.setMaximum(maximum); ftf.setFormatterFactory( new DefaultFormatterFactory(intFormatter)); ftf.setValue(minimum); ftf.setHorizontalAlignment(JTextField.TRAILING); ftf.setFocusLostBehavior(JFormattedTextField.PERSIST); This format factory sets the isEditValid=false within the JFormattedTextField so when stopCellEditing is called it has already set the isEditValid to false. With my table I can not use a formatter so isEditValid is true once it gets to stopCellEditor. The only way I can see of doing this is to use an InputVerifier on the field. The question is: Is it viable to use InputVerifiers on table cells? I have looked to overriding stringToValue and valueToString in a Formatter but I do not have access to the details of the currency of the row, just the string. With an InputVerifier I get access to the original field for the cell which is a subclass of JFormattedTextField with the currency info added. I hope this makes sense.
tagged with: inputverifier
linked to: http://stackoverflow.com/q/7531513
has comment: http://stackoverflow.com/comment/40436848
tagged with: jtable
has answer: http://stackoverflow.com/a/25862327
answer count: 1
downvote count: 0
favorite count: 0
has title: Inputverifier cell editor
type: UnansweredQuestion
tagged with: tablecelleditor
has comment: http://stackoverflow.com/comment/40444609
has comment: http://stackoverflow.com/comment/40467387

http://stackoverflow.com/comment/40259495
type: QuestionComment
has text: What kind of chain have you used for English stemming? I would be surprised you got this by using `PorterStemFilter`.
score: 0
comment on: http://stackoverflow.com/q/25741209
type: Comment

http://stackoverflow.com/comment/40266865
score: 0
comment on: http://stackoverflow.com/q/25750945
type: Comment
type: QuestionComment
has text: What is the datatype for `lapTime`?

http://stackoverflow.com/comment/40324373
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25782574
has text: i know its invalid , i wrote cosidering the law above mentioned doesn't exist , thanx for your response , helps a lot
type: Comment

http://stackoverflow.com/comment/40454695
type: QuestionComment
has text: To add a bit of reasoning: I find `List<int[]>` a... suboptimal representation of a list of Integer tuples.
comment on: http://stackoverflow.com/q/25853988
score: 0
type: Comment

http://stackoverflow.com/a/25861671
type: Answer
has body: A do while loop will execute at least once whereas a while loop may not even execute even once if its conditions are not met. The do while starts checking its condition after the first iteration.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25861618

http://stackoverflow.com/a/25812588
has comment: http://stackoverflow.com/comment/40449525
type: Answer
accepted answer of: http://stackoverflow.com/q/25811257
has comment: http://stackoverflow.com/comment/40435167
answers question: http://stackoverflow.com/q/25811257
has comment: http://stackoverflow.com/comment/40442714
has body: Currently i have a project com.myapp.entities. I am considering creating a project com.myapp.service and com.myapp.serviceimpl I don't think you want to create different projects but different packages in the same project instead. Entities, service and service implementation makes sense as long as they are cohesively designed. So if you split them into several projects then maintain your code will be very difficult and even deploy your applications based in this JPA persistence module will be also very hard because you'll have several dependencies. Not to mention maintainability once your applications are running in a production environment. Also bear in mind JPA (persistence, actually) is the bottom layer in your application design. If you want to create applications with different capabilities but based on the same persistence background, then those capabilities should be located on top business-logic layers, not persistence layer. Also, which project does my persistence.xml go in? As I've said you should actually have one project instead of several ones. But as general rule, persistence.xml should be present in the same project where your entities are. I am trying to understand how to connect my EntityManagerFactory to the EntityManager and the best way to use this with my tested Entities. Since you say you are working on a Java SE application, then you have to take care of the lifecycle of both EntityManagerFactory and EntityManager; While your Service could look like this: public interface Service { public EntityManager getEntityManager(); } The implementation might look like this: public class ServiceImp implements Service { private EntityManagerFactory emf; private EntityManager em; public Service() { super(); emf = Peristence.createEntityManagerFactory("YourPU"); } @Override public EntityManager getEntityManager() { if (em == null || !em.isOpen()) { em = emf.createEntityManager(); } return em; } }
has comment: http://stackoverflow.com/comment/40381424
has comment: http://stackoverflow.com/comment/40450646
has comment: http://stackoverflow.com/comment/40450166
has comment: http://stackoverflow.com/comment/40381486
has comment: http://stackoverflow.com/comment/40449887
has comment: http://stackoverflow.com/comment/40450606
score: 0
has comment: http://stackoverflow.com/comment/40379416
type: AcceptedAnswer

http://stackoverflow.com/a/27624621
type: Answer
upvote count: 27
has body: You don't have to wait! If you look at the javadocs for resolveService(NsdServiceInfo serviceInfo, NsdManager.ResolveListener listener) here you'll notice that for the parameter listener it say's "to receive callback upon success or failure. Cannot be null. Cannot be in use for an active service resolution." Therefore in order for this to work just do the following: mNsdManager.resolveService(service, new MyResolveListener()); Where MyResolveListener is: private class MyResolveListener implements NsdManager.ResolveListener { @Override public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) { //your code } @Override public void onServiceResolved(NsdServiceInfo serviceInfo) { //your code } } hope this helps :)
accepted answer of: http://stackoverflow.com/q/25815162
downvote count: 0
answers question: http://stackoverflow.com/q/25815162
score: 27
has comment: http://stackoverflow.com/comment/43672469
type: AcceptedAnswer

http://stackoverflow.com/a/26471762
score: 0
type: Answer
has body: You should add a method like Thread.sleep(500) between request and response method in jamod library. Maybe this kind of error is usually caused by the length of response data. jamod library didn't consider the long size of response data. So, we need to request and wait until all data is received from the serial interface. Ff not, because all data is not received, CRC check will fail and cause an error.
answers question: http://stackoverflow.com/q/25842507

http://stackoverflow.com/q/25729467
tagged with: java
has comment: http://stackoverflow.com/comment/40225554
downvote count: 0
score: 1
accepted answer: http://stackoverflow.com/a/25729679
tagged with: struts2
has body: I am writing a custom socket appender for Log4J which attaches itself at runtime. The code i have so far is as below, Logger rootLogger = Logger.getRootLogger(); SocketAppender socketAppender = new SocketAppender(server, port); socketAppender.setReconnectionDelay(60000); socketAppender.setThreshold(Level.DEBUG); socketAppender.setName("server-socket"); rootLogger.addAppender(socketAppender); where server &amp; port is defined properly. I am using Struts2, so i get a log of useless logs (for me) from classes like freemarker.beans and freemarker.cache. How do I filter these classes from logging into Socket Appender above? I tried using Filters, but it does not seem to work. If someone can point me in the right direction, it would be very helpful. Cheers!
has title: log4j - how to programatically exclude some classes from logging
type: AnsweredQuestion
tagged with: log4j
favorite count: 0
type: Question
upvote count: 1
answer count: 1
tagged with: logging
has answer: http://stackoverflow.com/a/25729679

http://stackoverflow.com/comment/40470594
comment on: http://stackoverflow.com/q/25863256
type: QuestionComment
type: Comment
has text: Post some code what you tried till now.
score: 0

http://stackoverflow.com/a/31990282
has body: Hmm. Can't comment on the answer by matthew-adams. But that will reuse the session object as AbstractCassandraConfiguration is annotated with @Bean on all the relevant getters. In a similar setup I initially had it working with overwriting all the getters and specifically give them different bean names. But due to Spring still claiming to need beans with the names. I have now had to make a copy of AbstractCassandraConfiguration with no annotations that I can inherit. Make sure to expose the CassandraTemplate so you can refer to it from @EnableCassandraRepositories if you use those. I also have a separate implementation of AbstractClusterConfiguration to expose a common CassandraCqlClusterFactoryBean so the underlying connections are being reused. Edit: I guess according to the email thread linked by bclarance one should really attempt to reuse the Session object. Seems the way Spring Data Cassandra isn't really set up for that though
score: 0
has comment: http://stackoverflow.com/comment/52120824
type: Answer
answers question: http://stackoverflow.com/q/25770043

http://stackoverflow.com/a/25791136
has comment: http://stackoverflow.com/comment/40340145
score: 1
has body: Consider that your enum has behaviour, then each instance can have it's own implementation. public enum Dirs { NORTH { public Point move(Point p) { return p.move(0, 1); } }, SOUTH { public Point move(Point p) { return p.move(0, -1); } }, EAST { public Point move(Point p) { return p.move(1, 0); } }, WEST { public Point move(Point p) { return p.move(-1, 0); } } public abstract Point move(Point p); } class Point{ private final int x, y; public Point(int x, int y) { this.x = x; this.y = y; } public Point move(int dx, int dy) { return new Point(x + dx, y + dy); } } Now assert Dirs.NORTH.getClass() != Dirs.SOUTH.getClass(); while assert Dirs.NORTH.getDeclaringClass() == Dirs.SOUTH.getDeclaringClass(); Hope this helps.
upvote count: 2
has comment: http://stackoverflow.com/comment/40339055
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25790826
has comment: http://stackoverflow.com/comment/40340281

http://stackoverflow.com/a/25769850
has comment: http://stackoverflow.com/comment/40300037
type: Answer
has comment: http://stackoverflow.com/comment/40299907
answers question: http://stackoverflow.com/q/25769740
has body: Try running it in a thread. // Note: declare ProgressDialog progress as a field in your class. progress = ProgressDialog.show(this, "dialog title", "dialog message", true); new Thread(new Runnable() { @Override public void run() { // do the thing that takes a long time runOnUiThread(new Runnable() { @Override public void run() { progress.dismiss(); } }); } }).start();
score: 0

http://stackoverflow.com/comment/40367247
has text: When do you like to report a error?
comment on: http://stackoverflow.com/q/25806919
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25862966
has comment: http://stackoverflow.com/comment/40481099
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25861413
answers question: http://stackoverflow.com/q/25861413
upvote count: 2
has comment: http://stackoverflow.com/comment/40474178
has comment: http://stackoverflow.com/comment/40475426
has comment: http://stackoverflow.com/comment/40480755
has comment: http://stackoverflow.com/comment/40474848
type: AcceptedAnswer
has body: According to the Quartz tutorial, SimpleTrigger is intended to be used "if you need to have a job execute exactly once at a specific moment in time". There is also an example for this use case at http://www.quartz-scheduler.org/documentation/quartz-2.2.x/tutorials/tutorial-lesson-05: SimpleTrigger trigger = (SimpleTrigger) newTrigger() .withIdentity("trigger1", "group1") .startAt(myStartTime) // some Date .forJob("job1", "group1") // identify job with name, group strings .build(); ...Or is there a specific reason why you want to work with a cron expression here?
has comment: http://stackoverflow.com/comment/40475657

sockets
tags question: http://stackoverflow.com/q/25769579
tags question: http://stackoverflow.com/q/25751795
tags question: http://stackoverflow.com/q/25754634
tags question: http://stackoverflow.com/q/25798109
tags question: http://stackoverflow.com/q/25871733
tags question: http://stackoverflow.com/q/25770828
tags question: http://stackoverflow.com/q/25758267
tags question: http://stackoverflow.com/q/25824663
tags question: http://stackoverflow.com/q/25840595
tags question: http://stackoverflow.com/q/25798200
tags question: http://stackoverflow.com/q/25838289
tags question: http://stackoverflow.com/q/25827173
tags question: http://stackoverflow.com/q/25789785
type: Tag
tags question: http://stackoverflow.com/q/25768311
tags question: http://stackoverflow.com/q/25769206
tags question: http://stackoverflow.com/q/25843949
tags question: http://stackoverflow.com/q/25822363
tags question: http://stackoverflow.com/q/25760764
tags question: http://stackoverflow.com/q/25740672
tags question: http://stackoverflow.com/q/25823826
tags question: http://stackoverflow.com/q/25860563
tags question: http://stackoverflow.com/q/25732744
tags question: http://stackoverflow.com/q/25781371
tags question: http://stackoverflow.com/q/25713399
tags question: http://stackoverflow.com/q/25751845
tags question: http://stackoverflow.com/q/25761916
tags question: http://stackoverflow.com/q/25737684
tags question: http://stackoverflow.com/q/25863419
tag name: sockets
tags question: http://stackoverflow.com/q/25739768
tags question: http://stackoverflow.com/q/25855735
tags question: http://stackoverflow.com/q/25782488
tags question: http://stackoverflow.com/q/25740653
tags question: http://stackoverflow.com/q/25789594
tags question: http://stackoverflow.com/q/25848644
tags question: http://stackoverflow.com/q/25720414
tags question: http://stackoverflow.com/q/25772640
tags question: http://stackoverflow.com/q/25808766
tags question: http://stackoverflow.com/q/25800713

http://stackoverflow.com/a/25833137
accepted answer of: http://stackoverflow.com/q/25833088
has body: Try to use java.net.URLDecoder
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25833088
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25762775
has title: My JRadioButton change look with setOpaque(false)
tagged with: jradiobutton
type: AnsweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/40287232
tagged with: java
tagged with: look-and-feel
tagged with: transparent
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/25765251
type: Question
has comment: http://stackoverflow.com/comment/40287541
accepted answer: http://stackoverflow.com/a/25765251
has body: I want to remove the background of my JRadioButton but still keeping the same look &amp; feel. Images will speak by themselves: When I do this code: JRadioButton myJRadioButton = new JRadioButton("My JRadioButton"); add(myJRadioButton); I get this: And when I run it with this code: JRadioButton myJRadioButton = new JRadioButton("My JRadioButton"); myJRadioButton.setForeground(Color.white); //To see it on the black background. myJRadioButton.setOpaque(false); add(myJRadioButton); I get this: I've something like a "star" instead of a great and beautiful circle. And what I want is to keep the great and beautiful circle of the first image but without the default background according to it.
possible better answer: http://stackoverflow.com/a/25762914
has answer: http://stackoverflow.com/a/25762914
answer count: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40458626
comment on: http://stackoverflow.com/q/25856607
type: Comment
type: QuestionComment
score: 1
has text: Please also avoid "Thank you" and similar comments at the end of the question (but thank you for your courtesy!) We'd prefer "just the facts".

http://stackoverflow.com/q/25808492
tagged with: algorithm
has comment: http://stackoverflow.com/comment/40372339
score: 0
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25808537
has comment: http://stackoverflow.com/comment/40370137
tagged with: java
has title: Function to find remainder of a^b where a, b are positive integers
type: Question
has body: I was solving the problem using below code but I am getting a NullPointerException in the below line pw.println(fastMod(a,b,BigInteger.TEN)); I am getting NullPointerException while returning a BigInteger value. Please suggest and help me out. Thanks. import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.math.BigInteger; import java.util.StringTokenizer; public class ModularExponential { static StringTokenizer st; static BufferedReader br; static PrintWriter pw; private static BigInteger fastMod(BigInteger base, BigInteger exponent,BigInteger modulo) { BigInteger result = BigInteger.ONE; while (BigInteger.ZERO.compareTo(exponent) &gt; 0) { if (exponent.testBit(0)) result = (result.multiply(base)).mod(modulo); exponent = exponent.shiftRight(1); base = (base.multiply(base)).mod(modulo); } return result.mod(modulo); } public static String next() throws IOException{ while(! st.hasMoreTokens()) st = new StringTokenizer(br.readLine()); return st.nextToken(); } public static void main(String[] args) throws IOException{ st = new StringTokenizer(""); BigInteger a,b; br = new BufferedReader(new InputStreamReader(System.in)); int T = Integer.parseInt(br.readLine()); while(T-- &gt; 0) { a = new BigInteger(next()); b = new BigInteger(next()); pw.println(fastMod(a,b,BigInteger.TEN)); } } }

http://stackoverflow.com/a/25826566
score: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25823057
type: Answer
upvote count: 3
has body: ANTLR 4 generates a listener interface and base class (empty implementation) by default. If you also specify the -visitor flag when generating your parser, it will create a visitor interface and base class. Either of these features may be used to execute code using the parse tree rather than embedding actions directly in the grammar file.
accepted answer of: http://stackoverflow.com/q/25823057

http://stackoverflow.com/comment/40263886
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25749248
type: AnswerComment
has text: @T.BHassim add int min = array[0]; in above code and it will work.

http://stackoverflow.com/comment/40219300
has text: The `hm` declaration type should really be `HashMap<Integer, Integer>`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25726073

http://stackoverflow.com/comment/40235161
comment on: http://stackoverflow.com/q/25734275
score: 0
type: Comment
type: QuestionComment
has text: wrap it all in a while loop and set some flags in your catches

http://stackoverflow.com/comment/40435848
score: 0
comment on: http://stackoverflow.com/q/25843946
type: Comment
has text: try using classpath while compiling
type: QuestionComment

http://stackoverflow.com/comment/40410142
comment on: http://stackoverflow.com/q/25829683
score: 0
has text: We may should think about cleaning up here :D. I guess we can delete all comments except your `code-apprentice: tried with debugger, but couldn't come up with a solution.` comment.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25719195
accepted answer: http://stackoverflow.com/a/25719703
score: 0
has body: I hope this question qualifies as “a software algorithm” as per Stack Overflow's question guidelines. :) I have a Java Web Application which, as part of servicing Servlet requests, generates logging events which make callouts to a persistence provider. Each log event slows the response time of the servlet. pseudocode… doGet() { write log &lt; slow write log &lt; slow outputStream.write( response ) outputStream.close() } There is no need for these log events to occur synchronously. But rather than use a thread pool or some other voodoo, I had an idea to collect up these log events and only make these slower callouts after the servlet has written it’s content. Calling close on the output stream should encourage the servlet container (Tomcat in this case) to write the response right away. doGet() { stash log &lt; quick stash log &lt; quick outputStream.write( response ) outputStream.close() &lt; response goes to the client naow??? write log &lt; slow write log &lt; slow } The answers to these questions may be container specific as I think they are in the realm of undocumented behaviour. Is the response going to be flushed to the client after the stream close but before the doGet / doPost method returns (where I am doing this “slow” logging work)? Do Servlet Filter chains have any effect on this behaviour? Could the next incoming request, on a persistent connection or just from another client, block waiting for the servlet method to return? So I guess to overall question is Does the Servlet Container’s request dispatcher make use of the time between the servlet is called and the response is written, rather than expecting it to return immediately? And yes, before you suggest it, I should perform some experiments. :)
has title: Should I do heavy lifting after calling ServletOutputStream.close()?
has comment: http://stackoverflow.com/comment/40206642
type: AnsweredQuestion
tagged with: java
tagged with: servlets
type: Question
linked to: http://stackoverflow.com/q/1829784
has answer: http://stackoverflow.com/a/25719703
answer count: 1
tagged with: tomcat

http://stackoverflow.com/comment/40199986
comment on: http://stackoverflow.com/a/25715701
type: Comment
type: AnswerComment
has text: this is not an answer. :)
score: 0

http://stackoverflow.com/comment/40204964
comment on: http://stackoverflow.com/q/25718304
has text: Follow the link. see where it redirects you to
score: 0
type: Comment
type: QuestionComment

hudson
type: Tag
tags question: http://stackoverflow.com/q/25802432
tag name: hudson

variables
tag name: variables
tags question: http://stackoverflow.com/q/25809186
tags question: http://stackoverflow.com/q/25827991
tags question: http://stackoverflow.com/q/25799242
tags question: http://stackoverflow.com/q/25836068
tags question: http://stackoverflow.com/q/25754275
tags question: http://stackoverflow.com/q/25815570
type: Tag
tags question: http://stackoverflow.com/q/25820793
tags question: http://stackoverflow.com/q/25736377
tags question: http://stackoverflow.com/q/25798867
tags question: http://stackoverflow.com/q/25734251
tags question: http://stackoverflow.com/q/25800303
tags question: http://stackoverflow.com/q/25715696
tags question: http://stackoverflow.com/q/25832407
tags question: http://stackoverflow.com/q/25776525

http://stackoverflow.com/a/25753626
has body: .setBackgroundDrawable(Drawable) is deprecated, use setBackground(Drawable) Use this for API 17>: layout.setBackground(getResources().getDrawable(R.drawable.name_image)); and API 16 &lt; you use: layout.setBackgroundDrawable(getResources().getDrawable(R.drawable.name_image));
score: 0
answers question: http://stackoverflow.com/q/25753414
type: Answer

http://stackoverflow.com/comment/40571030
has text: There's a way. You can send the window to system tray. This will avoid accidental termination. For that, you will have to install a utility named `4t Tray Minimizer`. Google it. It is free. I tried it just now and it works.
score: 0
comment on: http://stackoverflow.com/a/25871201
type: Comment
type: AnswerComment

http://stackoverflow.com/comment/40359750
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25797803
score: 0
has text: You may need to modify soapUI factory files to enable them to read .java files or other workaround is you can write required java code only in soapui.

http://stackoverflow.com/comment/40387219
type: Comment
has text: It's for homework and I need to do it using regexp
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25817269

http://stackoverflow.com/q/25745094
downvote count: 1
type: AnsweredQuestion
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/40254671
type: Question
has title: Getting resultset from insert statement
possible better answer: http://stackoverflow.com/a/51050524
score: 4
favorite count: 0
tagged with: resultset
answer count: 3
tagged with: sql
has comment: http://stackoverflow.com/comment/40254600
has comment: http://stackoverflow.com/comment/40254695
has answer: http://stackoverflow.com/a/51050524
has comment: http://stackoverflow.com/comment/40255576
has body: i have the below code, where I'm inserting records to a table. When I try to get resultset, it returns null. How to get the latest added row into a resultset? String sql1 = "INSERT INTO [xxxx].[dbo].[xxxxxx](WORKFLOW_SEQ_NBR," + " WORKFLOW_LOG_TYPE_CODE, WORKFLOW_STATUS_CODE, DISP_CODE, DISP_USER, DISP_COMMENT, DISP_TITLE, DISP_TS)" + "VALUES(?,?,?,?,?,?,?,?)"; PreparedStatement pst = connect.prepareStatement(sql1); pst.setString(1, ...); pst.setString(2, ...); ... ... ... pst.executeUpdate(); ResultSet rstest = pst.executeQuery(); // ResultSet rstest = pst.getResultSet(); EDIT: Resolved added following method to go to the last added row st.execute("Select * from [xxxx].[dbo].[xxxxxxxxx]"); ResultSet rstest = st.getResultSet(); rstest.afterLast(); GETLASTINSERTED: while(rstest.previous()){ System.out.println(rstest.getObject(1)); break GETLASTINSERTED;//to read only the last row }
has answer: http://stackoverflow.com/a/25745117
has answer: http://stackoverflow.com/a/25745307
accepted answer: http://stackoverflow.com/a/25745307

http://stackoverflow.com/comment/40365430
has text: I have, but they miss out on a few details.
score: 0
comment on: http://stackoverflow.com/q/25805789
type: Comment
type: QuestionComment

http://stackoverflow.com/a/40959624
answers question: http://stackoverflow.com/q/25743734
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: go to your C:\Users\&lt;username&gt;\.gradle directory; find the gradle.properties file, if there is no such file, just create one. Finally, edit the gradle.properties file, add org.gradle.jvmargs=-Xmx512m to it.

http://stackoverflow.com/comment/40396065
type: Comment
has text: Is the column data type in the underlying table nvarchar instead of varbinary? If so, the column needs to be changed to varbinary.
comment on: http://stackoverflow.com/a/25822135
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40276641
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25756428
type: AnswerComment
has text: @Matt well yeah, that's why "modify it with your need". With 10^9 array it's already uses almost 4GB of memory.

http://stackoverflow.com/comment/40682947
score: 0
has text: What do you mean `@RelatedToVia` has precedence over `@RelationshipEntity`? There is never a situation where the two can be present in the same class?
type: Comment
comment on: http://stackoverflow.com/a/25970818
type: AnswerComment

http://stackoverflow.com/comment/40264432
type: Comment
comment on: http://stackoverflow.com/a/25730532
has text: what if input contains 1234 instead of ABA
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40203193
type: Comment
type: QuestionComment
has text: Add `<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>` in your android manifest file.
comment on: http://stackoverflow.com/q/25717336
score: 0

spring-ioc
tag name: spring-ioc
tags question: http://stackoverflow.com/q/25794995
type: Tag

http://stackoverflow.com/a/25796750
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40349752
has body: You can use this regex: \\\\a\\d+ Code Demo Since in Java you need to double escape the \\ once for String and second time for regex engine.
has comment: http://stackoverflow.com/comment/40349362
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/25796709

http://stackoverflow.com/comment/40255417
score: 0
comment on: http://stackoverflow.com/q/25745495
type: Comment
has text: You say it updates as "??????". How are you retrieving and displaying this value?
type: QuestionComment

http://stackoverflow.com/comment/40342169
type: Comment
has text: I think this could help : https://stackoverflow.com/questions/17227245/jackson-processing-json-with-multiple-types/17227456#17227456
comment on: http://stackoverflow.com/q/25789573
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40259993
has text: @AleksandrM it was me. I was trying to upvote it using the SO mobile app for android, but i think they've messed up the app and by accident I've downvoted. I've switched my vote, so now this answer is 2+. Please accept my apologies.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25731653

http://stackoverflow.com/a/25829101
downvote count: 0
answers question: http://stackoverflow.com/q/25829061
score: 1
has body: You need to declare values for a and n. Imagine you had an equation x + y = result. How could you know what the value of result is if you don't know the values of x and y? Same thing for your case. You are trying to compute what a^n equals but you don't give the program any values to compute. public class FermatsTheorem { public static void main(String[] args) { double a = 3.5; double n = 2.0; fermatsTheorem(a, n); } public static void fermatsTheorem(double a, double n){ double aToTheNthPower = Math.pow(a,n); System.out.println("Fermat's Last Theorem: " + aToTheNthPower); } }
upvote count: 1
type: Answer

http://stackoverflow.com/q/25828048
has comment: http://stackoverflow.com/comment/40444563
has comment: http://stackoverflow.com/comment/40443242
type: UnansweredQuestion
has title: Can Rubeloader be made to work with Intellij and latest libGDX which does not support JDK 1.6
has comment: http://stackoverflow.com/comment/40417818
has comment: http://stackoverflow.com/comment/40439195
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: box2d
type: Question
has comment: http://stackoverflow.com/comment/40418306
tagged with: libgdx
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/28549037
has comment: http://stackoverflow.com/comment/40416356
score: 0
has comment: http://stackoverflow.com/comment/40418150
has body: I am just starting to look at simple 2D game development and I have I am looking at using Intellij with libGDX (for its box2d and multiple platform support), RUBE (box2d GUI editor) and RubeLoader (reads RUBE json files and creates box2d world). I have have tested libGDX and Intellij with the Java jdk 1.8 and have resolved some project setting to get that working. I next tried to add the RubeLoader to a base Intellij setup with libGDX and an error tells me there is no support for jdk 1.6 in the project. I removed jdk 1.6 since it is incompatible with the latest version of libGDX. My question is what do I modify to get RubeLoader to work with the later jdk. Do I clone it and manually repoint everything - will that work? Has anyone else encountered this issue. Thanks
answer count: 1
has comment: http://stackoverflow.com/comment/40443960
has comment: http://stackoverflow.com/comment/51249343

http://stackoverflow.com/comment/40400726
type: Comment
has text: What do you gain by doing this?
comment on: http://stackoverflow.com/q/25825028
score: 2
type: QuestionComment

http://stackoverflow.com/a/52777157
downvote count: 0
upvote count: 2
has body: I had the same problem. Below solution worked for me: @Bean public Module hibernate5Module() { Hibernate5Module hnetModule = new Hibernate5Module(); hnetModule.disable(Hibernate5Module.Feature.USE_TRANSIENT_ANNOTATION); return hnetModule; } Thanks to m4rtin.
answers question: http://stackoverflow.com/q/25713884
type: Answer
score: 2

http://stackoverflow.com/a/25844966
score: 0
has comment: http://stackoverflow.com/comment/40437412
type: Answer
has comment: http://stackoverflow.com/comment/40437827
has body: Try to explore JSON, use json_encode in php, As well as try Using AsyncTask or better yet move to the Google Android Volley Library to stay with the latest / fastest reliable networking calls.
answers question: http://stackoverflow.com/q/25844862
has comment: http://stackoverflow.com/comment/40439288
has comment: http://stackoverflow.com/comment/40437720

http://stackoverflow.com/q/25872055
has answer: http://stackoverflow.com/a/25873390
has comment: http://stackoverflow.com/comment/40487083
has comment: http://stackoverflow.com/comment/40486638
has comment: http://stackoverflow.com/comment/40487384
has comment: http://stackoverflow.com/comment/40486809
has comment: http://stackoverflow.com/comment/40487974
has comment: http://stackoverflow.com/comment/40487583
tagged with: mouselistener
type: UnansweredQuestion
has body: I searched StackOverflow and found this question but I couldn't get it. How do I invoke a Java method when given the method name as a string? I have some JLabels and JPanels and each Label is working as a custom graphical button to change background color of a particular JPanel and as there are alot of these labels so I have created a custom MouseListener which is to change the background color of particular JPanel with the name each JLabel has. Now as these JLabels are giving name of calling JPanels in String value, I want something like this @Override public void mouseClicked(MouseEvent e) { e.getComponent().getName().setBackground(new COLOR.RED); } But I cannot do so. I just want to convert my string into JPanel's name.
tagged with: swing
has comment: http://stackoverflow.com/comment/40486609
has answer: http://stackoverflow.com/a/25878719
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/40487670
has comment: http://stackoverflow.com/comment/40487219
has title: Convert String into Component name in Java
type: Question
has comment: http://stackoverflow.com/comment/40487738
has answer: http://stackoverflow.com/a/25872184
has comment: http://stackoverflow.com/comment/40488935
answer count: 3
has comment: http://stackoverflow.com/comment/40487791
linked to: http://stackoverflow.com/q/160970
score: 0

http://stackoverflow.com/comment/40455182
score: 0
has text: @oardic the `waitFor` method should be used after the while loop. There could be deadlocks if you do not read from stdout/stderr streams. Anyway, in this simple case I do not think such thing could happen.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25853246

http://stackoverflow.com/q/25842156
has comment: http://stackoverflow.com/comment/40432710
has answer: http://stackoverflow.com/a/25843364
tagged with: constructor
has comment: http://stackoverflow.com/comment/40432999
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40433063
has comment: http://stackoverflow.com/comment/40432979
has comment: http://stackoverflow.com/comment/40432436
tagged with: java
has title: Writing a class in Java with a default constructor and configure method defining how an object of that class is initialized?
type: Question
tagged with: configure
has body: I'm new to programming in Java and previously only programmed in Python. I have to write a class that doesn't include a constructor but instead has a method that "configures" the class object. So as I understand it, the class object is created as an object with no content and then its content is set by the configure method. An array is passed into the configure method, but when I try to set the class object equal to the array it says it's a type mismatch - I either need to change the class object to an array or the array to a class object, which from what I understand is undefined at that point. What is the class object? How can I make it an array without a constructor? I'm so confused and there seems to be little reference material for this situation online. // UPDATE // Here's the configure method per your requests. I know you don't want English, but it's hard to explain just with a few lines of code - it's part of a larger program that finds the most efficient path across a map. There's a GUI Interface that operates through MapState that executes methods from BasicMapState and MapSolver that executes methods from BasicMapSolver. givenState is an array representing all the map tiles, with a 1 in the tile where the solver is currently located. I would ideally like to store the givenState array and a parent move (what direction the solver chose to get to the givenState) as attributes of the MapState class object, but I'm lost. Please help. public class BasicMapState implements MapState { @Override public void configureState(int[] givenState) { MapState current = givenState }
tagged with: arrays
tagged with: class
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40432452
has answer: http://stackoverflow.com/a/25842586

http://stackoverflow.com/q/25798776
has answer: http://stackoverflow.com/a/25798795
favorite count: 0
has answer: http://stackoverflow.com/a/25798816
has answer: http://stackoverflow.com/a/25798794
has comment: http://stackoverflow.com/comment/40353286
downvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40353292
has comment: http://stackoverflow.com/comment/40353439
tagged with: java
has title: Why does ArrayList do this?
has comment: http://stackoverflow.com/comment/40353385
has answer: http://stackoverflow.com/a/25798835
accepted answer: http://stackoverflow.com/a/25798794
has comment: http://stackoverflow.com/comment/40353350
has answer: http://stackoverflow.com/a/25798834
type: Question
has answer: http://stackoverflow.com/a/25798821
upvote count: 0
score: -2
answer count: 7
has answer: http://stackoverflow.com/a/25798871
tagged with: arraylist
has comment: http://stackoverflow.com/comment/40353458
possible better answer: http://stackoverflow.com/a/25798795
has body: I have several questions that need to be addressed. In this part of the code, al.add(1, "A2"); what does adding 1 do to the ArrayList? In the output, it doesn't look like adding 1 did anything to the arraylist. Also, in this part of the code, al.remove(2); seems to be removing A from the arraylist, but why is that? Shouldn't A be 3, since it's in the third place? import java.util.*; public class ArrayListDemo { public static void main(String args[]) { // create an array list ArrayList al = new ArrayList(); System.out.println("Initial size of al: " + al.size()); // add elements to the array list al.add("C"); al.add("A"); al.add("E"); al.add("B"); al.add("D"); al.add("F"); al.add(1, "A2"); System.out.println("Size of al after additions: " + al.size()); // display the array list System.out.println("Contents of al: " + al); // Remove elements from the array list al.remove("F"); al.remove(2); System.out.println("Size of al after deletions: " + al.size()); System.out.println("Contents of al: " + al); } } Here is the output of the codes: Initial size of al: 0 Size of al after additions: 7 Contents of al: [C, A2, A, E, B, D, F] Size of al after deletions: 5 Contents of al: [C, A2, E, B, D]

http://stackoverflow.com/a/25885803
answers question: http://stackoverflow.com/q/25744449
has comment: http://stackoverflow.com/comment/67607837
has comment: http://stackoverflow.com/comment/67613727
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25744449
has body: I just needed to add the machine with zookeeper in etc/hostsas &lt;ipaddress&gt; machine_name and then use the machine name in the url for JDBC connection.
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/67576094
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/67608812

http://stackoverflow.com/comment/40329786
type: Comment
comment on: http://stackoverflow.com/a/25783916
score: 0
type: AnswerComment
has text: You know, I have tried before without guava in my project and it is not working. I have nothing with Google-collections (too old) in my project. Puf.... @maaartinus

http://stackoverflow.com/q/25841540
type: Question
has title: Why there is no countOf method in the String Class?
upvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40431434
tagged with: string
has comment: http://stackoverflow.com/comment/40431506
favorite count: 0
has comment: http://stackoverflow.com/comment/40431524
has comment: http://stackoverflow.com/comment/40431746
has comment: http://stackoverflow.com/comment/40433698
downvote count: 6
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40433337
has answer: http://stackoverflow.com/a/25841675
score: -6
tagged with: java
has body: We have utility methods like indexOf and other ..Of() mehtods in String class of Java. But the countOf method would be nice to have. Is this method left intentionally? (and if so, that bring to the real question why?) or it did not occour to them?

http://stackoverflow.com/q/25814882
tagged with: ssl
has title: ConnectionException when connecting to Cassandra with DataStax Java driver 1.0.5
upvote count: 2
answer count: 1
has body: I have a 3 cassandra nodes (db-stats-01, db-stats-02, db-stats-03), which are all Up and Normal according to nodetool status. The client is essentially doing this: Builder builder = Cluster.builder(); builder.addContactPoint(node); context = getSSLContext(); String[] cipherSuites = SSLOptions.DEFAULT_SSL_CIPHER_SUITES; builder.withSSL(new SSLOptions(context, cipherSuites)).build(); and failing on the last line with the following exception: Sep 12 14:31:26 localhost daemon: Defuncting connection to db-stats-01/192.168.105.1 Sep 12 14:31:26 localhost com.datastax.driver.core.ConnectionException: [db-stats-01/192.168.105.1] Unexpected error during transport initialization (com.datastax.driver.core.ConnectionException: [db-stats-01/192.168.105.1] Operation Timeouted) Sep 12 14:31:26 localhost at com.datastax.driver.core.Connection.initializeTransport(Connection.java:182) Sep 12 14:31:26 localhost at com.datastax.driver.core.Connection.&lt;init&gt;(Connection.java:132) Sep 12 14:31:26 localhost at com.datastax.driver.core.Connection.&lt;init&gt;(Connection.java:60) Sep 12 14:31:26 localhost at com.datastax.driver.core.Connection$Factory.open(Connection.java:419) Sep 12 14:31:26 localhost at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:205) Sep 12 14:31:26 localhost at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:168) Sep 12 14:31:26 localhost at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:81) Sep 12 14:31:26 localhost at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:794) Sep 12 14:31:26 localhost at com.datastax.driver.core.Cluster$Manager.access$100(Cluster.java:721) Sep 12 14:31:26 localhost at com.datastax.driver.core.Cluster.&lt;init&gt;(Cluster.java:82) Sep 12 14:31:26 localhost at com.datastax.driver.core.Cluster.&lt;init&gt;(Cluster.java:67) Sometimes, but not everytime, I get the following error on the server side: DEBUG [New I/O worker #1] 2014-09-12…
favorite count: 0
tagged with: cassandra
score: 2
type: AnsweredQuestion
tagged with: cassandra-2.0
downvote count: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25899763
accepted answer: http://stackoverflow.com/a/25899763
tagged with: datastax-java-driver

synchronization
tags question: http://stackoverflow.com/q/25722743
tags question: http://stackoverflow.com/q/25782953
tags question: http://stackoverflow.com/q/25831964
tag name: synchronization
tags question: http://stackoverflow.com/q/25738581
type: Tag
tags question: http://stackoverflow.com/q/25764035
tags question: http://stackoverflow.com/q/25823888
tags question: http://stackoverflow.com/q/25863255
tags question: http://stackoverflow.com/q/25821149

http://stackoverflow.com/q/25776029
answer count: 1
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40312096
has title: Java entering value in non-primitive data types
tagged with: java
downvote count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/25776149
type: Question
has body: Could someone explain to me how reference (non-primitive) data types works? Mainly how to input data into them and how to check what data they are holding? Could you use this code as an example please. public class Example{ public static void main(String [] args){ Circle c= new Circle(); System.out.println(): } } public class Circle{ Circle round; public Circle(){ } public Circle numPlacment(){ round=new Circle(2); //I would like circle to contain the value of '2' return round; } public String toString(){ StringBuilder b= new StringBuilder(); b.append(round); return String.format("%4s",b); } }
score: -2
has comment: http://stackoverflow.com/comment/40311937
has comment: http://stackoverflow.com/comment/40311915
has comment: http://stackoverflow.com/comment/40312213
has comment: http://stackoverflow.com/comment/40311907
tagged with: type-conversion

http://stackoverflow.com/q/25868484
has title: How to enable new metrics on Ganglia from Hbase?
tagged with: ganglia
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/26545640
tagged with: metrics
favorite count: 0
has body: How can I enable new metrics to Ganglia from Hbase 0.98? for example: I have enabled the default metrics to monitoring from ganglia, but I would like to enable a specific metric in my cluster like this "blockCacheExpressCachingRatio" or others more. Thanks
tagged with: hbase
upvote count: 1
accepted answer: http://stackoverflow.com/a/26545640
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: hadoop

http://stackoverflow.com/a/25784838
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25784493
answers question: http://stackoverflow.com/q/25784493
score: 5
type: AcceptedAnswer
has body: The (simple) error is that s.replaceAll(...) does not change s but yields a new changed string: String s = outerList.get(i).get(j).replaceAll("[^\\w\\s]", ""); outerList.get(i).set(j, s);
upvote count: 5
type: Answer

http://stackoverflow.com/a/30113705
has body: I had this same problem when running through the First Steps chapter in The Cucumber for Java book. It says to download the latest version of the Gherkin jar (among others) from http://repo1.maven.org/maven2/info/cukes/gherkin/ Below is the listing, where, on the webpage, each one is a directory-link containing the jar. My mistake was thinking that the bottom-most version is the most recent version. It's not. For all of the other jars, the bottom-most is indeed the most recent version. When using the bottom-most Gherkin jar, I get the CNFX exactly as you describe: Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/lexer/Encoding Caused by: java.lang.ClassNotFoundException: gherkin.lexer.Encoding The version-number listing, as on the above webpage: 2.10.0/ 2.11.0/ 2.11.1/ 2.11.2/ 2.11.4/ 2.11.5/ 2.11.6/ 2.11.7/ 2.11.8/ 2.12.0/ 2.12.1/ 2.12.2/ 2.4.16/ 2.4.17/ 2.4.18/ 2.4.19/ 2.4.20/ 2.4.21/ 2.5.0/ 2.5.1/ 2.5.2/ 2.5.3/ 2.5.4/ 2.6.0/ 2.6.1/ 2.6.2/ 2.6.3/ 2.6.4/ 2.6.5/ 2.6.6/ 2.6.7/ 2.6.8/ 2.6.9/ 2.7.0/ 2.7.1/ 2.7.2/ 2.7.3/ 2.7.4/ 2.7.5/ 2.7.6/ 2.7.7/ 2.8.0/ 2.9.0/ 2.9.1/ 2.9.2/ 2.9.3/
type: Answer
upvote count: 4
score: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25790155

http://stackoverflow.com/comment/40424510
type: Comment
type: QuestionComment
has text: The callback must throw you an exception or error message. Look in your LogCat and see what it says and post it in your question.
comment on: http://stackoverflow.com/q/25835820
score: 0

http://stackoverflow.com/a/25735851
type: Answer
has body: change Intent Intent = new Intent(v.getContext(), EXOActivity.class); v.getContext().startActivity(Intent); To Intent intent = new Intent(MainActivity.this, EXOActivity.class); startActivity(intent);
has comment: http://stackoverflow.com/comment/40243490
has comment: http://stackoverflow.com/comment/40258883
answers question: http://stackoverflow.com/q/25735788
has comment: http://stackoverflow.com/comment/40238722
score: 0

http://stackoverflow.com/q/25852959
downvote count: 0
favorite count: 0
tagged with: gridpane
upvote count: 11
has answer: http://stackoverflow.com/a/30389544
has title: Center Align Rows of a GridPane in JavaFX
type: UnansweredQuestion
score: 11
has answer: http://stackoverflow.com/a/25853095
type: Question
has body: I have a GridPane in fxml that has a Text Title and 4 Buttons. The GridPane itself is center aligned, but all the buttons are left aligned inside the column of the grid. I know how to change the alignment of the items using Java code but this is not the ideal situation, as I would like all styling to be handled using FXML and CSS. Can anyone suggest the best way to center align elements of a cell in a GridPane view of JavaFX?
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/30387915
answer count: 3

http://stackoverflow.com/a/26014566
answers question: http://stackoverflow.com/q/25873067
type: Answer
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25873067
has body: DsfServiceEventHandler helped me. I am now able to catch MIBreakpointHitEvent events and retrieve file name, function name and src code line of the breakpoint.
has comment: http://stackoverflow.com/comment/125112362

http://stackoverflow.com/q/25846326
upvote count: 0
duplicate of: http://stackoverflow.com/q/9453068
favorite count: 0
tagged with: jframe
has comment: http://stackoverflow.com/comment/40440869
has answer: http://stackoverflow.com/a/25847096
has comment: http://stackoverflow.com/comment/40440025
score: -1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25846572
accepted answer: http://stackoverflow.com/a/25847096
tagged with: java
has answer: http://stackoverflow.com/a/25846572
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/40439591
type: Question
has title: How to bring to front a JFrame?
has body: I'm simply trying to bring to front a JFrame with a progress bar. I've been trying everything: this.progressFrame.setVisible(true); this.progressFrame.toFront(); this.progressFrame.repaint(); but the frame remains not visible, iconized, and the icon keeps flashing.
has comment: http://stackoverflow.com/comment/40439592
linked to: http://stackoverflow.com/q/9554636
answer count: 2
linked to: http://stackoverflow.com/q/9453068

http://stackoverflow.com/q/25851029
has body: I'm working with a table in a database and that table don't have a primary key or a proper column whith a unique value who can act as a primary key, I don't have permissions to alter that table. What should I do? I tried putting a @id annotation in a random column and it worked, but I don't know if this is going to bring any trouble later on. what can I do? My class @Entity @Table(name="my_table") public class TheTable { @Column (name="name", nullable=false) private String name; @Id &lt;--- I just put this id in this random column but this column should not be a id column @Column (name="anyfield", nullable=false) private String anyfield; }
favorite count: 0
has answer: http://stackoverflow.com/a/25851218
has answer: http://stackoverflow.com/a/70718232
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/77409689
has answer: http://stackoverflow.com/a/25851262
has comment: http://stackoverflow.com/comment/40448186
has answer: http://stackoverflow.com/a/77906335
has answer: http://stackoverflow.com/a/32693574
has comment: http://stackoverflow.com/comment/117913571
tagged with: spring-mvc
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25851499
tagged with: spring-data
has title: Org.Hibernate.AnnotationException: No Identifier Specified For Entity I don't have a id in my table
has answer: http://stackoverflow.com/a/40952979
type: Question
has answer: http://stackoverflow.com/a/41741633
has answer: http://stackoverflow.com/a/54029529
has answer: http://stackoverflow.com/a/79290546
has answer: http://stackoverflow.com/a/56365398
tagged with: jpa
has answer: http://stackoverflow.com/a/67811011
score: 53
has comment: http://stackoverflow.com/comment/63828405
answer count: 14
has answer: http://stackoverflow.com/a/33114283
upvote count: 53
downvote count: 0

http://stackoverflow.com/q/25854282
has title: How can I debug this Java code -- a POST request
type: Question
tagged with: forms
tagged with: post
score: 0
has comment: http://stackoverflow.com/comment/40454170
has comment: http://stackoverflow.com/comment/40454259
tagged with: http://stackoverflow.com/tag/html
answer count: 0
type: UnansweredQuestion
tagged with: java
has body: I have the following code, which is my attempt to fill out a POST body and submit. //get myIP as var via InetAddress and getHostAddress String query = URLEncoder.encode("ip!0", "UTF-8") +"=" + URLEncoder.encode(myIP, "UTF-8") + "&"+ URLEncoder.encode("abuse_address!0", "UTF-8") + "=" + URLEncoder.encode("abuse@123test", "UTF-8") + "&" +URLEncoder.encode("admin_username!0", "UTF-8") + " =" + URLEncoder.encode("admin", "UTF-8") + "&" +URLEncoder.encode("admin_password!0", "UTF-8") + "="+ URLEncoder.encode("pass", "UTF-8"); URL url = new URL("http://xx.x.x.xx/index.ws3?25334cvvssd522afmkkllmk"); // url has a unique hash URLConnection urlConnection = url.openConnection(); urlConnection.setDoOutput(true); OutputStreamWriter out = new OutputStreamWriter( urlConnection.getOutputStream()); out.write(query); out.flush(); BufferedReader in = new BufferedReader( new InputStreamReader(urlConnection.getInputStream())); String line = null; while ((line = in.readLine()) != null) { System.out.println(line); } out.close(); in.close(); Now when I run this, it is not posting, as the new entry doesn't show up on the webpage. The while loop that prints every line of the input stream echos what looks basically like the page source. I'll put it here: //scripts host_id ip abuse_address admin_username admin_password - In this response body, should I expect to see "abuse@123test" and "admin" etc like this? : admin How can I see a history to see where it is failing? It could be failing from several things. It could not be hitting the right page, it could be passing in the wrong parameters... How can I tell anything that is going on, in order to progress me towards successfully posting?

http://stackoverflow.com/comment/40325050
comment on: http://stackoverflow.com/q/25783497
has text: @MarkoTopolnik thanks this is the answer I want.Since I just begin to learn java. Too many types make me tired.
type: Comment
score: 2
type: QuestionComment

http://stackoverflow.com/comment/40443121
score: 0
comment on: http://stackoverflow.com/q/25847478
type: Comment
type: QuestionComment
has text: No...like I said, one of them can be blank

http://stackoverflow.com/q/25813325
type: UnansweredQuestion
has body: I am working on a JAVA Database Project. My database is derby database present in IDE Netbeans. I had made a jar file of my project. Database works only when IDE is in a running condition. When I run IDE and opens jar file, it's correctly fetches the data from the database. But, when I close IDE and then run jar file, the jar file runs but it doesn't connect to the database because of the terminated IDE. I want the jar file works same in both conditions i.e; running and terminated IDE. Any suggestions or solutions ? I have also cleaned and build my project many times but all in vain.
tagged with: netbeans
has comment: http://stackoverflow.com/comment/40379387
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40379393
type: Question
has comment: http://stackoverflow.com/comment/40379400
score: 0
linked to: http://stackoverflow.com/q/10085778
has title: jar file connection with Database
tagged with: jar

http://stackoverflow.com/comment/40304532
score: 0
type: AnswerComment
has text: For reverse its supposed to take two "Pairs" and compare them. The third if statement is the one I added. Even though it takes in an object I'm assuming that object must be a Pair for it to be equal to another pair so I used the .fst and .snd methods to compare them (via a .equals method) to the this.fst and this.snd. Am I close to having this correct or completely off base?
comment on: http://stackoverflow.com/a/25769747
type: Comment

http://stackoverflow.com/a/31016727
answers question: http://stackoverflow.com/q/25859782
type: Answer
has comment: http://stackoverflow.com/comment/50064500
upvote count: 7
downvote count: 0
has comment: http://stackoverflow.com/comment/50080567
has comment: http://stackoverflow.com/comment/50066433
has body: I can't see any built-in way of handling service versions in the documentation for the Eureka REST API. Therefore I think the best way of handling this would be to incorporate versioning information in your service IDs. Let's say we have 4 services: User, Statistics, Login, and oAuth. We've just updated the User service API to change functionality required for some new requirements in the Login service. These changes are however incompatible with the API that oAuth is using and no one has the time to update that service. The Statistics service isn't using any of this functionality so it doesn't care which version of the API is used. This means we need both the new version of the User service (1.2) and the old version (1.1) running at the same time. We can set it up like this: The configuration for the User 1.1 services says to register as "user-1.1" and "user" The configuration for the User 1.2 services says to register as "user-1.2" and "user" The configuration for the oAuth service says that the ID of the User service is "user-1.1" The configuration for the Login service says that the ID of the User service is "user-1.2" The configuration for the Statistics service says that the ID of the User service is "user" This way the oAuth service will only communicate with the old User service, the Login service with the new User service, and the Statistics service with any User service. You should be able to use Archaius to propagate the configuration to the servers. Note that if you release User version 1.3 that introduces changes incompatible with the parts of 1.2 and 1.1 that the Statistics service is using you will either have to tell the User 1.1 and 1.2 services to register themselves as something else too (like "user-statistics-safe") and tell the Statistics service to use that ID, or tell the Statistics service to use either "user-1.1" or "user-1.2".
has comment: http://stackoverflow.com/comment/85129021
score: 7
has comment: http://stackoverflow.com/comment/50066534

http://stackoverflow.com/comment/40395581
has text: Ok code above works if image is viewed by e.g. IrfanView
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25821371
score: 0

http://stackoverflow.com/a/25715029
answers question: http://stackoverflow.com/q/25714902
score: 0
type: Answer
has body: The issues that I can see in your code are the following: You forgot a quote when defining the file: public static File file = new File( C:\\Users\\N\\Desktop\\Newfolder\\Dictionary\\src\\nmishewa\\geekycamp\\dictionary\\bg_win1251.txt") should be: public static File file = new File("C:\\Users\\N\\Desktop\\Newfolder\\Dictionary\\src\\nmishewa\\geekycamp\\dictionary\\bg_win1251.txt"); The remove() function in a map receives only one parameter, which is the key of the entry you want to remove, so: map.remove(key.getKey(), key.getValue()); should be: map.remove(key.getKey()); Also, since your getting the entrySet of your map, maybe you should consider renaming the key variable in the rename() function to entry.

http://stackoverflow.com/comment/40226651
type: QuestionComment
comment on: http://stackoverflow.com/q/25730006
type: Comment
has text: Not without using JNI / JNA (at least not that I'm aware of.) Can't you just call the relevant DLL function using JNA? (I'm assuming that portability isn't a requirement considering we're talking about Windows specific error codes.)
score: 0

http://stackoverflow.com/comment/40336063
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25789526
has text: Why can the updater only call `main(...)`? Also, can you clarify under what circumstances the updater "calls" the main app? Is the updater already running (as a GUI app)? The use cases are not very clear.

http://stackoverflow.com/q/25712998
type: UnansweredQuestion
has body: i've got a problem with my Java Morsecode Translator. I made two arrays filled with the Characters and the MorseCode. If I want to translate Morsecode to text the method decode() public String decode(String mc) { StringBuilder sb2 = new StringBuilder(); // trim() removes whitespaces before or after String String mctrim = mc.trim(); //Morsecode has a short Pause (1 Whitespace) between every character //and a long Pause (3 Whitespaces) between words //Splitting the Morsecode to get chars if (mctrim.contains(kurzePause)) { String[] mcsplit2 = mctrim.split(kurzePause); for (int i = 0; i &lt; mcsplit2.length; i++) { sb2.append(getCharacter(mcsplit2[i])); } } return sb2.toString(); should get every character through the method getCharacter(). If the character is not listed in the array a '$' is displayed in the sentence. Now i've declared kurzePause (short Pause) and langePause (long Pause) as variables. A whitespace is not part of my array. How can I split the String that makes a distinction between a block of three whitespaces (longPause) and only one whitespace (shortPause) An example for a given output for a correct Morsecode (.--- .- ...- .- -- .- -.-. .... - ... .--. .- ... ... .-.-.-): JAVA$$MACHT$$SPASS. Thanks for your help!
tagged with: morse-code
has comment: http://stackoverflow.com/comment/40194836
score: 0
tagged with: java
type: Question
has title: Java Morsecode Translator
has answer: http://stackoverflow.com/a/25713291
has comment: http://stackoverflow.com/comment/40194983
answer count: 1

http://stackoverflow.com/comment/40473840
has text: I got the solution and posted below as answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25862411
score: 0

http://stackoverflow.com/q/25772747
score: 1
tagged with: java
has body: Does anyone know what this error mean, I looked at the xml file but I don't see the problem. The value of attribute "source" associated with an element type "Context" must not contain the '&lt;' character. server.xml /Servers/Tomcat v7.0 Server at localhost-config line 129 XML Problem Here is the snippet from server.xml &lt;Engine defaultHost="localhost" name="Catalina"&gt; &lt;!--For clustering, please take a look at documentation at: /docs/cluster-howto.html (simple how to) /docs/config/cluster.html (reference documentation) --&gt; &lt;!-- &lt;Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/&gt; --&gt; &lt;!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack --&gt; &lt;Realm className="org.apache.catalina.realm.LockOutRealm"&gt; &lt;!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. --&gt; &lt;Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/&gt; &lt;/Realm&gt; &lt;Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true"&gt; &lt;!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html --&gt; &lt;!-- &lt;Valve className="org.apache.catalina.authenticator.SingleSignOn" /&gt; --&gt; &lt;!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" --&gt; &lt;Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" pattern="%h %l %u %t &amp;quot;%r&amp;quot; %s %b" prefix="localhost_access_log." suffix=".txt"/&gt; &lt;Context docBase="MyService" path="/MyService" reloadable="true" source="org.eclipse.jst.jee.server:MyService"/&gt;&lt;/Host&gt; &lt;/Engine&gt;
type: Question
tagged with: jersey
tagged with: apache
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: Type The value of attribute "source" associated with an element type "Context" must not contain the '<' character. server.xml

http://stackoverflow.com/a/25760747
answers question: http://stackoverflow.com/q/25760617
has comment: http://stackoverflow.com/comment/40283600
downvote count: 0
has body: Is your junit launching the correct spring context? You added the correct xml paths to the test case like so? @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = { "/my-test-context.xml" }) public class TestCase{}
type: Answer
has comment: http://stackoverflow.com/comment/40289499
score: 2
has comment: http://stackoverflow.com/comment/40283531
upvote count: 2
has comment: http://stackoverflow.com/comment/40287407

http://stackoverflow.com/comment/40458604
type: AnswerComment
comment on: http://stackoverflow.com/a/25856596
score: 0
type: Comment
has text: Did you match the exact name of the JAR?

http://stackoverflow.com/a/25763141
upvote count: 2
has comment: http://stackoverflow.com/comment/40292066
has comment: http://stackoverflow.com/comment/40292336
downvote count: 0
answers question: http://stackoverflow.com/q/25762744
type: Answer
has body: On an API, you should only expose interfaces and business objects. Normally, these are on different maven artifacts than the implementation of the interfaces. In short: Make a maven project for domain objects, another for API interfaces, and another for API implementation. Then distribute to your clients only the first two. Concerning the dependencies: Implementation project should depend on both API and business objects projects. API project should depend only on business objects project. Business object project should depend on neither of both.
score: 2

http://stackoverflow.com/a/25953468
has body: I don't think #1 from your list is possible because compiler.jar would need to have native support for keeping the process alive, which it doesn't (and if you consider that a compression algorithm needs the entire input before it can start processing data, it makes sense that the process doesn't stay alive). According to Anyway to Boost java JVM Startup Speed? some people have been able to reduce their jvm startup times with nailgun Nailgun is a client, protocol, and server for running Java programs from the command line without incurring the JVM startup overhead. Programs run in the server (which is implemented in Java), and are triggered by the client (written in C), which handles all I/O.
type: Answer
answers question: http://stackoverflow.com/q/25755791
score: 0

http://stackoverflow.com/comment/40386839
has text: What if I need to add both Integer and Nodes object into the list? Is there any way we can do it?
comment on: http://stackoverflow.com/a/25817062
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40410806
type: QuestionComment
has text: Thanks for answer! Can you recommend js framework to work with Websockets if it possible more friendly with angularJs
score: 0
comment on: http://stackoverflow.com/q/25830457
type: Comment

http://stackoverflow.com/a/28041604
score: 3
downvote count: 0
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/25844095
has body: I find this question really important. I was looking exactly for the same answer. In my case it's even worse. We have 6GB as Xmx, and the output of gccapacity option shows that it is using almost 100% of the memory: [ec2-user@ip ~]$ sudo jstat -gccapacity 2416 OGCMX: 6121088.0 OGC: 6084776.0 And the output of the gcutil option: [ec2-user@ip ~]$ sudo jstat -gcutil 2416 S0 S1 E O P YGC 0.00 100.00 26.01 58.81 59.90 8555 Which means that it should be only using around 59% of the old generation. I don't understand this. This means that the JVM is taking the full capacity even if it is not using it...

http://stackoverflow.com/a/25793429
has comment: http://stackoverflow.com/comment/40356932
has comment: http://stackoverflow.com/comment/40354543
has body: If your code is like this then you first mock A. Then give it a behavior. A mockA = mock(A.class); when(mockA.getPropertyOfa()).thenReturn("testValue"); So when your A instance is called for property of A, it'll return "testValue".
score: 0
answers question: http://stackoverflow.com/q/25792479
type: Answer

http://stackoverflow.com/q/25856466
score: -5
has answer: http://stackoverflow.com/a/25856557
accepted answer: http://stackoverflow.com/a/25856557
tagged with: java
downvote count: 5
has body: this is the basic clear function public void clear() // Makes this StringLog empty. { log = null; } I wand to override it in child class and do It is important that the size field be kept up to date as the number of strings in the log change. For example, if the clear method is called, the size should be reset to zero. To ensure this, we need to override the clear method. So, write a new clear method in your MyStringLog class that not only clears all the content from the object, but also resets the size variable to zero. thank you
answer count: 1
has title: how to override clear function in java
has comment: http://stackoverflow.com/comment/40458365
favorite count: 0
has comment: http://stackoverflow.com/comment/40458283
has comment: http://stackoverflow.com/comment/40458335
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/40458293
type: Question
has comment: http://stackoverflow.com/comment/40458353

http://stackoverflow.com/q/25831817
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25831920
has comment: http://stackoverflow.com/comment/40441783
upvote count: 2
score: 1
tagged with: floating-point
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/13542944
tagged with: java
has answer: http://stackoverflow.com/a/25834542
has comment: http://stackoverflow.com/comment/40432377
linked to: http://stackoverflow.com/q/588004
has body: I'm working on a method that translates a string into an appropriate Number type, depending upon the format of the number. If the number appears to be a floating point value, then I need to return the smallest type I can use without sacrificing precision (Float, Double or BigDecimal). Based on How many significant digits have floats and doubles in java? (and other resources), I've learned than Float values have 23 bits for the mantissa. Based on this, I used the following method to return the bit length for a given value: private static int getBitLengthOfSignificand(String integerPart, String fractionalPart) { return new BigInteger(integerPart + fractionalPart).bitLength(); } If the result of this test is below 24, I return a Float. If below 53 I return a Double, otherwise a BigDecimal. However, I'm confused by the result when I consider Float.MAX_VALUE, which is 3.4028235E38. The bit length of the significand is 26 according to my method (where integerPart = 3 and fractionalPart = 4028235. This triggers my method to return a Double, when clearly Float would suffice. Can someone highlight the flaw in my thinking or implementation? Another idea I had was to convert the string to a BigDecimal and scale down using floatValue() and doubleValue(), testing for overflow (which is represented by infinite values). But that loses precision, so isn't appropriate for me.
tagged with: type-conversion
has comment: http://stackoverflow.com/comment/40424670
answer count: 2
has title: Determine smallest floating point type that can hold a string value
favorite count: 0

http://stackoverflow.com/q/25760691
has title: Aparapi multiple put/get seems to have no effects
has comment: http://stackoverflow.com/comment/40299865
tagged with: aparapi
score: 0
tagged with: opencl
tagged with: gpu
has comment: http://stackoverflow.com/comment/40308675
answer count: 0
type: UnansweredQuestion
type: Question
tagged with: java
has body: I am facing a problem by using explicit buffer management with Aparapi. The code hereafter shows that I am trying to manage several put/get in a loop to refresh/get-back data from GPU. It seems that the first put and get are done but not the others. import com.amd.aparapi // Dummy test to reproduce explicit buffer management public class QuickTestExplicit extends Kernel { private static final float DELTA = (float) 1E-5; // will be filled, put on GPU in each iterations private float[][] values; // will be filled with results, put in GPU once but retrieved several times private float[] currentRes; private void initData() { values = new float[2000][20]; currentRes = new float[2000]; } @Override public void run() { int id = getGlobalId(); long accum = 0; // simple sum of elements for (int index = 0; index &lt; 20; ++index) { accum += values[id][index]; } currentRes[id] = accum; } public void process() { boolean passed = true; initData(); if (isExplicit()) { put(currentRes); } for (int row = 0; row &lt; 2000; ++row) { for (int i = 0; i &lt; values.length; ++i) { for (int depth = 0; depth &lt; 20; ++depth) { values[i][depth] = (float) row; } } if (isExplicit()) { put(values); } execute(values.length); if (isExplicit()) { get(currentRes); } // just check the success of the operation (for the example) passed = true; for (int currentIndexRes = 0; currentIndexRes &lt; currentRes.length; ++currentIndexRes) { passed &amp;= Math.abs(currentRes[currentIndexRes] - (row * 20.0)) &lt; DELTA; } if (passed) { System.out.println("ROW " + row + " PASSED"); } else { System.out.println("ROW " + row + " FAILED"); } } } public static void main(String[] args) { QuickTestExplicit kern = new QuickTestExplicit(); kern.setExecutionMode(EXECUTION_MODE.GPU); kern.setExplicit(true); kern.process(); } } So my questions are: How to force the update of a large buffer already put in GPU memory ? Why, when I am running this piece of code with implicit buffer management, a SIGSEV is thrown ? I don't thin…

http://stackoverflow.com/q/25738649
answer count: 1
has comment: http://stackoverflow.com/comment/40243401
score: 0
has title: java.lang.IllegalStateException: No parser found for urn:security:1.1
has comment: http://stackoverflow.com/comment/40244272
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25740144
tagged with: java
tagged with: jboss
type: Question
accepted answer: http://stackoverflow.com/a/25740144
has body: I try to deploy my application on a jboss as 7.1. But i get this error: 08:52:29,543 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-14) MSC00001: Failed to start service jboss.deployment.unit."com.myapp.web.war".PARSE: org.jboss.msc.service.StartException in service jboss.deployment.unit."com.myapp.web.war".PARSE: Failed to process phase PARSE of deployment "com.myapp.web.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) [rt.jar:1.6.0_31] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.6.0_31] at java.lang.Thread.run(Thread.java:701) [rt.jar:1.6.0_31] Caused by: java.lang.IllegalStateException: No parser found for urn:security:1.1 at org.jboss.metadata.ejb.parser.spec.ExtendingMetaDataParser.mandatory(ExtendingMetaDataParser.java:49) at org.jboss.metadata.ejb.parser.spec.ExtendingMetaDataParser.getParser(ExtendingMetaDataParser.java:44) at org.jboss.metadata.ejb.parser.spec.ExtendingMetaDataParser.processElement(ExtendingMetaDataParser.java:79) at org.jboss.metadata.ejb.parser.jboss.ejb3.JBossAssemblyDescriptorMetaDataParser.processElement(JBossAssemblyDescriptorMetaDataParser.java:60) at org.jboss.metadata.ejb.parser.jboss.ejb3.JBossAssemblyDescriptorMetaDataParser.processElement(JBossAssemblyDescriptorMetaDataParser.java:40) at org.jboss.metadata.ejb.parser.spec.AbstractMetaDataParser.processElements(AbstractMetaDataParser.java:65) at org.jboss.metadata.ejb.parser.spec.ExtendingMetaDataParser.parse(ExtendingMetaDataParser.java:57) at org.jboss.metadata.ejb.parser.jb…

http://stackoverflow.com/comment/40314304
has text: lol so at least through some explanation so the OP can learn something.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25777324

http://stackoverflow.com/comment/40322180
type: Comment
comment on: http://stackoverflow.com/a/25780199
score: 1
has text: No, you can't. If the field is annotated, then it must be the field name. If the property is annotated, then it must be the property name.
type: AnswerComment

http://stackoverflow.com/comment/40473785
has text: I have done this code so that I get the dialog box on each activity of my app..I have tested for the Toast but it is coming fine but the dialog box is not coming...what should I do?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25862393
type: Comment

http://stackoverflow.com/q/25732467
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25732558
tagged with: eclipse
answer count: 2
has answer: http://stackoverflow.com/a/25732530
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40231453
has title: Why is my 3n+1 solution not working?
type: UnansweredQuestion
has body: My assignment for class is to write a method that Returns a string consisting of a Hailstone sequence beginning with the positive integer n and ending with 1. The string should consist of a sequence of numerals, with each numeral followed by a single space. When a numeral m (other than 1) appears in the sequence, it should be followed by nextHailstone(m). For example, nextHailstone(1) should return "1 " and nextHailstone(5) should return "5 16 8 4 2 1 ". I have the following code and can't figure out why it gets stuck in an infinite loop. public static int nextHailstone (int n) { if (n==1) { return n; } if (n%2 == 0) { return n/2; } else { return ((3*n)+1); } } public static String hailstones (int n) { String result = ""; result+=n; result+= ' '; while (true) { if (result.charAt(result.length()-2)=='1') { return result; } else { result +=(nextHailstone(result.charAt(result.length()-2)) + ' '); } } } Test cases: public void testHailstones () { assertEquals("1 ", hailstones(1)); assertEquals("16 8 4 2 1 ", hailstones(16)); assertEquals("7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 ", hailstones(7)); }
upvote count: 1

http://stackoverflow.com/q/25847561
score: 8
favorite count: 0
upvote count: 8
has answer: http://stackoverflow.com/a/26299982
tagged with: recursion
type: AnsweredQuestion
has title: Recursive objects to JSON
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40467397
type: Question
has comment: http://stackoverflow.com/comment/40442748
has comment: http://stackoverflow.com/comment/40441805
has comment: http://stackoverflow.com/comment/40442834
has comment: http://stackoverflow.com/comment/40441981
accepted answer: http://stackoverflow.com/a/26299982
has comment: http://stackoverflow.com/comment/40442070
has comment: http://stackoverflow.com/comment/40441930
has answer: http://stackoverflow.com/a/25848832
has comment: http://stackoverflow.com/comment/40441793
possible better answer: http://stackoverflow.com/a/25849065
answer count: 3
has body: Suppose I have the following code: public class A { B b; public A() { this.b = new B(this); } } public class B { A a; B(A a) { this.a = a; } } As you can see, those objects (A and B) are referring to eachother, causing an infinite recursion if you try to convert the objects to JSON code: A has B, which as the same A, which has the same B, et cetera, et cetera. But if I try to convert those objects to JSON, for example using Gson, a StackOverflowError raises, due to the recursion (which is, by the way, completely logical). Now is there a way in JSON to declare a recursion like this? If not, then is there a way to handle such recursion in JSON? Or do I have to manually check for recursion, remove it, convert the object to JSON, and reapply the recursion while rebuilding the JSON string to Java objects?
has answer: http://stackoverflow.com/a/25849065
downvote count: 0

http://stackoverflow.com/a/25826239
has body: You can't. You need to have the Bloomberg Terminal running on the machine where the API is being accessed and you're not allowed to send the information to another machine. This means that even if you stay logged in to a PC, and have that PC running a server application that takes requests from Android users and translates them into requests to the Bloomberg API - you're not complying with the Bloomberg Terminal license. The above assumes that you're referring to the Desktop API.
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25824418
answers question: http://stackoverflow.com/q/25824418
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/a/25806260
score: 0
has comment: http://stackoverflow.com/comment/40366448
has comment: http://stackoverflow.com/comment/40372677
has body: I often use try/NumberFormatException, to make sure the result is valid: (I suppose you fill an object's field with the value the user entered into the textbox) For example: try {mobjSomeObject.setSomeProp(Integer.parseInt(txtTextBox.getText()));} catch (NumberFormatException nFE) {... do something if not a number ...;}
type: Answer
answers question: http://stackoverflow.com/q/25805949
has comment: http://stackoverflow.com/comment/40371689
has comment: http://stackoverflow.com/comment/40366215
has comment: http://stackoverflow.com/comment/40433440

maven-eclipse-plugin
tag name: maven-eclipse-plugin
type: Tag
tags question: http://stackoverflow.com/q/25868938

http://stackoverflow.com/comment/40420398
has text: So you mean I would have to pass a null or something else as done above. Also, in case if I still remain with the same implementation, is there a better way to handle such a scenario.
score: 0
comment on: http://stackoverflow.com/q/25835535
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25779901
has body: I am creating an App that stores tasks. What would be a good way to store each task data on a cloud? I was thinking of using the free space google drive provides. Is that possible? Anything besides hosting my own server will be best. Any ideas?
favorite count: 0
possible better answer: http://stackoverflow.com/a/25780021
has answer: http://stackoverflow.com/a/25780222
has comment: http://stackoverflow.com/comment/40320824
has answer: http://stackoverflow.com/a/25780021
tagged with: android
has answer: http://stackoverflow.com/a/25780269
answer count: 4
type: AnsweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/16457039
type: Question
accepted answer: http://stackoverflow.com/a/25779994
has title: Storing data on "cloud"
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25779994
downvote count: 1

gwt
tags question: http://stackoverflow.com/q/25794598
tags question: http://stackoverflow.com/q/25759492
tags question: http://stackoverflow.com/q/25852414
tags question: http://stackoverflow.com/q/25851061
tag name: gwt
tags question: http://stackoverflow.com/q/25831473
tags question: http://stackoverflow.com/q/25744441
tags question: http://stackoverflow.com/q/25872672
tags question: http://stackoverflow.com/q/25726433
tags question: http://stackoverflow.com/q/25815500
tags question: http://stackoverflow.com/q/25777287
tags question: http://stackoverflow.com/q/25809772
type: Tag
tags question: http://stackoverflow.com/q/25809970
tags question: http://stackoverflow.com/q/25746173
tags question: http://stackoverflow.com/q/25791004
tags question: http://stackoverflow.com/q/25869416
tags question: http://stackoverflow.com/q/25743610
tags question: http://stackoverflow.com/q/25739519
tags question: http://stackoverflow.com/q/25805177
tags question: http://stackoverflow.com/q/25728158
tags question: http://stackoverflow.com/q/25733600
tags question: http://stackoverflow.com/q/25827041
tags question: http://stackoverflow.com/q/25868938
tags question: http://stackoverflow.com/q/25823593
tags question: http://stackoverflow.com/q/25728094
tags question: http://stackoverflow.com/q/25720647
tags question: http://stackoverflow.com/q/25805743
tags question: http://stackoverflow.com/q/25823550
tags question: http://stackoverflow.com/q/25766931
tags question: http://stackoverflow.com/q/25845615

http://stackoverflow.com/q/25769828
tagged with: sablecc
type: Question
accepted answer: http://stackoverflow.com/a/25770224
score: 0
tagged with: grammar
answer count: 1
has title: Problems With SableCC Grammar File
has answer: http://stackoverflow.com/a/25770224
type: AnsweredQuestion
has body: I seem to be having issues with SableCC generating the relevant lexer, node and parse stuff that it normally automatically generates from a grammar file. I'm not implementing an Abstract Syntax Tree at the moment. When I try to run SableCC with the grammar file below, I get the following error: [41,33] Redefinition of AFunctionHead.Id. I have know idea what the problem is, but it seems to be something in the productions area. Am I perhaps missing something? Package Grammar_Specification; Helpers digit = ['0'..'9']; letter = (['a'..'z'] | ['A'..'Z']); underscore = '_'; plus = '+'; minus = '-'; mult = '*'; div = '/'; equals = '='; l_par = '('; r_par = ')'; l_curly = '{'; r_curly = '}'; unicode_input_character = [0..0xffff]; lf = 0x000a; cr = 0x000d; line_terminator = lf | cr | cr lf; input_character = [unicode_input_character - [cr + lf]]; not_star = [input_character - '*'] | line_terminator; not_star_not_slash = [input_character - ['*' + '/']] | line_terminator; multi_line_comment = '/*' not_star+ '*'+ (not_star_not_slash not_star* '*'+)* '/'; line_comment = '//' input_character* line_terminator?; Tokens func = 'FUNC'; id = (letter(letter | digit | underscore)* | underscore(letter | digit | underscore)*); float_literal = minus? digit (digit)* ('.' (digit)*)? (('e' | 'E') (plus | minus)? digit (digit)*)?; whitespace = (' ' | '\t' | '\n' | '\r')+; comment = multi_line_comment | line_comment; Productions program = function_decl*statement*; function_decl = function_head function_body; function_head = func id l_par id r_par; function_body = l_curly statement* r_curly; statement = id equals expression; expression = expression plus term | expression minus term | term; term = term mult factor | term div factor | factor; factor = l_par expression r_par | identifier l_par expression r_par | float_literal | id;
tagged with: java

http://stackoverflow.com/comment/40315309
type: Comment
comment on: http://stackoverflow.com/a/25775697
score: 0
type: AnswerComment
has text: Can you help me with the toString part in the Dog class . I need the day, month, year and weight in it.

http://stackoverflow.com/comment/40226020
comment on: http://stackoverflow.com/a/25729609
type: AnswerComment
score: 0
type: Comment
has text: Excellent explanation. You nailed it!!

http://stackoverflow.com/a/25859812
answers question: http://stackoverflow.com/q/25859745
has comment: http://stackoverflow.com/comment/40464685
has body: You have the method code(int n) in the main class? If you want the codeTest class to use the method, you should first create the codeTest class, and then insert the code() method in that class. If you want to submit the int n to the code() and use only the mainclass, just remove the codeTest. public class Problem1 { public static void main(String[] args) { Scanner input=new Scanner(System.in); //Let user pick value of n System.out.println("Please pick a value of n."); int n=input.nextInt(); int result = code(n); } public static int code(int n) { int sum=0; for (int i=0; i&lt;n; i++) sum++; return sum; } }
has comment: http://stackoverflow.com/comment/40464678
score: 0
type: Answer

http://stackoverflow.com/a/25832491
score: 0
answers question: http://stackoverflow.com/q/25832432
type: Answer
has body: Try following code: public class Loop { public static void main(String[] argv) { int[] blockHeights = new int[] {1, 2, 3}; int totalBlockHeights = 0; for(int i = 0; i &lt; blockHeights.length; i++) { totalBlockHeights = 0; for(int j = i; j &lt; blockHeights.length; j++) { totalBlockHeights += blockHeights[j]; } System.out.println(totalBlockHeights); } } }

http://stackoverflow.com/a/25837704
has body: Maybe this questions and answers from StackOverflow can help you: What is the main difference between Inheritance and Polymorphism? How encapsulation is different from abstraction as a object oriented concept in java?
score: 0
answers question: http://stackoverflow.com/q/25837655
type: Answer

http://stackoverflow.com/q/25838341
tagged with: methods
type: Question
has comment: http://stackoverflow.com/comment/40425414
tagged with: long-integer
tagged with: java
score: 0
has title: Returning a long value from a method
has answer: http://stackoverflow.com/a/25838376
has comment: http://stackoverflow.com/comment/40425853
tagged with: arrays
answer count: 1
has comment: http://stackoverflow.com/comment/40425873
type: UnansweredQuestion
has body: I looked at other posts regarding this question but none of them seems to answer a weird question. I am not sure if I am understanding the question wrong. Return an array of long values from a method, use this as the return type for the method. OPTIONS: long, long[ ], [ ] long, long[ARRAY_SIZE] Method get() { return ? } Appreciate the help, I apologize if it seems obvious but too new programmers like me it seems like a trap in choosing between long and [ ]long. I only mention those two because I am fairly positive the other 2 are invalid.
has comment: http://stackoverflow.com/comment/40425436
has comment: http://stackoverflow.com/comment/40425421

http://stackoverflow.com/comment/40469785
type: AnswerComment
has text: While I'm not a fan of lambda expressions, that certainly looks less cluttered, nice example
comment on: http://stackoverflow.com/a/25780327
type: Comment
score: 0

http://stackoverflow.com/q/25806441
has answer: http://stackoverflow.com/a/25807412
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40366646
tagged with: inputstream
type: Question
has comment: http://stackoverflow.com/comment/40366726
has comment: http://stackoverflow.com/comment/40366848
has body: I have an InputStream object which contains several million file informations (Name, create date, author etc.) in XML format. I've already tried to convert it to String using IOUtils.copy method, but since the size of that information is pretty large it throws an java.lang.OutOfMemoryError, after running for few minutes. Increasing JVM memory is not an option, since the number of files, which I collect info from, is increasing forever. So can someone suggest me what should I do to solve the issue?
has comment: http://stackoverflow.com/comment/40368038
has comment: http://stackoverflow.com/comment/40366923
has title: Best way to convert an InputStream object to String
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/40366516
tagged with: string
has comment: http://stackoverflow.com/comment/40366648
favorite count: 0
score: 0
has comment: http://stackoverflow.com/comment/40366766
downvote count: 1
has comment: http://stackoverflow.com/comment/40366477
accepted answer: http://stackoverflow.com/a/25807412

http://stackoverflow.com/a/25847636
has body: You can swap .0 replaces with a regex (replaceAll("\\.[^1-9]+","" comes to mind), you can move the replaces to a map or utility class, have them happen only when Float.parseFloat(var) doesn't throw NumberFormatException... But there is no truly better way to do such arbitrary replaces. Those unicode strings have no intrinsic connection with the numbers they represent that you could use.
answers question: http://stackoverflow.com/q/25847075
score: 0
type: Answer

http://stackoverflow.com/a/25821023
score: 0
has comment: http://stackoverflow.com/comment/40443127
type: Answer
answers question: http://stackoverflow.com/q/25820897
has body: Since this sounds like homework, I'm just going to give you a few guidelines to the solution according to my interpretation to your question. If you have a sparsely populated array of length n and size m (m &lt; n), and you want to "free up" some memory, what you could do is create a new array of length m and simply move the elements to that array and let GC take care of everything else accordingly. However, using List interface is preferred, and if you need array-backed implementation, ArrayList. Note that ArrayList can indeed reserve more memory than the exaxt number of elements it contains, but if you wish, you can subclass List interface and provide your own implementation of your own ArrayList that grows by one as the insert is happening, or shrinks by one in case of removal. However, that implementation would be really bad because you would have to copy entire list before and after any editing operation, which would put a simple add and remove methods at O(n) time complexity, which is bad. Another alternative is using linkef lists, bur they inherently come with extra space overhead due to using non-primitive structures which contain actual elements as well as references to adjacent nodes.

http://stackoverflow.com/q/25847959
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/25871118
accepted answer: http://stackoverflow.com/a/25870814
tagged with: rest
answer count: 3
has body: What would you say to be the best approach when designing a web service that is supposed to return different representations (such as JSON, XML) of the same data. The requirement would be to have the business logic completely separated from the part that writes the actual XML/JSON response, depending on the "Accept" header received in the HTTP request. I figure this is a common problem which many web services have. Any tips/design patterns/wikis/projects you could help me with?
has comment: http://stackoverflow.com/comment/40443978
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
score: 2
possible better answer: http://stackoverflow.com/a/25848164
upvote count: 2
has answer: http://stackoverflow.com/a/25848164
has title: Web service that serve JSON/XML/etc. responses
tagged with: web-services
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25870814

http://stackoverflow.com/comment/40481599
comment on: http://stackoverflow.com/q/25868781
has text: I can see, so the session can be nothing but a thread local `Map` instance where you can store *per session* attributes. Each request then should be handled in a separate thread to have its onw session instance.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40245653
type: Comment
comment on: http://stackoverflow.com/a/25739927
has text: Thanks, I got the Frame. But how can I change the JPanel?
score: 0
type: AnswerComment

http://stackoverflow.com/tag/csv
type: Tag
tag name: csv
tags question: http://stackoverflow.com/q/25812976
tags question: http://stackoverflow.com/q/25849883
tags question: http://stackoverflow.com/q/25799196
tags question: http://stackoverflow.com/q/25864439
tags question: http://stackoverflow.com/q/25848991
tags question: http://stackoverflow.com/q/25860696
tags question: http://stackoverflow.com/q/25723446
tags question: http://stackoverflow.com/q/25786375
tags question: http://stackoverflow.com/q/25785026
tags question: http://stackoverflow.com/q/25782707
tags question: http://stackoverflow.com/q/25814226
tags question: http://stackoverflow.com/q/25817116
tags question: http://stackoverflow.com/q/25807201
tags question: http://stackoverflow.com/q/25829716
tags question: http://stackoverflow.com/q/25737927
tags question: http://stackoverflow.com/q/25869687
tags question: http://stackoverflow.com/q/25809746
tags question: http://stackoverflow.com/q/25871996
tags question: http://stackoverflow.com/q/25732053

urlconnection
tags question: http://stackoverflow.com/q/25793223
tag name: urlconnection
type: Tag

http://stackoverflow.com/a/25779732
score: 1
answers question: http://stackoverflow.com/q/25779623
has comment: http://stackoverflow.com/comment/40318546
has body: default isn't a value literal - it's a pseudocolumn (or at least I hope that's what they're called in postgres). Since it isn't a value but a part of insert's syntax, it can't be bound to a placeholder, just like the table name cannot.
downvote count: 0
has comment: http://stackoverflow.com/comment/40318459
upvote count: 1
has comment: http://stackoverflow.com/comment/40318630
type: Answer

http://stackoverflow.com/a/25796541
answers question: http://stackoverflow.com/q/25796441
downvote count: 0
has comment: http://stackoverflow.com/comment/40349045
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/40348966
has comment: http://stackoverflow.com/comment/40349119
has body: From the docs: http://developer.android.com/reference/android/os/AsyncTask.html Create your own class that extends AsyncTask Give the following generics Params(URL) Progress(In int format) Result(Long) In this example they are downloading multiple files. The idea is that it is running on a different thread: private class DownloadFilesTask extends AsyncTask&lt;URL, Integer, Long&gt; { protected Long doInBackground(URL... urls) { int count = urls.length; long totalSize = 0; for (int i = 0; i &lt; count; i++) { totalSize += Downloader.downloadFile(urls[i]); publishProgress((int) ((i / (float) count) * 100)); // Escape early if cancel() is called if (isCancelled()) break; } return totalSize; } protected void onProgressUpdate(Integer... progress) { setProgressPercent(progress[0]); } protected void onPostExecute(Long result) { showDialog("Downloaded " + result + " bytes"); } } Then to use: new DownloadFilesTask().execute(url1, url2, url3); If for some reason it still takes to long, you can tell android that this thread is importent, and Android will try and give it more time to run. Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25796441

http://stackoverflow.com/comment/40244545
type: AnswerComment
comment on: http://stackoverflow.com/a/25736464
has text: yeah, it looks like you have to statically pass the String in so as to avoid expensive computations :/ unfortunately this meant that i had to write a script that can parse out the java code in order to write up like a Tag for every class. thanks
type: Comment
score: 0

http://stackoverflow.com/comment/40427685
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25839344
has text: Does it mean starts with [ (or) ends with ] ?

http://stackoverflow.com/a/25857874
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/122598041
score: 2
has body: I got this working by adding the core.jar (com.google.zxing:core) and javase.jar (com.google.zxing:javase) to build path.
upvote count: 3
answers question: http://stackoverflow.com/q/25853682

http://stackoverflow.com/q/25729103
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/25729250
type: UnansweredQuestion
upvote count: 1
has title: JavaFX - Why are ChoiceBoxes parametrized?
tagged with: lambda
score: 1
tagged with: java
tagged with: javafx
type: Question
downvote count: 0
answer count: 1
has body: I'm studying JavaFX and I'm seeing about ChoiceBoxes. The question is simple: Why are choice boxes parametrized if they are supposed to carry heterogeneous data? A problem caused by this is the impossibility of implement the example of the oficial guide: http://docs.oracle.com/javase/8/javafx/user-interface-tutorial/choice-box.htm. I have this code: final String[] greetings = new String[] { "Hello", "Hola", "Olá"}; final ChoiceBox cb2 = new ChoiceBox( FXCollections.observableArrayList("English", "Español", "Portuguese")); final Label theText = new Label(greetings[0]); cb2.getSelectionModel().selectedItemProperty().addListener( (ObservableValue&lt;? extends Number&gt; ov, Number oldValue, Number newValue) -&gt; theText.setText(greetings[newValue.intValue()]) ); The compiler reports the lambda is not valid because it has incompatible types with the CheckBox class, that holds the String type, even it's not being parametrized. But if I parametrize CheckBox with &lt;Object&gt; I will need to cast the newValue to Number type, and in Runtime I get a ClassCastException saying it cannot cast String to number. Why do ChoiceBox class locks you to a unique type available? Choicebox should hold on heterogeneous data. Also: With this problem, how would I implement the oficial guide example?

http://stackoverflow.com/comment/40334299
type: QuestionComment
comment on: http://stackoverflow.com/q/25788937
type: Comment
has text: On which line is the NullPointerException thrown?
score: 2

http://stackoverflow.com/comment/40385255
has text: Sorry, you're right, this is not quite a duplicate. I'll reopen.
type: Comment
comment on: http://stackoverflow.com/q/25813654
type: QuestionComment
score: 0

http://stackoverflow.com/q/25717436
has comment: http://stackoverflow.com/comment/40205364
has comment: http://stackoverflow.com/comment/40211409
has comment: http://stackoverflow.com/comment/40208573
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40208593
has comment: http://stackoverflow.com/comment/40208656
has answer: http://stackoverflow.com/a/25720364
has answer: http://stackoverflow.com/a/56444941
score: 3
downvote count: 0
tagged with: java
tagged with: jaxb
tagged with: marshalling
type: Question
has comment: http://stackoverflow.com/comment/40208839
has answer: http://stackoverflow.com/a/25720878
has title: How to preserve XML comments with JAXB?
upvote count: 3
tagged with: unmarshalling
answer count: 3
has body: How to unmarshal and marshal a XML file without losing the comments? Is any way is there using JAXB, I tried example using following link but it doesn't work from me. 1 Billing Street 2 Shipping Road I want to unmarshal the above xml, add a new address to it and marshall it back without losing the following the comments.
has comment: http://stackoverflow.com/comment/40206583
has comment: http://stackoverflow.com/comment/40204650
favorite count: 0

http://stackoverflow.com/comment/40352261
type: Comment
comment on: http://stackoverflow.com/a/25796752
type: AnswerComment
has text: Java uses Unicode, not ASCII. 65 is the one (for some characters, two are required) UTF-16 code unit value for 'A', a 16-bit number.
score: 0

http://stackoverflow.com/a/25810802
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40374345
answers question: http://stackoverflow.com/q/25810466
has body: If you want to uniformly distribute method calls between a set of methods then there is a very simple way: Math.random Why? Because it provides the guarantee that this will return a number sampled from the range [0, 1) from a uniform distribution. This means that any number in the random is equally likely to be returned. This is, of course, random so in theory 0.0 could be returned every time from now until the end of time - that is the nature of randomness. But you mention "percentage chance" and that is exactly what this is. So we need to divide the range into 5 segments, then if the number is: in the first segment call method1 in the second or third segment call method2 in the fourth or fifth segment call method3 This equates to: final double random = Math.random() if(random &lt; 0.2) { method1(); } else if (random &lt; 0.6) { method2(); } else { method3(); }
has comment: http://stackoverflow.com/comment/40374325
has comment: http://stackoverflow.com/comment/40374518

http://stackoverflow.com/a/30450944
type: Answer
upvote count: 2
score: 2
downvote count: 0
has body: Best way is to add Jersey Response filter which will add the CORS headers for all the methods. You don't have to change your webservices implementation. I will explain for Jersey 2.x 1) First add a ResponseFilter as shown below import java.io.IOException; import javax.ws.rs.container.ContainerRequestContext; import javax.ws.rs.container.ContainerResponseContext; import javax.ws.rs.container.ContainerResponseFilter; public class CorsResponseFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { responseContext.getHeaders().add("Access-Control-Allow-Origin","*"); responseContext.getHeaders().add("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); } } 2) then in the web.xml , in the jersey servlet declaration add the below jersey.config.server.provider.classnames YOUR PACKAGE.CorsResponseFilter
answers question: http://stackoverflow.com/q/25860490

http://stackoverflow.com/comment/63849400
comment on: http://stackoverflow.com/a/37912499
score: 0
type: AnswerComment
type: Comment
has text: Wow @Gabor, you scored 100 at Codility test. Good job :)

http://stackoverflow.com/a/25746075
answers question: http://stackoverflow.com/q/25742968
type: Answer
upvote count: 1
score: 1
has body: Simple and effective way i will tell you using json.org and jackson-mapper-asl first create a class suppose its name is Person public class Person { private int id; private String name; private String location; //getters and setters @Override public String toString() { return "Person{" + "id=" + id + ", name='" + name + '\'' + ", location='" + location + '\'' + '}'; } } create another class suppose mainclass public static void main(String[] args) throws IOException, JSONException { String jsonString ="[{\"id\":1,\"name\":\"xxx\",\"location\":\"xx\"}, {\"id\":2,\"name\":\"yyy\",\"location\":\"yy\"}, {\"id\":3,\"name\":\"zzz\",\"location\":\"zz\"}]"; ObjectMapper mapper = new ObjectMapper(); JSONArray jsonArray = new JSONArray(jsonString); List&lt;Person&gt; listFromJsonArray = new ArrayList&lt;Person&gt;(); for(int i =0 ;i&lt;jsonArray.length();i++){ String firstObjectAsString = jsonArray.get(i).toString(); Person person = mapper.readValue(mapper.readTree(firstObjectAsString), Person.class); listFromJsonArray.add(person); } System.out.println(listFromJsonArray); } Now using the list get the individual Person objects get the individual values using getters and do whatever you want
downvote count: 0

http://stackoverflow.com/q/25838023
tagged with: android
tagged with: onclicklistener
has title: Every time I run the app the buttons work, but only in a sequential order
tagged with: java
has body: public class MyActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(),Travelling.class); startActivityForResult(intent, 0); Button button2 = (Button) findViewById(R.id.button2); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(),Rectangles.class); startActivityForResult(intent, 0); Button button3 = (Button) findViewById(R.id.button3); button3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(),Squares.class); startActivityForResult(intent, 0); Button button4 = (Button) findViewById(R.id.button4); button4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(),Triangles.class); startActivityForResult(intent, 0); Button button5 = (Button) findViewById(R.id.button5); button5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(),Circles.class); startActivityForResult(intent, 0); Button button6 = (Button) findViewById(R.id.button6); button6.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(),Cube.class); startActivityForResult(intent, 0); Button button7 = (Button) findViewById(R.id.button7); button7.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent intent = new Intent(view.getContext(),Cuboid.class); startActivityForResult(intent, 0); Button button8 = (Button) findViewById(R.id.button8); button8.setOnClickList…
type: UnansweredQuestion
answer count: 2
downvote count: 4
has comment: http://stackoverflow.com/comment/40424731
upvote count: 0
has answer: http://stackoverflow.com/a/25838178
score: -4
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/25838490

http://stackoverflow.com/comment/40340981
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25792382
score: 1
has text: While this is technically correct, you should not have a god ` ` for all your pages.

http://stackoverflow.com/a/25827685
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25825028
has body: You cannot instantiate something via an interface. You can only declare it as an interface. If your goal is to make addNum only accessible via iA and minusNum only accessible via iB, you can try explicit interface implementation (although it has its own drawbacks): class A : iA, iB { private int A; int iA.addNum() { A += 10; return A; } int iB.minusNum() { A -= 10; return A; } } This will at least give you the compile time effect you are looking for: class TestIface { public static void main(String args[]) { A testA = new A(); testA.minusNum(); // does not compile testA.addNum(); // does not compile iA testiA = new A (); testiA.minusNum();//does not compile testiA.addNum(); iB testiB = new A (); testiB.minusNum(); testiB.addNum();//does not compile } } However, this does not mean addNum is only accessible via a variable which is declared as iA. To illustrate, you can do: A testObj = new A (); (testObj as iA).addNum (); // this will compile You can even do: iB testObj = new A (); (testObj as iA).addNum (); // this will also compile, and execute fine If you want to further prevent the explicit casting from and to the concrete class, you need have to take the advice others have offered: make your concrete class a nested private class and introduce a factory to produce the instance: class Factory { private class A : iA, iB { int iA.addNum () {...} int iB.minusNum () {...} } public iA GetInstanceOfiA () { return new A (); } public iB GetInstanceOfiB () { return new A (); } } This still does not prevent the casting from iA to iB, which I guess you have to create two separate concrete classes to cater.
has comment: http://stackoverflow.com/comment/40468482
has comment: http://stackoverflow.com/comment/40476769

http://stackoverflow.com/q/25848746
tagged with: websphere
tagged with: rad
answer count: 1
has body: We've had this problem in RAD 7 with Websphere 7, and it's been an inconsistent nuisance, but we are moving to RAD 9 with Websphere 8.5.5 and it is a MUCH more consistent problem. What happens is that when starting the application server, it claims to finish starting, but the status from the servers tab doesn't finish, and RAD seems to almost lose conversation with the server. Eventually it reports that the server failed to start within 300 seconds, and tries to stop it, but, having lost communication, it doesn't actually stop. If you look at Task Manager, in fact, the server did start and is running. The browser talks to the webapps (assuming they were published in a prior session). If you restart RAD, RAD picks up the communication to the server and everything runs fine. But you had to restart to get there. Under RAD 7, this happened intermittently. Now that we're testing with RAD 9, it happens EVERY time. What's the fix/workaround for this?
favorite count: 0
has comment: http://stackoverflow.com/comment/40447610
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25849610
score: 2
has title: Websphere in RAD hangs on startup
downvote count: 0
tagged with: java
tagged with: eclipse
type: Question
upvote count: 2

http://stackoverflow.com/comment/40274622
score: 0
has text: 1) Oh sorry, I meant it to be nthPascal I was doing nthFibonaci first. And oh thank you for the java help. It's been a while since I've coded in java and I'm practicing doing it without and ide
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25755458

http://stackoverflow.com/comment/40449905
score: 0
comment on: http://stackoverflow.com/q/25789526
has text: Those requirements are really at odds with the way JavaFX is designed. In Java 8, for example, a JavaFX Application doesn't even have a requirement for a `main` method at all - consequently in Java 8 there are exceptions to the rule that all Java applications have a `main` method.
type: Comment
type: QuestionComment

lombok
type: Tag
tag name: lombok
tags question: http://stackoverflow.com/q/25852641
tags question: http://stackoverflow.com/q/25809156
tags question: http://stackoverflow.com/q/25765792

http://stackoverflow.com/a/42958172
score: 0
has comment: http://stackoverflow.com/comment/82966585
answers question: http://stackoverflow.com/q/25864316
has body: I didn't like any of the common XML formatting solutions because they all remove more than 1 consecutive new line character (for some reason, removing spaces/tabs and removing new line characters are inseparable...). Here's my solution, which was actually made for XHTML but should do the job with XML as well: public String GenerateTabs(int tabLevel) { char[] tabs = new char[tabLevel * 2]; Arrays.fill(tabs, ' '); //Or: //char[] tabs = new char[tabLevel]; //Arrays.fill(tabs, '\t'); return new String(tabs); } public String FormatXHTMLCode(String code) { // Split on new lines. String[] splitLines = code.split("\\n", 0); int tabLevel = 0; // Go through each line. for (int lineNum = 0; lineNum &lt; splitLines.length; ++lineNum) { String currentLine = splitLines[lineNum]; if (currentLine.trim().isEmpty()) { splitLines[lineNum] = ""; } else if (currentLine.matches(".*&lt;[^/!][^&lt;&gt;]+?(?&lt;!/)&gt;?")) { splitLines[lineNum] = GenerateTabs(tabLevel) + splitLines[lineNum]; ++tabLevel; } else if (currentLine.matches(".*&lt;/[^&lt;&gt;]+?&gt;")) { --tabLevel; if (tabLevel &lt; 0) { tabLevel = 0; } splitLines[lineNum] = GenerateTabs(tabLevel) + splitLines[lineNum]; } else if (currentLine.matches("[^&lt;&gt;]*?/&gt;")) { splitLines[lineNum] = GenerateTabs(tabLevel) + splitLines[lineNum]; --tabLevel; if (tabLevel &lt; 0) { tabLevel = 0; } } else { splitLines[lineNum] = GenerateTabs(tabLevel) + splitLines[lineNum]; } } return String.join("\n", splitLines); } It makes one assumption: that there are no &lt;> characters except for those that comprise the XML/XHTML tags.
has comment: http://stackoverflow.com/comment/82994597
type: Answer

http://stackoverflow.com/a/25797211
answers question: http://stackoverflow.com/q/25797175
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: 101011100 XOR 100011011 -------- 001000111 71 (in decimal) is correct

http://stackoverflow.com/q/25796090
type: UnansweredQuestion
score: 1
tagged with: java
type: Question
has body: I have written JSP that I used with many actions. It has a link with parameters The link: &lt;s:a namespace="/some" action="view"&gt; &lt;s:param name="purpose" value="%{purpose}"/&gt; &lt;s:param name="type" value="%{type}"/&gt; &lt;s:property value="%{name}"/&gt; &lt;/s:a&gt; The action class: public class ViewAction extends ActionSupport { private Long purpose; private Long type; private String name; public Long getPurpose() { return purpose; } public void setPurpose(Long purpose) { this.purpose = purpose; } public Long getType() { return type; } public void setType(Long type) { this.type = type; } public String getName() { return name; } public void setName(String name) { this.name = name; } } Usually I initialize both parameters, but sometimes one parameter is null. So, the link is generated with href like /context/some/view?purpose=1&amp;type= but I want to remove &amp;type= I tried an example from Param Examples. &lt;s:a namespace="/some" action="view"&gt; &lt;s:param name="purpose" value="%{purpose}"/&gt; &lt;s:param name="type" value="%{type}"/&gt; &lt;s:property value="%{name}"/&gt; &lt;s:param name="suppressEmptyParameters" value="true"/&gt; &lt;/s:a&gt; but it didn't work I also tried &lt;s:a namespace="/some" action="view"&gt; &lt;s:param name="purpose" value="%{purpose}"/&gt; &lt;s:param name="type" value="%{type}" suppressEmptyParameters="true"/&gt; &lt;s:property value="%{name}"/&gt; &lt;/s:a&gt; and I got java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String at org.apache.struts2.components.Param.end(Param.java:129) at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42) How to solve this problem?
tagged with: url-parameters
tagged with: struts2
upvote count: 3
has answer: http://stackoverflow.com/a/25796812
downvote count: 2
answer count: 1
tagged with: jsp
favorite count: 0
has title: Suppress empty parameters using param tag

http://stackoverflow.com/comment/40373049
type: QuestionComment
has text: Nobody? :/. Im really stuck on this.. :s
comment on: http://stackoverflow.com/q/25805166
score: 0
type: Comment

http://stackoverflow.com/comment/40522839
score: 0
comment on: http://stackoverflow.com/q/25872395
type: Comment
type: QuestionComment
has text: I seem to have found a better solution for this, do you know how could I get the text from 2 buttons using onItemClick from a GridView? @Luksprog

http://stackoverflow.com/comment/40413732
type: QuestionComment
comment on: http://stackoverflow.com/q/25831939
has text: The objective is not to print. I have an algorithm that checks if the puzzles match given a certain configuration. The only thing remaining is to permute in order to get all combinations and find a solution.
score: 0
type: Comment

http://stackoverflow.com/q/25742852
tagged with: java
has body: I'm writing some kind of framework, and within want to provide a specific feature that uses lucene (take lucene as an example of any feature here). So in my framework I definitely have to maven include the lucene library as dependency to be able to build the feature upon. Now I don't want to create a submodule for every feature, but rather have everything packed in a single jar library. And if the user wants to use the lucene-feature, he might activate it using Spring, and would also have to include the lucene libs with maven. But how can I achive this? So far I have the lucene library in my framework, and if I use this as a dependency, automatically the lucene libs are imported too, even if the feature is not used. How can I prevent this?
accepted answer: http://stackoverflow.com/a/25743534
type: Question
tagged with: frameworks
tagged with: maven-module
has answer: http://stackoverflow.com/a/25743534
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40251319
has title: How to exclude specific libraries by default in maven?
tagged with: maven
tagged with: spring
type: AnsweredQuestion
downvote count: 0
score: 1

http://stackoverflow.com/comment/40290616
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25764282
has text: can u explain little bit more about the `use case` of that `ImageView`
type: Comment

http://stackoverflow.com/comment/40273541
score: 0
comment on: http://stackoverflow.com/q/25754987
type: Comment
type: QuestionComment
has text: You really need to actually ask a question, rather than post a link to a compiler error... but youre missing a + in your string concat on the line where you print the sum

http://stackoverflow.com/a/25817134
has comment: http://stackoverflow.com/comment/40390592
has body: Attempt 3. Still O(n) but due to the special 0 case needing to cascade back up: static int banDigit(int number, int digit) { int length = (Integer.toString(number)).length(); int result = 0; boolean foundDigit = false; for (int i = length - 1; i &gt;= 0; i--) { if (!foundDigit) { int currentDigit = (int) number / ((int) Math.pow(10, i)); number = number % (int) Math.pow(10, i); if (currentDigit == digit) { //if nonzero digit banned, we can just decrement and purge 9 or 8 to right if (digit &gt; 0) { currentDigit--; } else { // we have to subtract one from the previous result = result - (int) Math.pow(10, i); //then we have to check if doing that caused a bunch of ones prior for (int j = i + 1; j &lt; length; j++) { if ((int) (result % (int) Math.pow(10, j + 1)) / (int) Math.pow(10, j) == 0) { result = result - (int) Math.pow(10, j); } } } foundDigit = true; } result += currentDigit * Math.pow(10, i); } else if (digit == 9) { result += 8 * Math.pow(10, i); } else { result += 9 * Math.pow(10, i); } } return result; }
has comment: http://stackoverflow.com/comment/40392970
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40392623
has comment: http://stackoverflow.com/comment/40387261
answers question: http://stackoverflow.com/q/25816333

http://stackoverflow.com/comment/40464785
type: QuestionComment
has text: how do I have a general response if none of the user answers match my predicted values?
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25859696

http://stackoverflow.com/q/25832614
upvote count: 1
tagged with: http
type: Question
has body: I have developed a Java program that uses org.apache.http, and I would like to reuse most of the functionality in an Android app. I would also like to still be able to use my library in my Java program as I add functionality to it. That's why I'm looking for a way to share a single component that I could improve over time, so that I don't have to replicate my modifications each time. I know that Android has a built-in Apache HTTP client and URLConnection, but I'm pretty sure that simply packaging my original program in a Jar with a common API won't directly work in Android, will it? I know I'll get answers like "try it and you'll see", that's actually what I'm about to do. But trying here would cost some time, that's why I'm asking beforehand if there would be a simple way to achieve this before I go into hard translation/integration work. Will I need for instance to create an adapter layer to really isolate the request building (with specific data) from the HTTP client? This sort of wrapper around HTTP-related stuff could delegate to Apache on the pure Java program, and to Volley (or anything else) on the Android plateform. I would be glad if there was a simpler way...
score: 1
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
tagged with: apache-httpclient-4.x
has title: Use common HTTP-related code for Android app and Java program
tagged with: android
has answer: http://stackoverflow.com/a/25832670
type: UnansweredQuestion

http://stackoverflow.com/q/25819934
has body: This is my xml, need to convert it into java. I had used jaxb &lt;?xml version="1.0"?&gt; &lt;lm:order Id="PLG24M240U" JD="" aCount="2" SUCount="1" xmlns:lm="http://www.ae.com/Event/Load"&gt; &lt;lm:master&gt; &lt;lm:ID&gt;3&lt;/lm:ID&gt; &lt;lm:Number&gt;313&lt;/lm:Number&gt; &lt;lm:ANumber&gt;323&lt;/lm:ANumber&gt; &lt;/lm:master&gt; &lt;lm:detail&gt; &lt;lm:ID&gt;3&lt;/lm:ID&gt; &lt;lm:Number&gt;3131&lt;/lm:Number&gt; &lt;lm:ANumber&gt;3232&lt;/lm:ANumber&gt; &lt;/lm:detail&gt; &lt;lm:detail&gt; &lt;lm:ID&gt;3&lt;/lm:ID&gt; &lt;lm:Number&gt;3131&lt;/lm:Number&gt; &lt;lm:ANumber&gt;3232&lt;/lm:ANumber&gt; &lt;/lm:detail&gt; &lt;lm:detail&gt; &lt;lm:ID&gt;3&lt;/lm:ID&gt; &lt;lm:Number&gt;313&lt;/lm:Number&gt; &lt;lm:ANumber&gt;323&lt;/lm:ANumber&gt; &lt;/lm:detail&gt; &lt;/lm:order&gt; And throwing the following exception javax.xml.bind.UnmarshalException: unexpected element (uri:"http://www.ae.com/Event/Load", local:"Order"). Expected elements are &lt;{}lm:Order> This is my unmarshalling code jaxbContext = JAXBContext.newInstance(Order.class); Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); Order order = (Order) jaxbUnmarshaller.unmarshal(file); System.out.println(order ); Order Pojo class import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; @XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "lm:Order") public class OrderPay { @XmlAttribute private String Id; @XmlAttribute private String JD; @XmlAttribute private String aCount; @XmlAttribute private String pCount; /*@XmlElement private Master master; @XmlElement private List&lt;Detail&gt; details = new ArrayList&lt;Detail&gt;();*/ } Can you please help me in reading also, currently reading through file, need to read as an XML String.
has title: jaxb unmarshalling with namespace
score: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25820357
tagged with: namespaces
type: Question
tagged with: java
tagged with: jaxb
accepted answer: http://stackoverflow.com/a/25820357
has comment: http://stackoverflow.com/comment/40392767
tagged with: xml-parsing
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 8

http://stackoverflow.com/a/25841924
type: AcceptedAnswer
downvote count: 0
has body: You have misplaced braces here , &lt;c:when test="${(list.IS_SECRET_YN eq 'Y' &amp;&amp; (session.USER_TYPE eq null || session.USER_TYPE ne 'A' ))) }"&gt; On removing, &lt;c:when test="${(list.IS_SECRET_YN eq 'Y' &amp;&amp; (session.USER_TYPE eq null || session.USER_TYPE ne 'A' ))}"&gt; &lt;/c:when&gt; NOTE : If you are trying to access the variables from session , use sessionScope.varName to get their values . Hope this helps !!
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/25840092
upvote count: 2
answers question: http://stackoverflow.com/q/25840092

http://stackoverflow.com/comment/40333515
type: QuestionComment
comment on: http://stackoverflow.com/q/25787073
has text: I'm assuring you, it is working. [Take a look here.](http://regex101.com/r/gJ0nE3/1)
score: 0
type: Comment

http://stackoverflow.com/a/28722088
type: Answer
answers question: http://stackoverflow.com/q/25804199
score: 0
has body: I had exactly the same issue as this and it was because I had changed the ant build file so that it was setting the java source and java target to 1.7 and not the default 1.5. It seems that the build server doesn't like anything above 1.5

finite-automata
tags question: http://stackoverflow.com/q/25828694
type: Tag
tag name: finite-automata

http://stackoverflow.com/a/25726976
answers question: http://stackoverflow.com/q/25726425
score: 0
has body: I'm not sure if i understood you well but try following code: public class Main { public static void main(String[] argv) { String input = "gudmor,ningeveryone,Have a great day,thankssssssssssss"; String[] firstSplit = input.split(","); List&lt;String&gt; result = new ArrayList&lt;&gt;(); String[] tmpArray; for (String elem : firstSplit) { if (elem.length() &lt;= 10) { result.add(elem); } else { for(int i = 0;i &lt; elem.length()/10;i++) { result.add(elem.substring(i*10,(i+1)*10)); } if(elem.length() % 10 != 0) { result.add(elem.substring(elem.length() - (elem.length() % 10))); } } } } }
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25726425

http://stackoverflow.com/comment/40434232
comment on: http://stackoverflow.com/q/25842161
type: QuestionComment
score: 1
has text: Another IMO cleaner way of doing this is via the manifest file: http://maven.apache.org/plugin-developers/cookbook/add-build-time-to-manifest.html
type: Comment

http://stackoverflow.com/comment/40332523
type: QuestionComment
comment on: http://stackoverflow.com/q/25788014
has text: And what is hosted on your Tomcat? A REST application, a Web application, ...?
score: 0
type: Comment

http://stackoverflow.com/q/25717928
tagged with: eclipse
score: 3
has answer: http://stackoverflow.com/a/25718869
downvote count: 0
favorite count: 0
tagged with: nullpointerexception
type: Question
tagged with: android
has body: I've problem with onActivityResult only on KitKat devices , when user selected image or any file the application get force closed,I checked Crashes &amp; ANRS from google developer console and i found this Error STACK TRACES 1.1:Application version Android version 4.3 Y530 (hwY530-U00) Device java.lang.RuntimeException: Unable to resume activity {packageName.New_Post}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2803, result=-1, data=Intent { dat=content://media/external/images/media/3528 flg=0x1 }} to activity {packageName.New_Post}: java.lang.NullPointerException at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3012) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3041) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2393) at android.app.ActivityThread.access$900(ActivityThread.java:148) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1319) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5457) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:854) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:670) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2803, result=-1, data=Intent { dat=content://media/external/images/media/3528 flg=0x1 }} to activity {packageName.New_Post}: java.lang.NullPointerException at android.app.ActivityThread.deliverResults(ActivityThread.java:3614) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2999) ... 12 more Caused by: java.lang.NullPointerException at packageName.New_Post.onActivityResult(New_Post.java:343) at android.app.Activity.dispatchActivityRes…
upvote count: 3
has title: Android KitKat Failure delivering result ResultInfo?
tagged with: java
tagged with: android-intent
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/40272947
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25754616
has text: If you use setMinimumSize() instead of setSize(), the GUI will not shrink down to nothing when pack() is used on a null layout. pack() shrinks the GUI down to the **minimum size**.
type: AnswerComment

http://stackoverflow.com/q/25852287
has title: Getting a line to move along the tangent line of a circle in Processing
score: 3
upvote count: 3
tagged with: java
has body: I have a point following the path of a circle, and at a determined time, I want that point to "break" off and travel along the tangent line. How do I find this? I've been told that the derivative is x = -sin(time) and y = -sin(time) (not sure if I understand the "time" part of what I was told), but I don't see how that is enough to get my point to travel along this line. Any tips? Here is what I have currently. /* Rotor draws circle for random period of time, then moves in a straight direction for a random period of time, beginning a new circle */ Rotor r; float timer = 0; boolean freeze = false; void setup() { size(1000, 600); smooth(); noFill(); frameRate(60); background(255); timeLimit(); r = new Rotor(100, 100, random(40, 100)); } void draw() { timer = timer + frameRate/1000; if(timer &gt; timeLimit()) { timer = 0; timeLimit(); if(freeze == true) { freeze = false; } else { freeze = true; } } if(!freeze) { r.drawRotor(); } else { r.holdSteady(); } } float timeLimit() { float timeLimit = random(100); return timeLimit; } Rotor Class: class Rotor { color c; int thickness; float xPoint; float yPoint; float nXPoint; float nYPoint; float radius; float angle = 0; float centerX; float centerY; float pointSpeed = frameRate/100; Rotor(float cX, float cY, float rad) { c = color(0); thickness = 1; stroke(c); strokeWeight(thickness); centerX = cX; centerY = cY; radius = rad; } void drawRotor() { angle = angle + pointSpeed; xPoint = centerX + cos(angle) * radius; yPoint = centerY + sin(angle) * radius; ellipse(xPoint, yPoint, thickness, thickness); strokeWeight(2); ellipse(centerX, centerY, 5, 5); } void holdSteady() { xPoint = -sin(angle);//need tangent of circle yPoint = -cos(angle); ellipse(xPoint, yPoint, 4, 4); //then set new center x and y } void drawNewRotor(float cX, float cy, float rad) { } }
type: Question
tagged with: processing
has answer: http://stackoverflow.com/a/25853638
tagged with: calculus
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/40267837
type: AnswerComment
score: 0
type: Comment
has text: @Nikhil:- Updated the answer to handle multiple formats of dates.
comment on: http://stackoverflow.com/a/25751984

http://stackoverflow.com/comment/40206153
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25717795
has text: I redefined `i` as a short, so no casting required.
type: AnswerComment

http://stackoverflow.com/a/25757645
answers question: http://stackoverflow.com/q/25757336
has comment: http://stackoverflow.com/comment/40278355
type: AcceptedAnswer
type: Answer
has body: You have to transfer the content to the activity and then load it to your new ImageView. Bitmap bmap = Bitmap.createBitmap(imageView.getDrawingCache()); ByteArrayOutputStream stream = new ByteArrayOutputStream(); bmap.compress(Bitmap.CompressFormat.PNG, 50, stream ); byte[] bytes = stream .toByteArray(); Intent i = new Intent(this, newActivity.class); i.putExtra("BMP",bytes); startActivity(i); And in the new activity just decode the bitmap; byte[] bytes = getIntent().getByteArrayExtra("BMP"); Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length); newImageView.setImageBitmap(bitmap);
has comment: http://stackoverflow.com/comment/40278461
score: 0
accepted answer of: http://stackoverflow.com/q/25757336

http://stackoverflow.com/a/25815733
score: 2
downvote count: 0
type: AcceptedAnswer
has body: So what I had to do was just create another ImageView, then change the opacity of one of the image views. Here is the FXML: <Image url="@../img/drag_drop.png"/> <Image url="@../img/drag_drop_hover.png"/> And here is the code: KeyFrame kf1 = new KeyFrame(Duration.seconds(0), new KeyValue(imageViewHover.opacityProperty(), 0)); KeyFrame kf2 = new KeyFrame(Duration.seconds(.5), new KeyValue(imageViewHover.opacityProperty(), 1)); KeyFrame kf3 = new KeyFrame(Duration.seconds(1.5), new KeyValue(imageViewHover.opacityProperty(), 1)); KeyFrame kf4 = new KeyFrame(Duration.seconds(2), new KeyValue(imageViewHover.opacityProperty(), 0)); Timeline timelineOn = new Timeline(kf1, kf2, kf3, kf4); timelineOn.setCycleCount(Timeline.INDEFINITE); What it does is to create a "blink" effect between the two ImageViews.
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40385140
answers question: http://stackoverflow.com/q/25809412
accepted answer of: http://stackoverflow.com/q/25809412

rpc
tag name: rpc
tags question: http://stackoverflow.com/q/25849912
type: Tag

http://stackoverflow.com/comment/40548346
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25892610
has text: this shows you are using Spring 4.0.7 as you are relying on Spring Boot 1.1.6, override the spring version to use 4.1.0.RELEASE

http://stackoverflow.com/comment/40397803
comment on: http://stackoverflow.com/q/25823378
type: Comment
type: QuestionComment
has text: Java 8 ***is*** java 1.8...
score: 4

http://stackoverflow.com/q/25826894
has comment: http://stackoverflow.com/comment/40405806
has answer: http://stackoverflow.com/a/25826975
has comment: http://stackoverflow.com/comment/40404306
has title: Array of Arbitrary Type
upvote count: 2
has body: I have just started programming in Java again and I am having some trouble. What I want to do is create an object that will be an array of arbitrary dimension. That is it will be an array of arrays of arrays... and so on. What I was thinking of doing was making a class that is an array of arbitrary objects. Thus I could just create the multidimensional array of dimension d by making an array of multidimensional arrays with dimension d-1. The code, I think, would look something like this: Array[] multiArray; public MArray(int d){ if(d&lt;0){MArray(d) = null;} else{multiArray = MArray(d-1);} } However I don't know if Array[] is the correct thing to do to create an array of arbitrary objects. I seem to recall when I was learning Java a few years ago there was a way you could it but I can't remember and my Google searches are proving fruitless.
type: UnansweredQuestion
type: Question
score: 2
tagged with: java
tagged with: arrays
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40404385
favorite count: 0
has comment: http://stackoverflow.com/comment/40404237
tagged with: multidimensional-array

http://stackoverflow.com/comment/40345503
comment on: http://stackoverflow.com/q/25794733
score: 0
type: QuestionComment
has text: Can you post a full example? I don't get the exception when using the code you've provided with missing code filled (assumptions).
type: Comment

http://stackoverflow.com/a/25816108
has comment: http://stackoverflow.com/comment/40483364
has comment: http://stackoverflow.com/comment/40483338
accepted answer of: http://stackoverflow.com/q/25812599
type: Answer
has comment: http://stackoverflow.com/comment/40455892
has body: The class will have to be available on the class path visible to Solr, usually through a .jar file available in one of the configured lib directories (or you can add your own to your solr configuration file (solrconfig.xml - any paths will be relative to this file in a &lt;lib&gt; entry). See How to Load Plugins for more information about how Solr finds your plugin code. Your transformer will then receive the whole row from the DB, where you can read the file path and add new columns to the row returned to the DIH importer to be included in your document.
has comment: http://stackoverflow.com/comment/40446513
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25812599
has comment: http://stackoverflow.com/comment/40446558

http://stackoverflow.com/a/36506293
type: Answer
answers question: http://stackoverflow.com/q/25766425
score: 0
has body: Try this code .I test in android 5.0.1 : public boolean setHotSpot(String SSID,String passWord){ Method[] mMethods = mWifiManager.getClass().getDeclaredMethods(); for(Method mMethod: mMethods){ if(mMethod.getName().equals("setWifiApEnabled")) { WifiConfiguration netConfig = new WifiConfiguration(); if(passWord==""){ netConfig.SSID = SSID; netConfig.allowedAuthAlgorithms.set(WifiConfiguration.AuthAlgorithm.OPEN); netConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN); netConfig.allowedProtocols.set(WifiConfiguration.Protocol.WPA); netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE); }else{ netConfig.SSID = SSID ; netConfig.preSharedKey = passWord; netConfig.hiddenSSID = true; netConfig.status = WifiConfiguration.Status.ENABLED; netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.TKIP); netConfig.allowedGroupCiphers.set(WifiConfiguration.GroupCipher.CCMP); netConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK); netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.TKIP); netConfig.allowedPairwiseCiphers.set(WifiConfiguration.PairwiseCipher.CCMP); netConfig.allowedProtocols.set(WifiConfiguration.Protocol.RSN); netConfig.allowedProtocols.set(WifiConfiguration.Protocol.WPA); } try { mMethod.invoke(mWifiManager, netConfig,false); mWifiManager.saveConfiguration(); return true; } catch (Exception e) { e.getMessage(); } } } return false; } Insert this permission in AndroidManifest: &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt; &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt; &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /&gt; &lt;uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /&gt;

http://stackoverflow.com/comment/40352240
score: 0
type: AnswerComment
type: Comment
has text: @TomBlodget you are correct. That part was extra anyway so I just removed it :)
comment on: http://stackoverflow.com/a/25797633

http://stackoverflow.com/a/25862524
has comment: http://stackoverflow.com/comment/40472662
type: Answer
answers question: http://stackoverflow.com/q/25862222
upvote count: 1
score: 1
has body: Platform.exit() actually terminates whole jfx. To keep things safe, just invoke launch() once and show/hide new windows. Something like: Platform.setImplicitExit(false);//make fx running in backgound. Platform.runLater/AndWait {//make sure u create window in jfx thread //window creation/show code here. }
downvote count: 0

http://stackoverflow.com/a/25963895
answers question: http://stackoverflow.com/q/25832159
upvote count: 1
type: Answer
downvote count: 0
has body: I would guess overhead from managing multiple sessions, their synchronization with access to single connection, and thread switching could be the reasons. Why it should work faster with multiple threads on sending side ? The line is only one and maximal number of threads I see as potential performance gain is two - when the first one is sending data, the second one is preparing its data and they switch alternate.
score: 1

http://stackoverflow.com/comment/82102229
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25863356
has text: @beinghuman It's not different. If you use a string literal to initialize it, and if someone else also uses the same string literal, it will still be the same reference. This is covered / guaranteed by the language spec.
type: AnswerComment

http://stackoverflow.com/a/25803633
type: Answer
has body: The explicit problem was caused by a line of System.exit(0); from another thread. How a thread should close itself in Java? explained how to exit a thread, otherwise, exit(0) will interrupt the process, not only the thread.
upvote count: 1
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25803182

http://stackoverflow.com/a/25822314
score: 0
has body: As far as the code is concerned, it is fine and the GIF should get downloaded properly.(Compare sizes of the original and downloaded GIF for confirmation). Now there are two points: 1. Windows Photo Viewer can not display animated GiF's, use Internet Explorer instead of it. 2. In java do not use Event-Dispatcher thread to display any animated GIF, it will not animate for sure. Try using another thread for displaying any frame containing animated GIF. As is clear from your code, you have initialized a dialog from JOptionPane soon after initializing a JLabel with animated GIF, don't do this. All dialogs in JOptionPane are modal which will block your current thread execution and therefore you will not see any animation.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25821371
answers question: http://stackoverflow.com/q/25821371
type: Answer

http://stackoverflow.com/a/25815779
has comment: http://stackoverflow.com/comment/40387298
has comment: http://stackoverflow.com/comment/40384452
upvote count: 3
has comment: http://stackoverflow.com/comment/40385782
score: 3
has comment: http://stackoverflow.com/comment/40385043
has comment: http://stackoverflow.com/comment/40386395
has body: Use Spring @ExceptionHandler along with standard @RequestMapping annotation like this: //this is where correct input from user is passed, no binding errors @RequestMapping(produces = "application/json", method = RequestMethod.GET, value="/v1/test") public @ResponseBody MyResponse getSomething(@RequestParam BigDecimal bd) { MyResponse r = new MyResponse(); r.setBd(bd); return r; } //this will handle situation when there's exception during binding, for example you except number and user passess string (A123.00 for example) @ExceptionHandler(TypeMismatchException.class) public @ResponseBody MyErrorResponse handleMyException(Exception exception, HttpServletRequest request) { //.... } TypeMismatchException is general exception thrown when trying to set a bean property. You can generalize code even more and catch every binding exception with few methods, for example: @ExceptionHandler(TypeMismatchException.class) public @ResponseBody String typeMismatchExpcetionHandler(Exception exception, HttpServletRequest request) { return "type mismatch"; } @ExceptionHandler(MissingServletRequestParameterException.class) public @ResponseBody String missingParameterExceptionHandler(Exception exception, HttpServletRequest request) { return "missing param"; } @ExceptionHandler(Exception.class) public @ResponseBody String generalExceptionHandler(Exception exception, HttpServletRequest request) { return "general exception"; } It's very flexible, allowing many parameters in signature and returned objects Annotation Type ExceptionHandler With @ResponseBody you may return any object, that can be serialized into JSON. It's only required to have jackson library in your classpath but I assume that you already know this
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40384231
accepted answer of: http://stackoverflow.com/q/25815537
type: Answer
answers question: http://stackoverflow.com/q/25815537

http://stackoverflow.com/comment/40234545
comment on: http://stackoverflow.com/a/25730603
score: 0
type: Comment
type: AnswerComment
has text: @user2832203 Well, that is kind of important information which should be put in original question from the start. In that case you would need to create pattern which would be able match any key in your HashMap, but creating such pattern can be tricky: you would have to order keys in a way from most detailed one to less detailed one to avoid situation where pattern would be `fo|foo` because for this regex in string `foofoo` you will only match `fo` two times because in regex `fo|foo` `fo` has higher priority because it is on the left and regex is read from left to right.

http://stackoverflow.com/a/25805722
accepted answer of: http://stackoverflow.com/q/25805550
has comment: http://stackoverflow.com/comment/40365515
has body: The &lt;E&gt; here has nothing to do with the return type; it means that this is a generic function which can take various types of arrays. To be easier to understand, the code could be something like this: public class GenericMethodTest { // generic method printArray public static &lt; E &gt; void printArray( E[] inputArray ) { // Display array elements for ( E element : inputArray ){ System.out.printf( "%s ", element ); } System.out.println(); } public static void main( String args[] ) { // Create arrays of Integer, Double and Character Integer[] intArray = { 1, 2, 3, 4, 5 }; Double[] doubleArray = { 1.1, 2.2, 3.3, 4.4 }; Character[] charArray = { 'H', 'E', 'L', 'L', 'O' }; System.out.println( "Array integerArray contains:" ); GenericMethodTest.&lt;Integer&gt;printArray( intArray ); // pass an Integer array System.out.println( "\nArray doubleArray contains:" ); GenericMethodTest.&lt;Double&gt;printArray( doubleArray ); // pass a Double array System.out.println( "\nArray characterArray contains:" ); GenericMethodTest.&lt;Character&gt;printArray( charArray ); // pass a Character array } } So what the &lt;E&gt; does it tell the function "There is a generic type E and you accept arrays of E, so if for example I call you with the generic type Integer you accept Integer[]." It does not change the return type though. Just like public static doesn't change the return type.
answers question: http://stackoverflow.com/q/25805550
type: Answer
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40480452
has text: Possibly, but I'm not sure I unserstand what you did there with the `map(_.toByte)` part
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25868574

http://stackoverflow.com/comment/40339640
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25787135
score: 0
has text: i don't understand actually. WHy does tal HAVE TO be set to 0? you print `digit1` and `digit2` outside your loop. Thats why tal has to start at `digit1 + digit2`. I don't understand what your problem is actually. Have you done the changes i suggested? Because they actually work

http://stackoverflow.com/comment/115947004
type: Comment
has text: I think think there is an error how special characters are ignored.
comment on: http://stackoverflow.com/a/31940028
type: AnswerComment
score: 0

http://stackoverflow.com/q/25765114
tagged with: cron
has comment: http://stackoverflow.com/comment/40291068
tagged with: unix
downvote count: 0
has answer: http://stackoverflow.com/a/25768971
type: UnansweredQuestion
has body: My Application takes files from SFTP and start processing it.I have a cron job which is set to 5 minutes.Suppose The file arrived at SFTP,The pull operation take the file and start processing records inside it .Howerver processing time is more so after 5 minutes cronjob again pulls the second file and finds the first file to be processing and halts. How to handle this situation . Please Help.
type: Question
has comment: http://stackoverflow.com/comment/40294064
has title: Handling Cron Job
score: 1
tagged with: java
tagged with: cron-task
upvote count: 1
answer count: 1
favorite count: 0
tagged with: linux

http://stackoverflow.com/comment/40232541
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25732522
has text: Did my answer help you? Adding the exclusion is all you need. If you continue to have issues (more conflicts), you will need to make a decision on which JARs need to stay and add the exclusions for the ones that are causing the issue.

http://stackoverflow.com/q/25867916
type: Question
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/25868108
tagged with: akka
has answer: http://stackoverflow.com/a/25868108
score: 0
has comment: http://stackoverflow.com/comment/40484760
has body: I am new to Akka. For a project I am using Play framework 2 in and I need to run a scheduled job. For this I am using an use Akka.system().scheduler().schedule(Duration.create(5, TimeUnit.MINUTES), Duration.create(3, TimeUnit.HOURS), dailyImportActor, "import", Akka.system().dispatcher(), null); The job that the actor is doing is a long running job and can take from 1-4 hours. My question is that. what will happen if the actor is still busy with doing its job and time for the next time come? Does the actor gets recreated? does it block and queue somewhere and runs after? Thanks!
type: AnsweredQuestion
tagged with: playframework-2.0
has answer: http://stackoverflow.com/a/25868168
tagged with: scala
accepted answer: http://stackoverflow.com/a/25868168
has title: How to avoid re-running an actor in Akka?

http://stackoverflow.com/a/25743010
accepted answer of: http://stackoverflow.com/q/25742509
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40257695
answers question: http://stackoverflow.com/q/25742509
has body: The easiest way to override getColumnClass(int col) method of TableModel like next: DefaultTableModel dtm = new DefaultTableModel(data, header){ @Override public Class&lt;?&gt; getColumnClass(int col) { if(col == CHECK_BOX_COLUMN_INDEX){ return Boolean.class; } return super.getColumnClass(col); } }; where CHECK_BOX_COLUMN_INDEX - index of column with JCheckBox. Also read Concepts: Editors and Renderers
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40328432
has text: nope - it will not do `i++` after the loop - the last step after `i=9` will be `i++` setting `i` to 10 and then the condition `i<=9` for the loop will fail - this is technically still *in* the loop
type: Comment
comment on: http://stackoverflow.com/a/25784248
score: 0
type: AnswerComment

http://stackoverflow.com/q/25821420
has answer: http://stackoverflow.com/a/25821961
score: 0
has comment: http://stackoverflow.com/comment/40395167
linked to: http://stackoverflow.com/q/25819496
answer count: 1
has comment: http://stackoverflow.com/comment/40395369
favorite count: 0
has body: Dim ConnectionStr As string = "database=InvertedSoftware;server= InvertedSoftware" Dim objConnection As SqlConnection = new SqlConnection(ConnectionStr) Dim categoryDataAdapter As SqlDataAdapter = new SqlDataAdapter() categoryDataAdapter.TableMappings.Add("Table", "Category") objConnection.Open() Dim objCommand As SqlCommand = new SqlCommand("SELECT * FROM tbl_category", objConnection) objCommand.CommandType = CommandType.Text categoryDataAdapter.SelectCommand = objCommand Dim objDataSet As DataSet = New DataSet("Inventory") categoryDataAdapter.Fill(objDataSet)
accepted answer: http://stackoverflow.com/a/25821961
tagged with: jdbc
tagged with: datatable
has title: what is the equivalent of ado.net datatable in java?
type: AnsweredQuestion
tagged with: netbeans
linked to: http://stackoverflow.com/q/1340283
tagged with: java
upvote count: 1
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/1194971

http://stackoverflow.com/q/25868260
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40485261
tagged with: lifecycle
has answer: http://stackoverflow.com/a/25915436
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25912795
has answer: http://stackoverflow.com/a/25978727
has comment: http://stackoverflow.com/comment/40479546
has answer: http://stackoverflow.com/a/25997402
upvote count: 4
has body: Cordova, Version 3.5.0-0.2.6 &lt;body&gt;&lt;script&gt; alert("documentready"); document.addEventListener("deviceready", function() { alert("deviceready"); }, false); &lt;/script&gt;&lt;/body&gt; I enter the app after deploying, I get 'documentready' and 'deviceready' alerted. I leave the app with the back button. I get 'documentready' only. When I force-close the app with the taskmanager or re-deploy it, I get both alerts. I want this behaviour to occur also after normal re-entering the app. I would prefer a solution where there is no evidence left that the app has been opened before, after I leave it. Nothing restored from garbage collection etc. Ideally executing the same log as the force-close method from the task manager. OK: I want, when I close my app via back button, that exactly the same happens, as when I open the task manager and force my app to close. Is this at least theoretically possible? Alternatively, I would like the app, when left via back-button, to be in a 'hibernate-like' state, that if I re-enter it it behaves absolutely like it has never been left (call same logic as when the menu/home button is pressed). QUESTION STILL OPEN - 50RS BOUNTY TO EARN
downvote count: 0
tagged with: javascript
score: 4
has comment: http://stackoverflow.com/comment/40485593
favorite count: 0
has answer: http://stackoverflow.com/a/25915231
tagged with: android
has comment: http://stackoverflow.com/comment/40479478
has title: App behaves different after exit and re-enter
has comment: http://stackoverflow.com/comment/40479615
tagged with: cordova
has comment: http://stackoverflow.com/comment/45279969
answer count: 5

http://stackoverflow.com/a/25832853
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40415026
has comment: http://stackoverflow.com/comment/40415851
type: Answer
has comment: http://stackoverflow.com/comment/40415043
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40415049
has comment: http://stackoverflow.com/comment/40416361
has comment: http://stackoverflow.com/comment/40415101
accepted answer of: http://stackoverflow.com/q/25832732
has comment: http://stackoverflow.com/comment/40415567
upvote count: 1
has body: You might delete the leading / in your path String for the .fxml file. Parent root = (Parent) loader.load(getClass().getResourceAsStream("ui/FXMLDocument.fxml"));
answers question: http://stackoverflow.com/q/25832732

http://stackoverflow.com/comment/40350636
has text: @TedHopp roughly yes. IIRC, C# partial classes must still be set up with the original class, ie., you couldn't use partial classes to add methods to the base string class.
comment on: http://stackoverflow.com/q/25797150
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25802910
tagged with: rest
has answer: http://stackoverflow.com/a/25803023
duplicate of: http://stackoverflow.com/q/10117687
upvote count: 1
has body: I am trying to deploy a restfull webservice on jboss6 and facing the following problem.. 12:13:54,437 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC000001: Failed to start service jboss.deployment.unit."copl.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."copl.war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "copl.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:127) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04] Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011047: Component class au.com.copl.bean.ServiceBean for component ServiceBean has errors: JBAS011428: Cannot inject RESOURCE_LOCAL container managed EntityManagers using @PersistenceContext at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor$1.handle(ModuleJndiBindingProcessor.java:171) at org.jboss.as.ee.component.ClassDescriptionTraversal.run(ClassDescriptionTraversal.java:54) at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.processClassConfigurations(ModuleJndiBindingProcessor.java:164) at org.jboss.as.ee.component.deployers.ModuleJndiBindingProcessor.deploy(ModuleJndiBindingProcessor.java:157) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:120) [jboss-as-server-7.3.0.Final-redhat-14.jar:7.3.0…
type: AnsweredQuestion
score: 0
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25803023
tagged with: jboss6.x
has title: Cannot inject RESOURCE_LOCAL container managed EntityManagers using @PersistenceContext
answer count: 1
linked to: http://stackoverflow.com/q/10117687
favorite count: 0

http://stackoverflow.com/comment/40349681
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25785609
has text: Yes it does have internet connection

http://stackoverflow.com/comment/40386727
comment on: http://stackoverflow.com/a/25817003
score: 0
type: AnswerComment
has text: I'm working on a game, so if I set the loop outside the while loop it won't work. Right? Because it's supposed to be running constantly.
type: Comment

http://stackoverflow.com/a/25809933
score: -1
answers question: http://stackoverflow.com/q/25809538
upvote count: 0
has body: Two ways to go here i think: If it's very unlikely this task will change, a simple regex can solve it for you and a one line code. If the problem becomes structured, or your app works with a lot of xml, you probably want to parse it and operate dynamically. a simple regex could be: ".*&lt;[sS]ensdata&gt;(.*)&lt;/[sS]ensdata&gt;.*", group 1 ( "$1" ) will be your value.
type: Answer
downvote count: 1

http://stackoverflow.com/a/25759807
type: Answer
has body: I think that you are saying that this line: Document doc = md.getDocument(fromPosition, toPosition, GMapDirection.MODE_DRIVING); is giving you a NullPointerException. That means that md is null when you execute the above. (There is no other possible way that that line of code could throw that exception!) I can see a declaration for md: GMapDirection md; but I can't see where you initialize it. If you don't initialize md anywhere, then that is why it is null ... and that is the cause of your exception.
has comment: http://stackoverflow.com/comment/40288125
has comment: http://stackoverflow.com/comment/40282374
score: 0
answers question: http://stackoverflow.com/q/25759656

http://stackoverflow.com/a/25849371
downvote count: 0
score: 3
type: Answer
upvote count: 3
answers question: http://stackoverflow.com/q/25849294
accepted answer of: http://stackoverflow.com/q/25849294
has body: Move your main() method from the inner class ShapeTest. You can't put it in a non-static non-top-level class. In your existing code, you could put main() in Rectangle, or you could move ShapeTest to be a top-level class.
type: AcceptedAnswer

http://stackoverflow.com/comment/111310601
has text: This explain how trimDirectiveWhitespaces work. But, the question is how to remove white spaces inner elements to improve speed response between server pages.
type: Comment
comment on: http://stackoverflow.com/a/43188063
type: AnswerComment
score: 0

http://stackoverflow.com/q/25814564
type: AnsweredQuestion
tagged with: java
has title: XPath select element with an attribute
type: Question
has answer: http://stackoverflow.com/a/25817691
score: 0
has body: I have a xml file which looks like: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> UPS DIAGNOSTIC TEST FAILED IDG860237, SL3-PL4, US, SapNr=70195637, DEVICE IN MAINTENANCE MODE IDG860237, SL3-PL4, US, SapNr=70195637, There a lot of these alarms. Now I want save for every alarm tag the attribute with the id = 0x10b5a in a String. But I haven't a great clue. In my way it doesn't do it. I get only showed the expression. My idea: FileInputStream file = new FileInputStream( new File( "alarms.xml")); DocumentBuilderFactory builderFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder builder = builderFactory.newDocumentBuilder(); Document xmlDocument = builder.parse(file); XPath xPath = XPathFactory.newInstance().newXPath(); System.out.println("*************************"); String expression = "/alarm-responses/alarm/attribute[@id='0x10b5a'] "; System.out.println(expression); NodeList nodeList = (NodeList) xPath.compile(expression).evaluate( xmlDocument, XPathConstants.NODESET); for (int i = 0; i < nodeList.getLength(); i++) { System.out.println(nodeList.item(i).getFirstChild() .getNodeValue()); }
has comment: http://stackoverflow.com/comment/40382667
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
has comment: http://stackoverflow.com/comment/40382881
has comment: http://stackoverflow.com/comment/40382822
accepted answer: http://stackoverflow.com/a/25817691

http://stackoverflow.com/comment/40470568
type: QuestionComment
score: 1
has text: possible duplicate of [How can I increment a date by one day in Java?](http://stackoverflow.com/q/428918/642706). And [this](http://stackoverflow.com/q/2507377/642706) and [this](http://stackoverflow.com/q/12087419/642706) and many others.
comment on: http://stackoverflow.com/q/25851017
type: Comment

http://stackoverflow.com/q/25835307
has title: HBase connection pooling for very frequent scanning of row
possible better answer: http://stackoverflow.com/a/43771379
accepted answer: http://stackoverflow.com/a/26055258
downvote count: 0
has answer: http://stackoverflow.com/a/43771379
has body: I have to scan the table for row very frequent(~million times) in an hour. I have the information about rowid(which is a byte array). I am creating rowid for creating startrow and endrow which are essentially the same in my case. public String someMethod(byte[] rowid){ if (aTable == null) { aTable = new HTable(Config.getHadoopConfig(), Config.getATable()); } byte[] endRow = new byte[rowId.length]; endrow = System.copyArray(rowId, 0, endRow, 0, rowId.length) Scan scan = new Scan(rowId , endRow) //scanner implementation and iteration over the result (ResultScanner result = aTable.getScanner(scan);) { for (Result item : result) { } } } I am wondering whether I can implement some connection pooling for improving the performance. IS there any pooling mechanism available in HBase Java API. I am using 0.96.x version of HBase. Also, is there any configuration setting which can improve the performance. Thanks
favorite count: 0
has answer: http://stackoverflow.com/a/50057657
tagged with: hbase
answer count: 4
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/26055258
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/48135210

http://stackoverflow.com/comment/40477254
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25866942
type: AnswerComment
has text: The problem is that the models are not going to be represent to the user, only if he scans a unique image marker which will load the right model. So if user is in front of the marker and opens the application, he have to wait a lot of time to load the models all of them, because the scan - show model should be really fast process...not more than a second.

http://stackoverflow.com/comment/40481046
score: 0
type: QuestionComment
has text: It depends on what the alternative would have been... you could write code without these that is less or more performant...
type: Comment
comment on: http://stackoverflow.com/q/25869181

http://stackoverflow.com/a/25852292
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25852227
type: Answer
answers question: http://stackoverflow.com/q/25852227
has comment: http://stackoverflow.com/comment/40452167
upvote count: 5
has body: You can hold a static value containing the last value you used and always increment it every time you use it. An AtomicInteger is excellent for this because it is thread safe and does not require locks if used in a multi-thread environment. public class Cls { // The last id I used. private static final AtomicInteger nextId = new AtomicInteger(); // My id private final int id = nextId.getAndIncrement(); public Cls() { } }
score: 5

gui-testing
type: Tag
tags question: http://stackoverflow.com/q/25759177
tag name: gui-testing

http://stackoverflow.com/a/25834881
type: Answer
upvote count: 2
has body: The record variable must be static. non-static variables can only be accessed from a non-static method, while static variables can be accessed from both non-static and static methods. If you want to access non-static variable, you first need an instantiated object the variable is associated with. But if you want to access static variable, you just need the class.
answers question: http://stackoverflow.com/q/25834850
score: 2
downvote count: 0

http://stackoverflow.com/comment/40447233
type: Comment
comment on: http://stackoverflow.com/a/25850080
type: AnswerComment
has text: thought same thing. :)
score: 0

http://stackoverflow.com/a/48753052
downvote count: 1
has body: Please add annotation @JsonIgnore before each @OneToMany annotation in you entity class My solution @JsonIgnore @OneToMany(cascade = CascadeType.ALL, mappedBy = "domainDataId") Thank Shahid Hussain Abbasi
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25733591
upvote count: 3

http://stackoverflow.com/q/25799561
upvote count: 1
tagged with: void
has answer: http://stackoverflow.com/a/25799684
tagged with: java
type: Question
answer count: 2
downvote count: 4
tagged with: function
favorite count: 0
has title: I'm supposed to use void function but i don't know how
has comment: http://stackoverflow.com/comment/40354787
has body: public class LABEX01 { public static void main(String[] args) { print_header(); } public static void print_header() { System.out.println("Name") Scanner kbd = new Scanner(System.in) double m = 3; double n = 0; System.out.print("type 12 and Press enter"); n = kbd.nextDouble(); double p = m * n; double q = 0; q = (double)Math.sqrt(p); System.out.printf("m = %f", m); System.out.printf("n = %f", n); System.out.printf("p = %f", p); System.out.printf("q = %f", q); } } I'm supposed to use a programmer defined function to print your name as the first line of your output. I tried using "print_header" but that doesn't seem to work. I'm also supposed to use a programmer defined value returning function to assign value of "m * n" to integer variable "P". I kinda having trouble understanding void functions, so if anyone can explain it to me in a Simple way, please help.
has answer: http://stackoverflow.com/a/25799629
type: UnansweredQuestion
score: -3
has comment: http://stackoverflow.com/comment/40354823

http://stackoverflow.com/comment/40391702
type: Comment
type: QuestionComment
has text: You want to change the marker? Means display something other than red bubble structure?
comment on: http://stackoverflow.com/q/25819715
score: 0

http://stackoverflow.com/comment/40198038
comment on: http://stackoverflow.com/a/25714663
has text: The exception is fine, it allows me to set the message differently when it doesn't match.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/25835590
answers question: http://stackoverflow.com/q/25835354
has comment: http://stackoverflow.com/comment/40420273
has comment: http://stackoverflow.com/comment/40450339
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40420314
type: Answer
has comment: http://stackoverflow.com/comment/71238462
has body: This would work as long as CacheEntry is a proper immutable object (as opposed to a mere effectively immutable object). This is because immutable objects can be safely published without synchronisation and object reference assignment is atomic. In other words, it wouldn't be safe if CacheEntry is not fully immutable, as the consumer thread may see an object that isn't fully constructed. Also, if what is cached is primitive types whose assignments aren't atomic (double, long), the consumer thread could see garbage (half assigned values). EDIT: According to Java Concurrency in Practice, an object can be safely published without synchronization if: Its state cannot be modified after construction All its fields are declared final It is properly constructed (the this keyword does not escape during construction)
upvote count: 3
has comment: http://stackoverflow.com/comment/40421855
has comment: http://stackoverflow.com/comment/40421844
score: 3
accepted answer of: http://stackoverflow.com/q/25835354

http://stackoverflow.com/comment/53028086
comment on: http://stackoverflow.com/a/25911059
score: 0
type: Comment
has text: The downside with this (everything has a downside) is that it will be easier to forget that you excluded a test.
type: AnswerComment

http://stackoverflow.com/q/25843505
has answer: http://stackoverflow.com/a/25849286
tagged with: jackcess
has body: I have installed Jackcess 2.0.4 API on my Ubuntu 14.04 server (IP: 192.168.0.130). And now i want to access a Microsoft Access 2010 DB on a Windows 2003 R2 server (IP: 192.168.0.125). How do i do this ?
has title: Accessing a Microsoft Access database from Ubuntu 14.04 server with Jackcess
tagged with: ms-access-2010
tagged with: java
accepted answer: http://stackoverflow.com/a/25849286
type: Question
type: AnsweredQuestion
score: 0
answer count: 1

http://stackoverflow.com/comment/40295006
has text: Take a look at: [Scanner API](http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html) and [Changing the JFrame title](http://stackoverflow.com/questions/5487615/changing-the-jframe-title)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25767059

http://stackoverflow.com/q/25724351
downvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40231104
tagged with: google-compute-engine
accepted answer: http://stackoverflow.com/a/25732261
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40217230
tagged with: java
has title: Google Cloud public hostname
has answer: http://stackoverflow.com/a/25732261
has body: Is there any solution to get a public hostname in google cloud like in other cloud platforms? Currently the machine name is: computername.c.googleprojectid.internal but I want something like in Amazon or in Azure: computername.cloudapp.net
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/103284522

http://stackoverflow.com/comment/40348070
comment on: http://stackoverflow.com/q/25760491
score: 1
type: Comment
type: QuestionComment
has text: @user1516873 I developed a custom docx related part using the POI project before the POI project got traction on docx. There are subtleties in DOCX format, where a simple content replacement breaks things. Of course in many scenarios it works, but if one needs to be *sure* that it works, one faces serious extra efforts.

http://stackoverflow.com/q/25717781
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40203982
downvote count: 0
has answer: http://stackoverflow.com/a/25718057
tagged with: java
tagged with: hibernate
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/40203783
answer count: 2
has comment: http://stackoverflow.com/comment/40204133
linked to: http://stackoverflow.com/q/306144
has answer: http://stackoverflow.com/a/25718645
accepted answer: http://stackoverflow.com/a/25718645
possible better answer: http://stackoverflow.com/a/25718057
has body: My database has two table. One of University, another is Faculty. They are one to many relationship package server.hibernate.domain; import static javax.persistence.GenerationType.IDENTITY; import java.io.Serializable; import java.util.HashSet; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Version; @Entity @Table(name = "UNIVERSITY") public class University implements Serializable{ private Long _id; private int _version; private String _universityName; private String _countryLocated; private Set&lt;Faculty&gt; _faculties = new HashSet&lt;Faculty&gt;(); @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "ID") public Long getId() { return _id; } public void setId(Long _id) { this._id = _id; } @Version @Column(name = "VERSION") public int getVersion() { return _version; } public void setVersion(int _version) { this._version = _version; } @Column(name = "UNIVERSITY_NAME", nullable=false) public String getUniversityName() { return _universityName; } public void setUniversityName(String _universityName) { this._universityName = _universityName; } @Column(name = "COUNTRY_LOCATED") public String getCountryLocated() { return _countryLocated; } public void setCountryLocated(String _countryLocated) { this._countryLocated = _countryLocated; } @OneToMany(mappedBy="university", targetEntity=Faculty.class, orphanRemoval=true, fetch=FetchType.EAGER, cascade=CascadeType.ALL) public Set&lt;Faculty&gt; getFaculties() { return _faculties; } public void setFaculties(Set&lt;Faculty&gt; faculties) { this._faculties = faculties; } public String toString(){ return new String("UniversityID:"+_id + " UniversityName:"+_universityName +" CountryLocated:"+_countryLocated); } } This is what I have set in University cl…
favorite count: 0
has title: In hibernate even though I set cascade type to ALL, but why did I still receive a foreign key violation exception when deleting?
tagged with: spring

http://stackoverflow.com/comment/40373934
type: AnswerComment
has text: Thank you soooo much! Just wondering why I was pointing at a null pointer with my create button and edit text fields?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25779110

http://stackoverflow.com/q/25736130
has comment: http://stackoverflow.com/comment/40246486
has comment: http://stackoverflow.com/comment/40244878
has comment: http://stackoverflow.com/comment/40238932
answer count: 0
upvote count: 3
type: UnansweredQuestion
tagged with: tomcat7
score: 3
tagged with: java
tagged with: eclipse
has body: I am new to Tomcat Project, to start the setup i duplicated a set of project from my friend there. When i started the project, the index.jsp.java in the Tomcat work folder there is getting some error on the private org.apache.tomcat.InstanceManager _jsp_instancemanager; public java.util.Map&lt;java.lang.String,java.lang.Long&gt; getDependants() { return _jspx_dependants; } public void _jspInit() { _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory(); _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig()); } eclipse show "org.apache.tomcat cannot be resolved to a type" and "InstanceManager cannot be resolved to a type" Any help on this issue?
type: Question
has title: JSP org.apache.tomcat cannot be resolved to a type
downvote count: 0
has comment: http://stackoverflow.com/comment/40239287
favorite count: 0

http://stackoverflow.com/comment/40345420
has text: regarding `Random.nextInt(foo)`if you want a number that includes 0-foo with foo as a possibility you want `nextInt(foo +1)`
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25794589

http://stackoverflow.com/a/25771137
type: Answer
accepted answer of: http://stackoverflow.com/q/25769561
answers question: http://stackoverflow.com/q/25769561
has body: @SessionAttributes session objects are not meant to be shared among controllers. Here are some alternatives: You can store attributes directly into HttpSession object. You can obtain HttpSession object by adding it to controller method as parameter: public ModelAndView myControllerMethod(..., HttpSession session) { ... session.setAttribute("someAttribute", someValue); ... } You can also autowire HttpSession object and then use it in controller methods: @Autowired private HttpSession httpSession; You can create a session scoped bean and inject that bean into controllers that need it: &lt;bean id="mySessionDataBean" class="com.example.MySessionDataBeanImpl" scope="session"&gt; &lt;aop:scoped-proxy /&gt; &lt;/bean&gt; And then use it in controllers (MySessionDataBeanImpl implements SessionDataBean interface in this example): public class MyController { .... @Autowired SessionDataBean sessionDataBean; @RequestMapping(...) public ModelAndView controllerMethod(...) { ... sessionDataBean.setSomeValue(someValue); } }
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25803528
upvote count: 1
type: Question
has title: Is there a pure Java library to import OVA/VMDK as VM in AWS?
score: 1
tagged with: java
has body: I know the command line tool given by Amazon and its use from Java. But then, is there a pure Java open source SDK available to import a VMDK as a VM in Amazon AWS ?
downvote count: 0
tagged with: amazon-web-services
favorite count: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/40435829
type: QuestionComment
has text: It's look like jar missing from build path.
score: 0
comment on: http://stackoverflow.com/q/25843946
type: Comment

http://stackoverflow.com/comment/40267767
comment on: http://stackoverflow.com/q/25730708
score: 2
has text: I think it's the driver doing this when creating a connection pool. Check the driver documentation and source code.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40371089
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25789809
has text: Many thanks for the response Tony. Wake lock has been mentioned a few times elsewhere but was hoping to just set an XML parameter. The compass needs to remain on all the time for the user. I will investigate the wake lock approach.
type: Comment

http://stackoverflow.com/comment/40315780
type: Comment
comment on: http://stackoverflow.com/a/25778237
has text: i've tried it but the result is just the same. i don't know where in my code is wrong. maybe the algorithm?? thanks.
score: 0
type: AnswerComment

http://stackoverflow.com/a/25803450
answers question: http://stackoverflow.com/q/25803197
upvote count: 0
score: -1
has body: TextView textView_paydetails; FragmentManager fragmentManager_payment; Button button_placeorder; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View view = inflater.inflate(R.layout.fragment_paymentdetails, container, false); textView_paydetails = (TextView) view.findViewById(R.id.txtsdid); button_placeorder = (Button) view.findViewById(R.id.btnponid); return view; } @Override public void onActivityCreated(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onActivityCreated(savedInstanceState); fragmentManager_payment = getFragmentManager(); textView_paydetails.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { /* // TODO Auto-generated method stub PaymentShipping payment_shipping = new PaymentShipping(); FragmentTransaction fragmentTransaction = fragmentManager_payment .beginTransaction(); // Locate Position fragmentTransaction.replace(R.id.fsp, payment_shipping, "A"); fragmentTransaction.commit();*/ } }); button_placeorder.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub SecondFragement payment_shippingmethod = new SecondFragement(); FragmentTransaction fragmentTransaction = fragmentManager_payment .beginTransaction(); // Locate Position fragmentTransaction.replace(R.id.fsp, payment_shippingmethod, "A"); //fragmentTransaction.addToBackStack("A"); fragmentTransaction.commit(); } }); }
downvote count: 1
type: Answer

http://stackoverflow.com/comment/40196735
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25713721
type: Comment
has text: [`Character.getNumericaValue('0')` evaluates to `0`](http://ideone.com/Eysomq). Your answer rests on a falsehood.

http://stackoverflow.com/q/25773637
tagged with: opengl
tagged with: java
tagged with: lwjgl
has comment: http://stackoverflow.com/comment/40310492
has title: What have I done wrong with my matrices to make this quad render like this?
type: Question
score: 0
has body: I am attempting to render a Quad in 3D using OpenGL 3.2 When viewing the quad directly on it looks fairly normal However when I look to the side so that the quad is not in the centre of the screen it distorts like so I have a feeling that this is to do with how I deal with the matrices Here is the multiplication method in my matrix class public Matrix4f mul(Matrix4f m4f) { float[][] m = new float[4][4]; for(int i = 0; i &lt; 4; i++) { for(int j = 0; j &lt; 4; j++) { float mij = 0; for(int k = 0; k &lt; 4; k++) { mij += this.m[k][j] * m4f.m[i][k]; } m[i][j] = mij; } } this.m = m; return this; And here is where I compute the view matrix public Matrix4f getViewMatrix() { Matrix4f m = Matrix4f.getNewIdentityMatrix(); m.mul(Matrix4f.getNewRotationMatrix(-Math.toRadians(rotation.x), -Math.toRadians(rotation.y), 0)); m.mul(Matrix4f.getNewTranslationMatrix(-pos.x, -pos.y, -pos.z)); return m; } Here is how I use the matrices in the vertex shader void main() { gl_Position = proj * modelview * vec4(position, 1.0); } I know that my perspective projection matrix works as intended.
tagged with: matrix
has comment: http://stackoverflow.com/comment/40308977
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/40695359
type: QuestionComment
has text: @RaviVadera I trie dthat but in that case when my eidt text is last view i.e. it is in bottom and then if i want to edit it will not be shown.
score: 0
comment on: http://stackoverflow.com/q/25836860
type: Comment

http://stackoverflow.com/q/25739328
has body: I'm trying to make custom launcher to Minecraft. I just want it to download main jar file from my own server, nothing else. I decompiled one file (Launcher.java) and changed the download url from "https://s3.amazonaws.com/Minecraft.Download/" to my own. The problem is, that when I try to re-compile it with javac -classpath launcher.jar launcher.java it throws 5 errors: launcher.java:313: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] directories = objectsDir.listFiles(DirectoryFileFilter.DIRECTORY); launcher.java:317: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] files = directory.listFiles(FileFileFilter.FILE); launcher.java:409: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] directories = virtualsDir.listFiles(DirectoryFileFilter.DIRECTORY); launcher.java:441: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] versions = root.listFiles(DirectoryFileFilter.DIRECTORY); launcher.java:445: error: reference to listFiles is ambiguous, both method listFiles(FilenameFilter) in File and method listFiles(FileFilter) in File match File[] files = version.listFiles(FileFilterUtils.and(new IOFileFilter[] { new PrefixFileFilter(version.getName() + "-natives-"), ageFilter })); Are there any way to do this? Don't mind my writing style, I tried to solve this whole night... Thanks in advance.
tagged with: launcher
answer count: 1
tagged with: minecraft
downvote count: 0
has title: Minecraft Launcher re-compile
favorite count: 0
score: 2
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/25747048
accepted answer: http://stackoverflow.com/a/25747048
type: Question
has comment: http://stackoverflow.com/comment/40244610
has comment: http://stackoverflow.com/comment/40244539
tagged with: java
tagged with: compilation

http://stackoverflow.com/a/27843858
has body: As spark can read data based on a Hadoop Job configuration, you can use the FileInputFormat#setInputDirRecursive method. JavaSparkContext context = new JavaSparkContext(); Job job; try { job = Job.getInstance(); FileInputFormat.setInputPaths(job, new Path("/path/to/input/directory)); FileInputFormat.setInputDirRecursive(job, true); } catch (IOException e1) { e1.printStackTrace(); System.exit(1); } JavaRDD&lt;Text&gt; sourceData = context.newAPIHadoopRDD(job.getConfiguration(), TextInputFormat.class, LongWritable.class, Text.class) .values(); Obviously you will end up with a Text data type instead of a String.
type: Answer
accepted answer of: http://stackoverflow.com/q/25782925
downvote count: 0
answers question: http://stackoverflow.com/q/25782925
score: 3
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/40361317
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25803080
has text: I need a question to answer :) Basically, your question is not really related to Cordova, it is general programming issue about Java (I think)
score: 1

http://stackoverflow.com/comment/40200844
score: 0
has text: the object AudioClip has a FileInputStream but thats just used to bring the wave file in the file is then stored in the byte[]. why would the FileInputeStream object be doing anything? Im only using it for the setter for the wave file.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25715824

http://stackoverflow.com/comment/40446136
comment on: http://stackoverflow.com/a/25812332
type: AnswerComment
score: 0
type: Comment
has text: Thanks user3487063. It works and helped me. But for me, the problem was bit different.

http://stackoverflow.com/comment/40309458
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25774785
has text: Readability, I would go with the first one. You want others to be able to understand what you are doing too. The question I always ask myself is 5 years later when I look back on this project, will I be able to understand what I wrote. If you're answer is no (you're not being clear)
score: 0

http://stackoverflow.com/comment/40317999
comment on: http://stackoverflow.com/a/25778998
score: 0
type: Comment
has text: When i call "Table sTable = new Table();" from my main method it doesn't compile with that constructor. Is it expecting parameters for K and T?
type: AnswerComment

http://stackoverflow.com/q/25747500
has answer: http://stackoverflow.com/a/25747607
has comment: http://stackoverflow.com/comment/40260007
upvote count: 2
has body: How can I create a random string from these 4 strings? I need to take only 2 strings from there. I tried to do something like that, but it's not working. String RandomMessages[] = { "Message 1 (Change this)", "Message 2", "LOL", "fdasfsd" }; public static void main(String[] args) { System.out.println(RandomMessage[]); }
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25747607
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25747805
has comment: http://stackoverflow.com/comment/40259087
has comment: http://stackoverflow.com/comment/40259240
possible better answer: http://stackoverflow.com/a/25747805
tagged with: random
has title: Create a Random String
answer count: 3
has comment: http://stackoverflow.com/comment/40259122
has answer: http://stackoverflow.com/a/25747534
tagged with: string
favorite count: 0

http://stackoverflow.com/q/25840461
has answer: http://stackoverflow.com/a/25840968
has comment: http://stackoverflow.com/comment/40429557
has comment: http://stackoverflow.com/comment/40430685
has comment: http://stackoverflow.com/comment/40429530
has comment: http://stackoverflow.com/comment/40429670
has comment: http://stackoverflow.com/comment/40430092
has body: According to the java.lang.Exception hierarchy: And given the Liskov Substitution Principle: ... if S is a subtype of T, then objects of type T may be replaced with objects of type S... We have two different behaviors for sub-classes (Checked vs Unchecked) and there are scenarios where we can not effectively replace the base class usage with a subclass object unless we change the current code, for example, if we write code like: try{ InputStream is = new FileInputStream("C://test.txt");//throws IOException while((i=is.read())!=-1){ c=(char)i; System.out.print(c); } }catch(Exception e){// can not be replaced by any subtype, but IOException e.printStackTrace(); } Is this a violation?, why/why not?. Source: http://www.oracle.com/technetwork/articles/entarch/effective-exceptions-092345.html EDIT 1 Example 2: Given the method: public class MyClass { public void test() throws Exception{ // nice stuff } } And the client: public class MyTest { MyClass clazz = new MyClass(); // 'Exception' can not be changed by a subclass directly public void testTest() throws Exception { clazz.test(); } } EDIT 2 You are telling me that I can create a subclass and override the method and no throw an exception, that is completely valid, but is not what I want to show you. When I say 'Exception' can not be changed by a subclass directly, I was meaning: you can not write something like: // You can not do this at home public class MyTest { MyClass clazz = new MyClass(); // hey look!, there is a compiler error! public void testTest() throws NullPointerException { clazz.test(); } }
has comment: http://stackoverflow.com/comment/40429896
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25840968
tagged with: exception
has comment: http://stackoverflow.com/comment/40429619
has comment: http://stackoverflow.com/comment/40430136
has comment: http://stackoverflow.com/comment/40429617
type: AnsweredQuestion
score: 3
has title: Does Exception Java API violates Liskov Principle?
upvote count: 3
tagged with: java
tagged with: solid-principles
has comment: http://stackoverflow.com/comment/40430856
has comment: http://stackoverflow.com/comment/40429595
type: Question
has comment: http://stackoverflow.com/comment/40429800
tagged with: oop

date
tags question: http://stackoverflow.com/q/25840489
tags question: http://stackoverflow.com/q/25740431
tags question: http://stackoverflow.com/q/25811227
tags question: http://stackoverflow.com/q/25735407
tag name: date
tags question: http://stackoverflow.com/q/25817422
tags question: http://stackoverflow.com/q/25747366
tags question: http://stackoverflow.com/q/25801191
tags question: http://stackoverflow.com/q/25824148
tags question: http://stackoverflow.com/q/25797504
tags question: http://stackoverflow.com/q/25868856
tags question: http://stackoverflow.com/q/25788709
tags question: http://stackoverflow.com/q/25861820
tags question: http://stackoverflow.com/q/25861804
tags question: http://stackoverflow.com/q/25814849
tags question: http://stackoverflow.com/q/25825496
tags question: http://stackoverflow.com/q/25839209
type: Tag
tags question: http://stackoverflow.com/q/25751917
tags question: http://stackoverflow.com/q/25747499
tags question: http://stackoverflow.com/q/25736410
tags question: http://stackoverflow.com/q/25734656
tags question: http://stackoverflow.com/q/25753727
tags question: http://stackoverflow.com/q/25835439
tags question: http://stackoverflow.com/q/25764100
tags question: http://stackoverflow.com/q/25870156
tags question: http://stackoverflow.com/q/25872702
tags question: http://stackoverflow.com/q/25866708
tags question: http://stackoverflow.com/q/25758766
tags question: http://stackoverflow.com/q/25828115
tags question: http://stackoverflow.com/q/25839599
tags question: http://stackoverflow.com/q/25782903
tags question: http://stackoverflow.com/q/25814417
tags question: http://stackoverflow.com/q/25780270
tags question: http://stackoverflow.com/q/25870328

http://stackoverflow.com/q/25800918
linked to: http://stackoverflow.com/q/1440134
has comment: http://stackoverflow.com/comment/40357232
type: Question
has title: Why can't we use only comparable in every situation?
has comment: http://stackoverflow.com/comment/40357260
tagged with: comparable
has answer: http://stackoverflow.com/a/25801287
has answer: http://stackoverflow.com/a/40492116
score: 0
tagged with: comparator
answer count: 3
has comment: http://stackoverflow.com/comment/40357198
has comment: http://stackoverflow.com/comment/40357132
has body: Possible Duplicate of When should a class be Comparable and/or Comparator? I understand the difference that is given in this link. And also in the book that i am referring it is given that we can not use comparable when we need to sort the objects on the basis of more than one fields. My Question: I just want an example where we could not possibly use comparable and have to go for comparator in order to compare and please also show that with comparable why can't we compare on two different fields of object. If you find this question as duplicate please provide link,, i have searched many questions but none has the example that i wanted.
has answer: http://stackoverflow.com/a/25801577
accepted answer: http://stackoverflow.com/a/25801577
has comment: http://stackoverflow.com/comment/40357131
possible better answer: http://stackoverflow.com/a/25801287
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40357177

http://stackoverflow.com/a/25834150
score: 1
type: AcceptedAnswer
downvote count: 0
has body: you simply add it by right clicking on your src folder you need to declare it on your AndroidManifest.xml file
accepted answer of: http://stackoverflow.com/q/25834125
type: Answer
has comment: http://stackoverflow.com/comment/40418543
upvote count: 1
answers question: http://stackoverflow.com/q/25834125

javafx
tags question: http://stackoverflow.com/q/25713336
tags question: http://stackoverflow.com/q/25847447
type: Tag
tags question: http://stackoverflow.com/q/25852959
tags question: http://stackoverflow.com/q/25832242
tags question: http://stackoverflow.com/q/25801623
tags question: http://stackoverflow.com/q/25846752
tags question: http://stackoverflow.com/q/25857241
tags question: http://stackoverflow.com/q/25789526
tags question: http://stackoverflow.com/q/25821842
tags question: http://stackoverflow.com/q/25834704
tags question: http://stackoverflow.com/q/25816685
tag name: javafx
tags question: http://stackoverflow.com/q/25871578
tags question: http://stackoverflow.com/q/25862222
tags question: http://stackoverflow.com/q/25825198
tags question: http://stackoverflow.com/q/25757614
tags question: http://stackoverflow.com/q/25832726
tags question: http://stackoverflow.com/q/25793841
tags question: http://stackoverflow.com/q/25828561
tags question: http://stackoverflow.com/q/25806349
tags question: http://stackoverflow.com/q/25844814
tags question: http://stackoverflow.com/q/25791416
tags question: http://stackoverflow.com/q/25809412
tags question: http://stackoverflow.com/q/25758782
tags question: http://stackoverflow.com/q/25767221
tags question: http://stackoverflow.com/q/25742121
tags question: http://stackoverflow.com/q/25871015
tags question: http://stackoverflow.com/q/25872757
tags question: http://stackoverflow.com/q/25775977
tags question: http://stackoverflow.com/q/25779414
tags question: http://stackoverflow.com/q/25714573
tags question: http://stackoverflow.com/q/25768560
tags question: http://stackoverflow.com/q/25851667
tags question: http://stackoverflow.com/q/25847127
tags question: http://stackoverflow.com/q/25871175
tags question: http://stackoverflow.com/q/25731356
tags question: http://stackoverflow.com/q/25839263
tags question: http://stackoverflow.com/q/25825570
tags question: http://stackoverflow.com/q/25800425
tags question: http://stackoverflow.com/q/25838965
tags question: http://stackoverflow.com/q/25740177
tags question: http://stackoverflow.com/q/25751692
tags question: http://stackoverflow.com/q/25756172
tags question: http://stackoverflow.com/q/25802926
tags question: http://stackoverflow.com/q/25780721
tags question: http://stackoverflow.com/q/25865454
tags question: http://stackoverflow.com/q/25753727
tags question: http://stackoverflow.com/q/25733847
tags question: http://stackoverflow.com/q/25745224
tags question: http://stackoverflow.com/q/25772637
tags question: http://stackoverflow.com/q/25723628
tags question: http://stackoverflow.com/q/25729103
tags question: http://stackoverflow.com/q/25746142
tags question: http://stackoverflow.com/q/25736692
tags question: http://stackoverflow.com/q/25811284
tags question: http://stackoverflow.com/q/25731664
tags question: http://stackoverflow.com/q/25800696
tags question: http://stackoverflow.com/q/25823689

android-fragments
tags question: http://stackoverflow.com/q/25821741
tags question: http://stackoverflow.com/q/25804073
tags question: http://stackoverflow.com/q/25872832
tags question: http://stackoverflow.com/q/25724548
tags question: http://stackoverflow.com/q/25788973
type: Tag
tags question: http://stackoverflow.com/q/25772361
tags question: http://stackoverflow.com/q/25803754
tags question: http://stackoverflow.com/q/25735035
tags question: http://stackoverflow.com/q/25780760
tags question: http://stackoverflow.com/q/25807877
tags question: http://stackoverflow.com/q/25722953
tags question: http://stackoverflow.com/q/25753953
tags question: http://stackoverflow.com/q/25771677
tags question: http://stackoverflow.com/q/25805636
tags question: http://stackoverflow.com/q/25832032
tags question: http://stackoverflow.com/q/25828860
tags question: http://stackoverflow.com/q/25767863
tags question: http://stackoverflow.com/q/25854827
tags question: http://stackoverflow.com/q/25786908
tags question: http://stackoverflow.com/q/25727011
tags question: http://stackoverflow.com/q/25803197
tags question: http://stackoverflow.com/q/25749070
tags question: http://stackoverflow.com/q/25734249
tags question: http://stackoverflow.com/q/25716087
tags question: http://stackoverflow.com/q/25797419
tags question: http://stackoverflow.com/q/25758300
tags question: http://stackoverflow.com/q/25817947
tags question: http://stackoverflow.com/q/25716906
tag name: android-fragments
tags question: http://stackoverflow.com/q/25815621
tags question: http://stackoverflow.com/q/25751712
tags question: http://stackoverflow.com/q/25744681
tags question: http://stackoverflow.com/q/25721703

http://stackoverflow.com/a/25773645
has comment: http://stackoverflow.com/comment/40307137
downvote count: 0
has comment: http://stackoverflow.com/comment/40307194
has body: The method belongs to class Character, so you should call it against the instance John: John.workout(5); As a side note, it is conventional to start the name of a variable with a lowercase (john instead of John and str instead of Str), and to give them names that reflect their type (Str gives a hint that it's a String while it is in fact an int). EDIT: Based on your comment, if you would like to call the method workout the way you're doing, you can move the method to the CharacterAttributes class, and change it so that it takes a reference to the Character instance that will be updated. public static void main(String[] args) { Character John = new Character("John", 0); workout(John, 5); } public static void workout(Character character, int byAmt) { // use a setter to set the attribute character.setStr(character.getStr() + byAmt); } class Character { private String name; private int Str; public Character(String n, int initialStr) { name = n; Str = initialStr; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getStr() { return Str; } public void setStr(int str) { Str = str; } }
score: 5
has comment: http://stackoverflow.com/comment/40307619
has comment: http://stackoverflow.com/comment/40307013
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25773628
has comment: http://stackoverflow.com/comment/40307526
upvote count: 5
accepted answer of: http://stackoverflow.com/q/25773628
type: Answer

http://stackoverflow.com/comment/40319939
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25757220
has text: I tried all these, and tried running InstallCert from the links that you had mentioned, from installCert I am not able to connect to the host but I am able to ping. Now, I am confused if it is a network(firewall) issue or code issue.

http://stackoverflow.com/a/25732354
has body: Figured it out Code is 1101 > 1101-1 with parity Read as 1100-1 considered incorrect > Code 1100 should be 1100-0. Assuming all bits are present then we know the code should be 1101. Code is 1100 > 1100-0 with parity Read as 1101-0, considered correct. So I guess it does negate the parity.
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/25732049
accepted answer of: http://stackoverflow.com/q/25732049

http://stackoverflow.com/comment/40357669
type: Comment
type: QuestionComment
has text: Please show some code - the string you provided is not even a valid Java string due to invalid escape characters
comment on: http://stackoverflow.com/q/25801247
score: 0

http://stackoverflow.com/comment/40294650
has text: Thanks TiMESPLiNTER. Actually my data is not yet encoded. above code is not working to encode data.
comment on: http://stackoverflow.com/q/25766671
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25813040
answers question: http://stackoverflow.com/q/25812923
downvote count: 0
has body: You can use one of the classes which is designed to read in a line at a time, such as BufferedReader. This will pull in the line of text, but parse out the line termination characters: while (true) { try { BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); System.out.println(reader.readLine()); } catch (IOException e) { e.printStackTrace(); } } Keep in mind that since this is pulling in the whole line, the output will be a String, rather than byte-by-byte.
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/q/25769544
has body: I've been working on a Java applet connecting to a MySQL database. I've put the URL on my whitelist, I've signed my applet and it connects well and runs fine in the appletviewer. In my Internet Explorer the applet doesn't work and I get the following message: java.net.SocketException MESSAGE: java.security.AccessControlException: access denied ("java.net.SocketPermission" "[0:0:0:0:0:0:0:1]:3306" "connect,resolve") STACKTRACE: java.net.SocketException: java.security.AccessControlException: access denied ("java.net.SocketPermission" "[0:0:0:0:0:0:0:1]:3306" "connect,resolve") at com.mysql.jdbc.StandardSocketFactory.unwrapExceptionToProperClassAndThrowIt(StandardSocketFactory.java:407) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:268) at com.mysql.jdbc.MysqlIO.&lt;init&gt;(MysqlIO.java:271) at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771) at com.mysql.jdbc.Connection.&lt;init&gt;(Connection.java:1555) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at TableFromMySqlDatabase.&lt;init&gt;(TableFromMySqlDatabase.java:43) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source) at java.lang.reflect.Constructor.newInstance(Unknown Source) at java.lang.Class.newInstance(Unknown Source) at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter$1.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$400(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivile…
type: UnansweredQuestion
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/25803742
type: Question
has title: Cannot access my applet on browser because of a security exception
has comment: http://stackoverflow.com/comment/40358109
tagged with: security
score: 0
answer count: 1
tagged with: applet

http://stackoverflow.com/q/25736819
score: 3
has answer: http://stackoverflow.com/a/26842267
favorite count: 0
has comment: http://stackoverflow.com/comment/40240085
type: Question
answer count: 1
upvote count: 3
tagged with: java
has body: I am working on a simple Restful web service using Rest / Jersey with Tomcat 7. Things are working just fine if all of my Paths include a single parameter. If I include one that uses more than one parameter, I encounter the "No injection source found" error when I try to hit any of the resource paths supported by my resource class - even those that were working before. If I comment out that particular piece of code, all of my other paths work as expected. But if I uncomment out that piece of code, I cannot use ANY of the my paths. Here is a snippet of my code: import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; // get all the information about a specific item @GET @Path("/{id}") @Produces(MediaType.APPLICATION_JSON) public String getItem(@PathParam("id") String itemId) { String answer = "{"; answer += "\"itemid\":\"" + itemId + "\","; answer += "\"type\":0,"; answer += "\"sector\":322948,"; answer += "\"created\":53249098220"; answer += "}"; return answer; } // if I comment out this method, all is fine; // if I leave it in, error is thrown when I make any restful call // query to see if there is a new item for user @Path("/loc/{userid}/{xloc}/{yloc}") @Produces(MediaType.APPLICATION_JSON) public String getNewitem(@PathParam("userid") String userId, @PathParam("xloc") Number xLoc, @PathParam("yloc") Number yLoc) { String answer = "{\"itemid\":\"abcdefgh\"}"; return answer; } Here is the error trace: javax.servlet.ServletException: Servlet.init() for servlet Jersey REST Service threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Proces…
tagged with: jersey
downvote count: 0
tagged with: jersey-2.0
tagged with: jax-rs
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17568469
tagged with: rest
has title: no injection source found error when using multiple @PathParams in Restful Resource using Jersey

http://stackoverflow.com/comment/40779043
comment on: http://stackoverflow.com/a/25855603
has text: Your taglib configuration seems dodgy. Please see [this answer](http://stackoverflow.com/questions/2392993/struts-taglib-directive-in-a-jsp-page-for-tld-provided-by-struts) to configure Struts properly in your project and see if this solves your problem.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25721770
has body: One way it to add a PathParam or QueryParam to the Path to tell the device type in the request, so the service can be able to understand the type of device, from which the request is and create the appropriate JSON. Please check the most voted SO answer to find out whether the request is from mobile or desktop and add the parameter accordingly
score: 0
answers question: http://stackoverflow.com/q/25721676
type: Answer

http://stackoverflow.com/comment/40281216
has text: `double scores[] = new double[ parameterArray.length ]`. `ArrayList<Double>` will not work because it stores `Double` objects instead of `double` values, so the resulting array is `Double[]` and cannot be assigned to a `double[]`.
comment on: http://stackoverflow.com/q/25759473
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40276515
score: 0
comment on: http://stackoverflow.com/q/25746207
type: QuestionComment
type: Comment
has text: Thanks man. I need transf large 100-bytes message in given order between two servers in a LAN.

http://stackoverflow.com/a/26041492
has body: Looks like updating to the latest Canary build (0.8.11) fixes these issues. Also updating to the latest android gradle plugin (0.12) helped too.
answers question: http://stackoverflow.com/q/25872159
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25872159

http://stackoverflow.com/q/25839301
accepted answer: http://stackoverflow.com/a/25839340
tagged with: eclipse
possible better answer: http://stackoverflow.com/a/25839315
answer count: 2
has title: Code inside of a comment is causing compile failure - Why?
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25839340
score: 2
type: AnsweredQuestion
tagged with: compiler-errors
upvote count: 2
tagged with: java
has body: This may seem odd, but text in a comment is causing my code to not compile. (This is decompiled code; I don't format it like this normaly). The comment (at the very end of the file; added automatically by the decompiler): /* Location: C:\Pokechu22\TestServer\plugins\uSkyBlock.jar * Qualified Name: us.talabrek.ultimateskyblock.uSkyBlock * JD-Core Version: 0.7.0.1 */ Here's an image of what it looks like in eclipse. Here are the exact error messages (and these are the ONLY error messages, and are all in that one comment): Description Resource Path Location Type Core cannot be resolved to a type uSkyBlock.java /SO_UnicodeEscapeError/src/us/talabrek/ultimateskyblock line 2009 Java Problem Invalid unicode uSkyBlock.java /SO_UnicodeEscapeError/src/us/talabrek/ultimateskyblock line 2005 Java Problem Qualified cannot be resolved to a type uSkyBlock.java /SO_UnicodeEscapeError/src/us/talabrek/ultimateskyblock line 2007 Java Problem The error for plugins is eclipse complaining about a typo: The word 'plugins' is not correctly spelled. This is easy for me to resolve - I can just delete that comment - but why would this be happening? Shouldn't code in comments be completely ignored? EDIT: As an additional note, all of the errors are inside of the comment block, and removal of the comment block allows the code to compile. That's not the question here. My question is why does java care about the text in the comment at all here?
type: Question
has answer: http://stackoverflow.com/a/25839315

currency
tag name: currency
tags question: http://stackoverflow.com/q/25756736
tags question: http://stackoverflow.com/q/25773612
type: Tag
tags question: http://stackoverflow.com/q/25727486

http://stackoverflow.com/comment/40197950
type: QuestionComment
has text: my queryString sample code is just a sample to show you what I wanted, this code does not compile, I need help to write a complete of this code:String queryString = "select p from prodTable p where (today - p.ProductDate) greaterThan 2 months AND p is not in (select c from prodCategory c where c.ProductID = p.ProductID and c.category = '09' )
comment on: http://stackoverflow.com/q/25714545
score: 0
type: Comment

http://stackoverflow.com/q/25800828
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25800976
has body: I am learning Java EE CDI, dependency injection, and @Produces in particular. I am wondering why in getGreedingCard() method, it needs a @Produces annotation at all, since the two classes GreetingCardImpl and AnotherGreetingCardImpl are already imported into the space. This is just like the regular package/class dependency and a simple import solves the problem. Why does it need a dependency injection through a @producer annotation? Thanks for explanation in advance. public interface GreetingCard { void sayHello(); } public class GreetingCardImpl implements GreetingCard { public void sayHello() { System.out.println("Hello!!!"); } } public class AnotherGreetingCardImpl implements GreetingCard { public void sayHello() { System.out.println("Have a nice day!!!"); } } import com.javacodegeeks.snippets.enterprise.cdibeans.impl.AnotherGreetingCardImpl; import com.javacodegeeks.snippets.enterprise.cdibeans.impl.GreetingCardImpl; @SessionScoped public class GreetingCardFactory implements Serializable { private GreetingType greetingType; @Produces public GreetingCard getGreetingCard() { switch (greetingType) { case HELLO: return new GreetingCardImpl(); case ANOTHER_HI: return new AnotherGreetingCardImpl(); default: return new GreetingCardImpl(); } } }
tagged with: cdi
type: Question
has title: @Producer annotation in Java EE
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/25804290
upvote count: 1
has answer: http://stackoverflow.com/a/25804290
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/22982422
has answer: http://stackoverflow.com/a/25800976
tagged with: dependency-injection
has comment: http://stackoverflow.com/comment/40362489
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/comment/40462867
type: Comment
type: QuestionComment
has text: @BadZen The [javadoc](http://docs.oracle.com/javase/7/docs/api/java/util/StringTokenizer.html) says (in part) *`StringTokenizer` is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.*
score: 1
comment on: http://stackoverflow.com/q/25858792

http://stackoverflow.com/a/25735237
has body: The main issue is ... g.fillRect(j * 100, height - 400, 100, nums[j] * 15); Basically, this says to draw a rect from j * 100 x height - 400 that is 100 wide and nums[j] * 15 high... The rectangle is drawn right/down from the x/y position You need to offset the y position from the height by the height of the bar... g.fillRect(j * 100, height - (nums[j] * 15), 100, nums[j] * 15); Don't override paint, it's not the best method to use, consider using paintComponentand make sure you call super.paintComponent before you perform any custom painting. See Performing Custom Painting for more details. Don't use setSize on components, any values you pass it will be reset by the parent container's layout manager. Override the getPreferredSize of the JPanel instead. Never assume anything about the actual size of the component from within the paint method, what you want and what you get won't always be the same thing. Use getWidth and getHeight to determine the actual size of the viewable area.
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25735195
has comment: http://stackoverflow.com/comment/40236949
score: 3
has comment: http://stackoverflow.com/comment/40236984
upvote count: 3

http://stackoverflow.com/comment/40365255
type: AnswerComment
type: Comment
has text: @Eypros It will be slightly slower at the start/end as it will need to allocate and construct the objects and then garbage collect them after use. It will be much faster while processing though as there is no need to maintain/build the HashMap and no HashMap lookups.
comment on: http://stackoverflow.com/a/25804683
score: 0

http://stackoverflow.com/a/25876051
has body: Found the issue, it was our bad. When Hibernate sets the object with the enum value it calls our implementation of UserType , at that point we configured it incorrectly. Our code did catch the error but it didn't do anything with it, not even a log statement.
score: 0
answers question: http://stackoverflow.com/q/25858870
type: Answer

http://stackoverflow.com/comment/123908761
type: AnswerComment
comment on: http://stackoverflow.com/a/58415783
has text: @LibinThomas, For first solution, try adding the flag, so instead of the above code, use it like this: `requireView().performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING)`
score: 0
type: Comment

image-loading
tags question: http://stackoverflow.com/q/25792166
type: Tag
tag name: image-loading

http://stackoverflow.com/a/25790638
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40337598
has comment: http://stackoverflow.com/comment/40337551
type: Answer
upvote count: 6
accepted answer of: http://stackoverflow.com/q/25790288
has comment: http://stackoverflow.com/comment/40337503
answers question: http://stackoverflow.com/q/25790288
score: 6
has body: Since Date is a mutable type, the code that passed you the Date can continue to modify it after passing it to your function/constructor. So, instead of just assigning the Date passed to you, you should instead make a copy of it to prevent this from happening: this.lastAccessTime = new Date(lastAccessTime.getTime()); This is covered in Effective Java: Second Edition by Joshua Bloch as Item 39: Make defensive copies when needed. Note that you should make this copy before doing any validation on the Date as well. Edit: As noted below, a null check should happen before the copy to prevent a NullPointerException, but other validation should be done after making the copy.

http://stackoverflow.com/comment/40409697
type: QuestionComment
type: Comment
has text: it compiles, i just cant get the correct return im looking for @Pshemo
comment on: http://stackoverflow.com/q/25829866
score: 0

http://stackoverflow.com/q/25860318
score: 0
has title: Text on Button not visible on Button Android layout
answer count: 1
tagged with: button
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40466271
has comment: http://stackoverflow.com/comment/40466329
has comment: http://stackoverflow.com/comment/40466142
tagged with: java
has comment: http://stackoverflow.com/comment/40466356
type: Question
tagged with: android-layout
has body: So I'm using text on button like this and I'm using picasso to display the images but I think the text on button is behind the picasso images how to make text appear up front to the images Full XML Layout <ImageButton android:id="@+id/aboutview" android:layout_width="150dp" android:layout_height="match_parent" android:layout_marginBottom="5dp" android:layout_marginRight="5dp" android:layout_weight="1" android:adjustViewBounds="true" android:background="@color/White" android:cropToPadding="true" android:scaleType="fitXY" /> <ImageButton android:id="@+id/aboutus1" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginBottom="5dp" android:layout_marginRight="5dp" android:layout_weight="1" android:adjustViewBounds="true" android:background="@color/White" android:scaleType="fitXY" /> <ImageButton android:id="@+id/contacts" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginBottom="5dp" android:layout_weight="1" android:adjustViewBounds="true"/> <ImageButton android:id="@+id/acc" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginBottom="5dp" android:layout_marginRight="5dp" android:layout_weight="0.8" android:adjustViewBounds="true" android:background="@color/White" android:scaleType="fitXY" /> <ImageButton android:id="@+id/sw6products" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginBottom="5dp" android:layout_marginRight="5dp" android:layout_weight="1.4" android:adjustViewBounds="true" android:background="@color/White" android:scaleType="fitXY" /> <ImageButton android:id="@+id/plans" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginBottom="5dp" android:layout_weight="0.8" android:adjustViewBounds="true" android:background="@color/White" android:scaleType="fitXY" /> <ImageButton android:id="@+id/shops" android:layout_width="0dp" android:layout_height="match_parent" android:layout_marginBottom="5dp" an…
has answer: http://stackoverflow.com/a/25865973
has comment: http://stackoverflow.com/comment/40465719

http://stackoverflow.com/q/25746905
upvote count: 1
has answer: http://stackoverflow.com/a/25747151
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25747151
tagged with: java
type: Question
has body: Trying to get back into using Java now that school has picked up again and I'm having a lot of trouble getting a method to work properly between two classes. I have a "Family" class and a "Member" class and I need to make sure each member has a different unique ID when they are added to the family. So far I have: public class Family { private ArrayList &lt;Member&gt; FamilyMembers; ... public Family() { FamilyMembers = new ArrayList&lt;Member&gt;(); } .... public ArrayList getMembers() { return FamilyMembers; } } and public class Member { private int ID; ... public Member(int newID, String newMemberName, String newSex) { this.ID = newID; ... } public void setID(int newID) { boolean unique = true; for(Member m: Family.getMembers()) { if(m.getID()==newID) { unique=false; } } if(true) { this.ID = newID; } } When I compile I get the error that a non-static method getMembers cannot be referenced from static context? I don't understand why I can't use the get method from my Family class to perform a search before setting an ID? Any help or suggestions are greatly appreciated!
has answer: http://stackoverflow.com/a/25747061
downvote count: 0
tagged with: class
tagged with: arraylist
tagged with: bluej
possible better answer: http://stackoverflow.com/a/25747061
answer count: 2
has title: ArrayList Search in BlueJ
score: 1
favorite count: 0

http://stackoverflow.com/q/25855637
has comment: http://stackoverflow.com/comment/40456779
accepted answer: http://stackoverflow.com/a/25855712
tagged with: java-8
upvote count: 6
has answer: http://stackoverflow.com/a/25855930
type: AnsweredQuestion
tagged with: java-stream
tagged with: predicate
tagged with: java
score: 6
has comment: http://stackoverflow.com/comment/40456642
possible better answer: http://stackoverflow.com/a/25855930
type: Question
has answer: http://stackoverflow.com/a/25855712
has comment: http://stackoverflow.com/comment/40456679
answer count: 2
downvote count: 0
has title: To check whether all elements of a `Stream` are identical
has body: I am in the process of changing some of my old code to take advantage of the functional aspects of Java 8. In particular, I am moving from using Guava predicates to java.util.function.Predicate. One of the predicates is to check whether a Stream is homogeneous, i.e. consists of all identical elements. In my old code (using Guava's Predicate), I had this: static &lt;T&gt; Predicate&lt;Iterable&lt;T&gt;&gt; isHomogeneous() { return new Predicate&lt;Iterable&lt;T&gt;&gt;() { public boolean apply(Iterable&lt;T&gt; iterable) { return Sets.newHashSet(iterable).size() == 1; } }; } This is the new version, using java.util.function.Predicate: public static Predicate&lt;Stream&lt;?&gt;&gt; isHomogeneous = stream -&gt; stream.collect(Collectors.toSet()).size() == 1; The IDE (IntellijIDEA v.12) doesn't show any red squiggly line to indicate an error, but when I try to compile, I get this: java: no suitable method found for collect(java.util.stream.Collector&lt;java.lang.Object,capture#1 of ?,java.util.Set&lt;java.lang.Object&gt;&gt;) method java.util.stream.Stream.&lt;R&gt;collect(java.util.function.Supplier&lt;R&gt;,java.util.function.BiConsumer&lt;R,? super capture#2 of ?&gt;,java.util.function.BiConsumer&lt;R,R&gt;) is not applicable (cannot infer type-variable(s) R (actual and formal argument lists differ in length)) method java.util.stream.Stream.&lt;R,A&gt;collect(java.util.stream.Collector&lt;? super capture#2 of ?,A,R&gt;) is not applicable (cannot infer type-variable(s) R,A,capture#3 of ?,T (argument mismatch; java.util.stream.Collector&lt;capture#2 of ?,capture#4 of ?,java.util.Set&lt;capture#2 of ?&gt;&gt; cannot be converted to java.util.stream.Collector&lt;? super capture#2 of ?,capture#4 of ?,java.util.Set&lt;capture#2 of ?&gt;&gt;)) Note: I think having a predicate on a stream is probably not a good idea. In fact, in my codebase, I only need it on a List&lt;&gt;. But I am still curious about what is wrong with the simple one-line isHomogeneous predicate.
favorite count: 0

http://stackoverflow.com/q/25770690
answer count: 1
tagged with: jtable
has comment: http://stackoverflow.com/comment/40301536
tagged with: jdbc
has body: How i refresh the JTable ? Here is my Code. public void itemStateChanged(ItemEvent evt) { String text=(String)to_Cmb2.getSelectedItem(); try { // Connect to an Access Database Connection con=DriverManager.getConnection("jdbc:odbc:flightdsn"); Statement s=con.createStatement(); // Read data from a table ResultSet rs = s.executeQuery("SELECT FlightNo,City,To,Arrives,Departs FROM I_Flights_Routes WHERE To ='"+text+"' "); ResultSetMetaData md = rs.getMetaData(); int columns = md.getColumnCount(); // Get column names for (int i = 1; i &lt;= columns; i++) { columnNames.addElement(md.getColumnName(i)); } // Get row data while (rs.next()) { Vector&lt;Object&gt; row = new Vector&lt;&gt;(columns); for (int i = 1; i &lt;= columns; i++) { row.addElement(rs.getObject(i)); } data.addElement(row); } rs.close(); s.close(); con.close(); } catch (Exception e) { System.out.println(e); } // Create table with database data JTable table = new JTable(data, columnNames) { public Class getColumnClass(int column) { for (int row = 0; row &lt; getRowCount(); row++) { Object o = getValueAt(row, column); if (o != null) { return o.getClass(); } } return Object.class; } }; JScrollPane scrollPane = new JScrollPane(table); scrollPane.setBounds(50,10,400,200); td.add(scrollPane); // td is Jpanel object td.setVisible(true); }
has title: Refreshing JTable data using JcomboBox items coming from Access Database
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/40301590
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40301367
tagged with: swing
downvote count: 1
has answer: http://stackoverflow.com/a/25770791
has comment: http://stackoverflow.com/comment/40301299
tagged with: java
has comment: http://stackoverflow.com/comment/40301654
type: Question
upvote count: 0

pass-by-reference
tags question: http://stackoverflow.com/q/25772481
tags question: http://stackoverflow.com/q/25820073
type: Tag
tag name: pass-by-reference
tags question: http://stackoverflow.com/q/25751743

http://stackoverflow.com/comment/40615518
has text: It seems to me too much work for the server to loop over all of my group instances for every player message. Let's take for example Zinga poker. Every group in my app is as a table in Zynga poker. How can I manage those groups and the players in those groups?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25822481

http://stackoverflow.com/comment/40341441
score: 0
comment on: http://stackoverflow.com/a/25792136
type: Comment
has text: I think that by using a synchronized map, you can do a copy of it and it'll block other threads trying to access it. That way, you don't have to modify the caller so it uses it with a synchronized block, which makes code stinking.
type: AnswerComment

http://stackoverflow.com/comment/40246873
score: 0
type: Comment
type: QuestionComment
has text: If your editor runs as a normal editor in the edit area then it must be derived from something that implements `IEditorPart`.
comment on: http://stackoverflow.com/q/25740501

http://stackoverflow.com/q/25850351
type: Question
has title: Why my code drops this error?
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25850873
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40447127
has body: Hello im using eclipse with JavaSE-1.6, JUnit 4 and selenium-java 2.43.0. Idont know why it doesnt works. I try to change the firefoxdriver for chromedriver or iedriver but itś the same. My Code package test; import java.util.List; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import Pages.Register; public class RegisterNewUser { Register register; WebDriver driver; @Before public void initiation(){ this.driver = new FirefoxDriver(); this.register = new Register (driver); this.driver.get("http//:e-farmacity.com/customer/account/create/"); } @Test public void testRegisterNewUser() { register.getLastNameTextBox().sendKeys("NewUser"); register.getLastNameTextBox().sendKeys("Test"); register.getEmailTextBox().sendKeys("test@lyracons.com"); register.getDayTextBox().sendKeys("09"); register.getMonthTextBox().sendKeys("03"); register.getYearTextBox().sendKeys("1993"); List&lt;WebElement&gt; listOfGender = register.getGenderRadioButtons(); listOfGender.get(0).click(); register.getDniTextBox().sendKeys("38146782"); register.getTelTextBox().sendKeys("221123123"); register.getPassTextBox().sendKeys("prueba123"); register.getConfirmPassTextBox().sendKeys("prueba123"); register.getSuscriptionRadioButton().click(); register.getSubmitButton().click(); } @After public void finishtest() { this.driver.close(); } } The error java.lang.NoClassDefFoundError: com/google/common/base/Function at test.RegisterNewUser.initiation(RegisterNewUser.java:26) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:622) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.…
score: -1
has comment: http://stackoverflow.com/comment/40446980
tagged with: java
has comment: http://stackoverflow.com/comment/40447039
downvote count: 2
tagged with: selenium
upvote count: 1
linked to: http://stackoverflow.com/q/5134953

http://stackoverflow.com/comment/40312800
has text: @MadProgrammer Thanks, now I get it. You should've posted it as an answer.
comment on: http://stackoverflow.com/q/25775190
score: 0
type: Comment
type: QuestionComment

opencv
type: Tag
tags question: http://stackoverflow.com/q/25858729
tags question: http://stackoverflow.com/q/25766543
tags question: http://stackoverflow.com/q/25771332
tags question: http://stackoverflow.com/q/25754613
tags question: http://stackoverflow.com/q/25732685
tag name: opencv
tags question: http://stackoverflow.com/q/25787785
tags question: http://stackoverflow.com/q/25750144
tags question: http://stackoverflow.com/q/25770010
tags question: http://stackoverflow.com/q/25871319
tags question: http://stackoverflow.com/q/25739891
tags question: http://stackoverflow.com/q/25748096
tags question: http://stackoverflow.com/q/25754609
tags question: http://stackoverflow.com/q/25724923
tags question: http://stackoverflow.com/q/25853671
tags question: http://stackoverflow.com/q/25837934
tags question: http://stackoverflow.com/q/25727601
tags question: http://stackoverflow.com/q/25826018
tags question: http://stackoverflow.com/q/25752497
tags question: http://stackoverflow.com/q/25763112
tags question: http://stackoverflow.com/q/25777746
tags question: http://stackoverflow.com/q/25847554

http://stackoverflow.com/comment/40381066
has text: "Sometimes they are errorneous too" - but is your XML valid? If not, you may need to use something like JTidy first.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25811351
type: QuestionComment

http://stackoverflow.com/a/25737798
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25731664
upvote count: 2
has body: The answer was to set each VBox's pickOnBounds property to false. Since a VBox is really a blank container with no geometric shape, disabling the pick on bounds renders the VBox invisible while leaving its children intact.
score: 2

http://stackoverflow.com/comment/40417899
comment on: http://stackoverflow.com/a/25834389
has text: I've tested with { 5, 2, 0, 3, 8, 0, 1 }; and works fine it returns:[1, 2, 3, 5, 8, 0, 0]
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40475083
comment on: http://stackoverflow.com/a/25853827
score: 1
type: AnswerComment
has text: The compiler does **not** create any methods if your class implements `Serializable` or `Cloneable`. You may verify it by inspecting your class files. Further, creating “shortcut interfaces” is **not** what marker interfaces is about. And it’s a real bad coding practice as it would require creating additional *implementation* classes to fulfill the additional interfaces. By the way, Java *has* intersection types for a decade now. Learn about Generics…
type: Comment

http://stackoverflow.com/comment/40339074
type: QuestionComment
has text: I tried to, SO complained. The driver file that executes the code is [this](http://pastebin.com/epqGCBEk)
score: 0
comment on: http://stackoverflow.com/q/25772114
type: Comment

http://stackoverflow.com/comment/40254342
score: 0
type: AnswerComment
has text: Whatever you are saying i understood.Exactly you are correct.But i am unable to understand what is happening in my scenario.Any how thanks for good help.+1
type: Comment
comment on: http://stackoverflow.com/a/25744283

http://stackoverflow.com/comment/40230123
comment on: http://stackoverflow.com/q/25725996
has text: Are you running the android application off your phone or an emulator?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25744009
has comment: http://stackoverflow.com/comment/95426664
downvote count: 0
score: 3
has body: Run this Maven plugin to get a report of all the different licenses your project's dependencies need: https://maven.apache.org/plugins/maven-project-info-reports-plugin/licenses-mojo.html You might need to configure the report before the command works as expected: https://maven.apache.org/plugins/maven-project-info-reports-plugin/examples/selective-reports.html The next step is then to identify the dependencies that you want to replace and find open source alternatives. Note: Doing everything open source is commendable (I try it myself) but OpenJDK 6 and 7 didn't receive the same amount of testing and "love" than the official Oracle JDK releases. I had numerous problems with both of them and I stay away from them - they have wasted too much of my time. Things are probably better with OpenJDK 8 but I can't tell for sure.
accepted answer of: http://stackoverflow.com/q/25740043
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25740043
upvote count: 3
type: Answer

http://stackoverflow.com/comment/40220554
has text: @tyczj I tried but `onDestroy()` won't be fired!
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25726829
score: 1

http://stackoverflow.com/comment/40213232
type: QuestionComment
has text: What you mean "from the java code"? from the build process? from another eclipse plugin?
comment on: http://stackoverflow.com/q/25722965
score: 0
type: Comment

http://stackoverflow.com/a/25788861
has comment: http://stackoverflow.com/comment/40334089
has comment: http://stackoverflow.com/comment/40334643
score: 0
has body: Try to check this test before your code: File file = new File("/home/asad/workspace/MyFirstProject/HelloWorld.txt"); if( file.exists() ) { System.out.println("File exists!"); } else { System.out.println("File not existst!"); } if you get FileNotFoundException, file isn't in this localization or file name is incorrect.
answers question: http://stackoverflow.com/q/25788428
type: Answer
has comment: http://stackoverflow.com/comment/40334155

http://stackoverflow.com/comment/40366445
type: AnswerComment
type: Comment
has text: I figured that i can use try catch in main function to determine the required int, thanks for the answer however!
comment on: http://stackoverflow.com/a/25806206
score: 0

http://stackoverflow.com/comment/40505297
type: AnswerComment
has text: Above your answer is working perfectly on Java 7. But what about the java 5, java 6 etc.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25862425

http://stackoverflow.com/q/25728347
score: 0
tagged with: validation
answer count: 1
has title: Java Spring: how to validate only specific fields from my entity
has body: I'm new in Spring and I have a problem with form validation. In my user edit form I want to validate only specific fields, not all fields annotated in my entity. For example, if I have my UserEntity with fields: @Entity @Table(name = "users") public class UserEntity { @Id @Column(name = "user_id") @GeneratedValue public int user_id; @NotEmpty @Column(name = "userlogin") public String userlogin; @NotEmpty @Column(name = "userpass") public String userpass; @NotEmpty @Column(name = "name") public String name; @Email @NotEmpty @Column(name = "email") public String email; @NumberFormat(style = Style.NUMBER) @NotEmpty @Column(name = "phone") public String phone; and when I have register form, I need to validate all fields, and that's working fine. But when I have edit user form, I want to edit and validate only 'name', 'email' and 'phone', I don't want to change 'userlogin' and 'userpass'. But edit form won't pass successfully, because BindingResult validating all fields. Here's my edit form: <springForm:form action="/mywebapp/user/edit" commandName="user" method="POST"> Name: <springForm:input path="name" value="${user.name}" /> <springForm:errors path="name" cssClass="error" /> E-mail: <springForm:input path="email" value="${user.email }" /> <springForm:errors path="email" cssClass="error" /> Phone: <springForm:input path="phone" value="${user.phone}" /> <springForm:errors path="phone" cssClass="error" /> </springForm:form> Here is my controller method: @RequestMapping(value="user/edit", method=RequestMethod.POST) public String doUserEdit(@Valid @ModelAttribute("user") UserEntity user, BindingResult result, Principal principal) { if(result.hasErrors()) { return "user/edit"; } UserEntity u = this.userService.getUser(principal.getName()); this.userService.editUser(u.getUser_id(), user); return "redirect:/user"; } result.hasError() always return true, because it validating also 'userlogin' and 'userpass'. How to ignore other fields in edit form and validate only that field…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25728803
tagged with: spring
tagged with: java
tagged with: hibernate
tagged with: forms
type: Question
has comment: http://stackoverflow.com/comment/40224593

http://stackoverflow.com/q/25727708
tagged with: file-extension
has answer: http://stackoverflow.com/a/25728149
possible better answer: http://stackoverflow.com/a/25727850
has title: Java I/O writing, mixingcase and getExtension problems
tagged with: mixed-case
type: Question
score: 1
tagged with: java
has body: I am changing names of all files in directory and if it's text file I am changing the content but it doesn't seem to work the name of the file is changed right but content is blank/gone heres is my code: import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import org.apache.commons.io.FilenameUtils; public class FileOps { public static File folder = new File( "C:\\Users\\N\\Desktop\\New folder\\RenamingFiles\\src\\renaming\\Files"); public static File[] listOfFiles = folder.listFiles(); public static void main(String[] argv) throws IOException { toUpperCase(); } public static void toUpperCase() throws FileNotFoundException { for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { String newname = mixCase(listOfFiles[i].getName()); if (listOfFiles[i].renameTo(new File(folder, newname))) { String extension = FilenameUtils .getExtension(listOfFiles[i].getName()); if (extension.equals("txt") || extension.equals("pdf") || extension.equals("docx") || extension.equals("log")) { rewrite(listOfFiles[i]); System.out.println("Done"); } } } else { System.out.println("Nope"); } } } public static String mixCase(String in) { StringBuilder sb = new StringBuilder(); if (in != null) { char[] arr = in.toCharArray(); if (arr.length &gt; 0) { char f = arr[0]; boolean first = Character.isUpperCase(f); for (int i = 0; i &lt; arr.length; i++) { sb.append((first) ? Character.toLowerCase(arr[i]) : Character.toUpperCase(arr[i])); first = !first; } } } return sb.toString(); } public static void rewrite(File file) throws FileNotFoundException { FileReader reader = new FileReader(file.getAbsolutePath()); BufferedReader inFile = new BufferedReader(reader); try { FileWriter fwriter = new FileWriter(file.getAbsolutePath()); BufferedWriter outw = new BufferedWriter(fwriter); while (inFile.readLine() != null) { String line = mix…
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/25727850
favorite count: 0
tagged with: file-io
accepted answer: http://stackoverflow.com/a/25728149
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40222401

http://stackoverflow.com/a/25799287
has comment: http://stackoverflow.com/comment/40354399
answers question: http://stackoverflow.com/q/25799235
has body: public static void printFactor( int z){ for(int i = 1; i &lt; sqrt(z); i++){ if(z%i == 0){ system.out.println(i);} } } The == 0 is to make sure there is no remainder because the factor has to be an number with no decimal (of course) The sqrt is because you would be checking the same numbers if you went passed that value.
downvote count: 0
type: Answer
score: 1
has comment: http://stackoverflow.com/comment/40354391
upvote count: 1

http://stackoverflow.com/comment/101490151
comment on: http://stackoverflow.com/a/25809240
score: 2
type: AnswerComment
type: Comment
has text: @assylias finally, I added a high-performance alternative for those, who really need it. Though I continue recommending the readable version, unless that last bit of speed is really needed…

http://stackoverflow.com/q/25753953
tagged with: android
has comment: http://stackoverflow.com/comment/40271861
has comment: http://stackoverflow.com/comment/40271820
has comment: http://stackoverflow.com/comment/40272786
linked to: http://stackoverflow.com/q/32077086
tagged with: fragment
has comment: http://stackoverflow.com/comment/40272683
downvote count: 0
has comment: http://stackoverflow.com/comment/40272595
has comment: http://stackoverflow.com/comment/40272249
tagged with: java
score: 6
has comment: http://stackoverflow.com/comment/40282123
has comment: http://stackoverflow.com/comment/40271886
has body: I have been looking at stackoverflow to solve my problem and found something pretty good, but it does not work for me or I am to stupid to see it (How to implement OnFragmentInteractionListener) I want to place a fragment inside a Frame, so I created it and so on. I have to implenet an interface and its method. I (think) I did it, but my App crashes everytime... *Edit: My App crashes, when I call openHome or openRecommended, the onCreate method works, I get these errors, but everything is beeing displayed correctly. This is my code: MainActivity.java import android.app.Activity; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.View; public class MainActivity extends Activity implements HomeFragment.OnFragmentInteractionListener, RecommendedFragment.OnFragmentInteractionListener { FragmentTransaction fragmentTransaction; HomeFragment homeFragment; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); homeFragment = new HomeFragment(); getFragmentManager().beginTransaction().add(R.id.mainFrame, homeFragment).commit(); } protected void openHome(View view) { /*Intent homeIntent = new Intent(this, HomeFragment.class); startActivity(homeIntent); homeFragment = new HomeFragment(); getFragmentManager().beginTransaction().replace(R.id.mainFrame, homeFragment).commit();*/ System.out.println("Success"); } public void openRecommended(View view) { Intent recommendedIntent = new Intent(this, RecommendedFragment.class); startActivity(recommendedIntent); RecommendedFragment recommendedFragment = new RecommendedFragment(); getFragmentManager().beginTransaction().replace(R.id.mainFrame, recommendedFragment).commit(); } @Override public void onFragmentInteractionHome(Uri uri) { } @Override public void onFragmentInteractionRecommended(Uri uri) { } } HomeFragment.java import an…
has title: Android: error with on fragment interaction Listener
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40271761
has comment: http://stackoverflow.com/comment/40282373
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/40272420
has answer: http://stackoverflow.com/a/25754781
accepted answer: http://stackoverflow.com/a/25754781
linked to: http://stackoverflow.com/q/24777985
answer count: 1
upvote count: 6
has comment: http://stackoverflow.com/comment/40272508
favorite count: 0
tagged with: interface

http://stackoverflow.com/comment/40272944
has text: For some reason it didn't put in my text properly. I have no problem sending it as an ArrayList<String>. The problem is sending as ArrayList<byte>
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25754634
score: 0

http://stackoverflow.com/a/25810887
score: 0
answers question: http://stackoverflow.com/q/25810293
type: Answer
has body: Set&lt;String&gt; temp = C.userPreferences.getStringSet("default", Here==null ? new HashSet&lt;String&gt;() : Here) ;

http://stackoverflow.com/comment/40276209
comment on: http://stackoverflow.com/a/25756498
type: AnswerComment
score: 0
type: Comment
has text: Ah now i see where the problem lies , what would you suggest i do so that it will return true. the .xyzxyz gets past the str.contain and gets caught at second if statement. every other input works except when the string contains both .xyz and xyz seperately

http://stackoverflow.com/a/25798795
type: Answer
score: 1
upvote count: 1
has body: The first index is 0. When you add at position 1 it makes it the second item, and when you remove position 2, you are removing the third position.
answers question: http://stackoverflow.com/q/25798776
downvote count: 0

http://stackoverflow.com/a/25871896
has body: I'd return void. The absence of an exception implies it worked fine.
has comment: http://stackoverflow.com/comment/40486467
downvote count: 0
has comment: http://stackoverflow.com/comment/40507351
answers question: http://stackoverflow.com/q/25871816
upvote count: 2
has comment: http://stackoverflow.com/comment/40494910
type: Answer
score: 2

http://stackoverflow.com/comment/40429595
comment on: http://stackoverflow.com/q/25840461
type: Comment
type: QuestionComment
has text: @alfasin if you catch other subtype (ie: NPE), the code must be changed, (or you throw the IOE or you create other catch block)
score: 0

http://stackoverflow.com/comment/40363183
comment on: http://stackoverflow.com/q/25740161
type: Comment
type: QuestionComment
has text: I see once implementation of storing data with history support. It was whited without any framework, on PLSQL, and it was horrible. Main idea - you have PK = entity Id + time of revision. All select queries can return last revision (by default) or revision on some time. Drawback of this method - very difficult to write code and queries, slow sql queries and loosing FK ability. I know, it is not answer to your question, but maybe this help you in some way.
score: 1

http://stackoverflow.com/comment/40365292
comment on: http://stackoverflow.com/a/25792111
has text: Yep, forgot about surefire plugin configuration
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25799117
accepted answer of: http://stackoverflow.com/q/25798984
score: 0
type: Answer
has body: Figured out my problem. @LuiggiMedoza was correct. The URL was wrong. I had to switch it to jdbc:mysql:mysql.cd.iastate.edy:3306/db309T11
answers question: http://stackoverflow.com/q/25798984
type: AcceptedAnswer

http://stackoverflow.com/comment/40376152
type: QuestionComment
has text: I cleared the classnotfound exception, I am getting one more exception IllegalStateException mentioned above. Also I have updated the question with .xml file. Please have a look
comment on: http://stackoverflow.com/q/25811438
score: 0
type: Comment

http://stackoverflow.com/comment/40280042
type: QuestionComment
comment on: http://stackoverflow.com/q/25758591
has text: Pardon my french but why do you need client's MAC address?
score: 0
type: Comment

http://stackoverflow.com/comment/40314268
type: QuestionComment
has text: what do you mean display it through the output of netbeans? do you mean console?
type: Comment
comment on: http://stackoverflow.com/q/25777275
score: 0

http://stackoverflow.com/q/25713315
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25714040
answer count: 2
has answer: http://stackoverflow.com/a/25713352
downvote count: 0
tagged with: spring-security
has body: I am developing my very first application with Spring (4.0.2), Spring @MVC (4.0.2) and Spring Security (3.2.5). I am now able to successfully log in by using Spring Security but now a "Good practices" question has come to my mind: Currently I hace implemented my own version of UserDetails and UserDetailsService in order to save the details fetched from the DB. Which is the best way (cleaner) to get the UserDetails? So far I am using these two alternatives: Using the next code line in the method Authentication auth = SecurityContextHolder.getContext().getAuthentication(); Adding the parameter Authentication auth and the next line inside the method User user = ((CurrentUserDetails) auth.getPrincipal()).getCurrentUser(); My impression is that I am dirtying the code. Don't you think so?
has title: Spring Security - Get login user within Controllers - Good manners
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: spring
type: Question
tagged with: spring-mvc

http://stackoverflow.com/a/25726042
type: Answer
has body: I would suggest you start by creating a helper method to mix the case one String at a time, something like - public static String mixCase(String in) { StringBuilder sb = new StringBuilder(); if (in != null) { char[] arr = in.toCharArray(); if (arr.length &gt; 0) { char f = arr[0]; boolean first = Character.isUpperCase(f); for (int i = 0; i &lt; arr.length; i++) { sb.append((first) ? Character.toLowerCase(arr[i]) : Character.toUpperCase(arr[i])); first = !first; } } } return sb.toString(); } I tested it with public static void main(String[] args) { System.out.println(mixCase("TextFile")); System.out.println(mixCase("reverse")); } Output is tExTfIlE ReVeRsE
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25725910
answers question: http://stackoverflow.com/q/25725910

http://stackoverflow.com/q/25756089
has body: I am new to NIO and NIO2. I have been playing with an Echo server sample code, which works flawlessly. I started to write a similar client. My goal is to have multiple client socket connections running off the one main-thread. I do get the OP_CONNECT, then after that the selector does not return and times out from the: while(Selector.select(10000)>0) { .... } If I ignore the selector and start reading the data with socketChannel.read(...), I can read the data. So, the data is ready to be read, but I just do not get Selector.select(10000) to return with some keys. Here is the complete source code and I really would appreciate any help: package com.maker.webscraping.nio; import java.io.IOException; import java.net.StandardSocketOptions; import java.nio.ByteBuffer; import java.nio.CharBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.SocketChannel; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; import java.util.Iterator; import java.util.Map; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class EchoClient2 { private static final Logger logger = LoggerFactory.getLogger(EchoClient2.class); private static final Map&lt;SocketChannel, EchoClient2&gt; mapClients = new ConcurrentHashMap&lt;&gt;(); private static final int DEFAULT_PORT = 5555; private static final String IP = "127.0.0.1"; private final int clientID; private final ByteBuffer buffer; private final SocketChannel socketChannel; private final CharsetDecoder decoder; public int getClientID() { return clientID; } public ByteBuffer getBuffer() { return buffer; } public CharsetDecoder getDecoder() { return decoder; } //private static Selector selector = null; public static void main(String[] args) { Selector selector = null; try { selector = Selector.open(); if (!selector.isOpen()) throw new RuntimeException("Selector closed!"); EchoClient2[] clients…
tagged with: nio2
tagged with: java
type: Question
tagged with: selector
tagged with: nio
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25756106
type: UnansweredQuestion
has title: Not getting OP_READ in my client
tagged with: client

http://stackoverflow.com/comment/40379728
score: 0
type: Comment
type: QuestionComment
has text: I just read the tutorial, and it show a page with an URL of `http://localhost:8080/helloWeb/owners`. Did you try to use `helloWeb` instead of `Snoutbook-1.0.0-SNAPSHOT` ?
comment on: http://stackoverflow.com/q/25810121

http://stackoverflow.com/q/25718440
type: Question
tagged with: null
has body: I've created my own MyDate class. It basically wraps a Long value with some pretty toString() functions. I've implemented equals() and compareTo(). my program reads some data and instantiates object of classes that hold this MyDate class. Problem is that sometimes that data is bad so I created a public static final long NODATE = Long.MIN_VALUE; so that I could initiate a new instance that is empty (replace the null in the containing class so to avoid NullPointerExceptions). I've also implemented a constructor with no arguments that inits the Long value to NODATE. My Problem: I want to check if a MyDate is valued as NODATE. I can't compare to NODATE since it's Long and not MyDate. One way to do this is: if someObject.myDate.equals(new MyDate()). But it seems like a waste to create an object just to make the comparison? Another way is to implement MyDate.amINoDate() method. Is there another way? I was thinking of creating an static instance of MyDate that is inited to NODATE and to compare to it. But how can I compare my non static objects to this static object?
has answer: http://stackoverflow.com/a/25718502
answer count: 3
has comment: http://stackoverflow.com/comment/40205135
upvote count: 1
tagged with: compare
has answer: http://stackoverflow.com/a/25718481
favorite count: 0
downvote count: 0
possible better answer: http://stackoverflow.com/a/25718481
accepted answer: http://stackoverflow.com/a/25718469
type: AnsweredQuestion
has title: In Java how should I compare an object to a const value?
score: 1
tagged with: java
tagged with: equality
has answer: http://stackoverflow.com/a/25718469

http://stackoverflow.com/a/25860717
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25860571
has body: You are doing it wrong class User { UserSubscription userSubscription ; @OneToOne public UserSubscription getUserSubscription(){ return userSubscription ; } public void setUserSubscription(UserSubscription userSubscription ){ this.userSubscription = userSubscription ; } } class UserSubscription { @OneToOne(mappedBy="userSubscription") public User getUser() { return user; } public void setUser(User user) { this.user = user; } }

http://stackoverflow.com/comment/40380410
comment on: http://stackoverflow.com/q/25813809
score: 0
type: Comment
type: QuestionComment
has text: Both data structures and algorithms are important in your case. Did you research about dynamic programming applied to matrices ?

http://stackoverflow.com/comment/40337748
has text: MyActivity:public static void sample() { try { layout.getBackground().setAlpha(30); } catch (Exception e) { e.printStackTrace(); }} NextViewGroup : if ( event.getY() >= 560 && CameraFlag == 0 ) { ProfileActivity.sample(); }
comment on: http://stackoverflow.com/q/25788046
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40323783
has text: Its not able to find a file that is referred by the libEONViewer.so
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25782768
type: Comment

http://stackoverflow.com/a/25899176
type: Answer
accepted answer of: http://stackoverflow.com/q/25797045
answers question: http://stackoverflow.com/q/25797045
has body: Turns out that there was a condition where I was generating the same file name due to a tuple parsing error. I was getting the AlreadyBeingCreatedException for that exact reason. Nothing wrong with the custom store function, or approaching the problem in this manner. Just a silly mistake on my part!
type: AcceptedAnswer
score: 0

http://stackoverflow.com/a/25768639
downvote count: 1
has body: I'd bet bytesRead = is.read(bytearray1,0,bytearray1.length); is where you're really getting stuck. The problem normally if you are stuck here is that the other side of the communication has not sent any data, there's nothing to read, and your thread is stuck waiting for it to send. on your client side, you call bos.close(); after sending the first message. This is going to cause the socket to close as well, which will throw an IOException on your server end, and because you are not catching the IOException, your server program will just exit. How much socket experience do you have? If you are just beginning with sockets, you might want to check out the extensions I wrote around this, starting with ServerSocketEx and DataFetcher.
type: Answer
has comment: http://stackoverflow.com/comment/40297858
has comment: http://stackoverflow.com/comment/40304488
upvote count: 0
has comment: http://stackoverflow.com/comment/40300204
has comment: http://stackoverflow.com/comment/40299855
has comment: http://stackoverflow.com/comment/40300655
has comment: http://stackoverflow.com/comment/40297566
answers question: http://stackoverflow.com/q/25768311
has comment: http://stackoverflow.com/comment/40300354
score: -1

http://stackoverflow.com/comment/40400323
score: 0
type: Comment
has text: Does your code even compiled?Do it this way `System.out.println("max value :"+Chapter8Number16.getMaxValue(numbers));`
type: QuestionComment
comment on: http://stackoverflow.com/q/25824765

http://stackoverflow.com/comment/40436823
comment on: http://stackoverflow.com/q/25844560
score: 0
type: Comment
type: QuestionComment
has text: Which errors do you get?

http://stackoverflow.com/a/25775525
type: Answer
score: 0
has body: What I was missing was adding a default constructor to TransactionRequest. Castor needs to be able to instantiate the classes you're mapping and needs a default constructor to do so. My final class looked like this: public class TransactionRequest extends ServiceRequest { private StatusObject status; public TransactionRequest () {} /* NEEDED DEFAULT CONSTRUCTOR */ public TransactionRequest (String destination) { setDestination(destination); } }
answers question: http://stackoverflow.com/q/25775524

http://stackoverflow.com/comment/40464230
type: AnswerComment
type: Comment
has text: So the code doesn't block at ses.scheduleAtFixedRate(... ?
comment on: http://stackoverflow.com/a/25859229
score: 0

http://stackoverflow.com/comment/40476994
comment on: http://stackoverflow.com/q/25866309
score: 0
type: Comment
type: QuestionComment
has text: How will i find the center of that circle?

http://stackoverflow.com/comment/40385989
has text: Thanks for your answere. What should I do in the onPreferenceChange methode? Because android studio want to have a return argument
type: Comment
comment on: http://stackoverflow.com/a/25816435
score: 0
type: AnswerComment

http://stackoverflow.com/q/25740067
tagged with: android-emulator
type: Question
answer count: 1
linked to: http://stackoverflow.com/q/22667030
has comment: http://stackoverflow.com/comment/40245885
score: 0
upvote count: 1
tagged with: android
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40245869
tagged with: android-studio
has body: Please guide me i am beginner in android. I don't know what going on i simply check the emulator in simple hello world program but emulator disconnected. no error in program and also not show in log cat.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/55454672
has title: Android studio emulator disconnected
has comment: http://stackoverflow.com/comment/40245845
tagged with: java

http://stackoverflow.com/q/25782112
has comment: http://stackoverflow.com/comment/40381947
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has title: Hibernate Proxy object serialization issue with spring
type: Question
has body: I was working on hibernate and came across an issue while serializing hibernate proxy object within an entity object. In some of the SO posts it is mentioned that using Hibernate.initialize(ProxyObject) will work , But if I have list of items then I have to iterate through all the objects and explicitly call the initialize() method on those objects. Is there any other way to overcome from this problem ? My Entities are as follows entity class looks as follows public class GroupMember extends Form { /** * */ private static final long serialVersionUID = -4728285634057416148L; private int grpmid; private User user; private Boolean grpownr; private Group grp; //Other Getter and setters @OneToOne(targetEntity = Group.class, fetch = FetchType.LAZY) @JoinColumn(name = "Group_GroupId", referencedColumnName = "GroupId") public Group getGrp() { return grp; } public void setGrp(Group grp) { this.grp = grp; } } The exception I am getting while returning from my service method - I am checking in rest console. Apache Tomcat/7.0.34 - Error report HTTP Status 500 - Could not write JSON: could not initialize proxy - no Session (through reference chain: com.service.responsepojo.GroupMemberResponse["grpmbr"]->com.service.pojo.GroupMember["user"]->com.service.pojo.User["dept"]->com.service.pojo.Department_$$_javassist_9["un"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: could not initialize proxy - no Session (through reference chain: com.service.responsepojo.GroupMemberResponse["grpmbr"]->com.service.pojo.GroupMember["user"]->com.service.pojo.User["dept"]->com.service.pojo.Department_$$_javassist_9["un"]) type Exception report message Could not write JSON: could not initialize proxy - no Session (through reference chain: com.service.responsepojo.GroupMemberResponse["grpmbr"]->com.service.pojo.GroupMember["user"]->com.service.pojo.User["dept"]->com.service.pojo.Department_$$_javassist_9["un"]); nested exception is com.fasterxml.jackson.databind.JsonMapping…
upvote count: 1
favorite count: 0
answer count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/comment/40367052
has text: Not sure if it's required but if you use a `TreeMap` instead of a 'HashMap', the keys / entries will be sorted by Integer value.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25800555
score: 0

classloader
tags question: http://stackoverflow.com/q/25750744
tags question: http://stackoverflow.com/q/25833023
tags question: http://stackoverflow.com/q/25842475
tags question: http://stackoverflow.com/q/25760989
tags question: http://stackoverflow.com/q/25729319
tags question: http://stackoverflow.com/q/25845911
tags question: http://stackoverflow.com/q/25751216
tags question: http://stackoverflow.com/q/25781343
tags question: http://stackoverflow.com/q/25852489
tags question: http://stackoverflow.com/q/25818119
tags question: http://stackoverflow.com/q/25745799
tags question: http://stackoverflow.com/q/25817592
type: Tag
tags question: http://stackoverflow.com/q/25744472
tag name: classloader
tags question: http://stackoverflow.com/q/25869884

http://stackoverflow.com/comment/40231769
comment on: http://stackoverflow.com/q/25732522
score: 0
type: Comment
has text: To remove the log4j binding, remove the `org.slf4j:log4j-over-slf4j:jar:1.7.6` dependency. The `org.slf4j:jcl-over-slf4j:jar:1.7.6` if for Jakarta Commons Logging; maybe you don't need that too.
type: QuestionComment

http://stackoverflow.com/comment/40440389
has text: You created frame again and again but actually you need just one instance. With your approach the reference to the panel was lost and your were wrying to acess the newly created one.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25845141

http://stackoverflow.com/comment/40418005
type: QuestionComment
has text: Store it in a variable or send it as an argument (not sure if that's possible with the listener though).
comment on: http://stackoverflow.com/q/25834489
score: 0
type: Comment

http://stackoverflow.com/comment/40451989
type: QuestionComment
has text: If you want to be able to run different main methods from time to time using the terminal: java -cp jarfile.jar package.classnamewithmainmethod
score: 0
comment on: http://stackoverflow.com/q/25853018
type: Comment

http://stackoverflow.com/a/25718379
score: 0
answers question: http://stackoverflow.com/q/25718340
has comment: http://stackoverflow.com/comment/40205424
type: AcceptedAnswer
type: Answer
has body: all_Items is defined as a hashmap to contain &lt;String, AllItem&gt; key value pairs as defined here: HashMap&lt;String, AllItem&gt; all_Items = new HashMap&lt;String, AllItem&gt;(); but you are trying to push &lt;String,String&gt; key value pair into your all_Items hashmap : all_Items.put(TAG_ITEM_NAME,item_name); // I got error here It seems you want to push the AllItem object against its item_name, which can be done as: all_Items.put(item_name, cn);
accepted answer of: http://stackoverflow.com/q/25718340

header
type: Tag
tags question: http://stackoverflow.com/q/25720520
tag name: header

http://stackoverflow.com/a/25752346
answers question: http://stackoverflow.com/q/25727629
score: 0
type: Answer
has body: I used a camel EIP Splitter in a route and tied the query in a transaction. More details can be found at http://camel.465427.n5.nabble.com/Camel-Mybatis-2-13-1-BATCH-of-10-000-records-tt5756211.html

http://stackoverflow.com/comment/40343189
type: AnswerComment
comment on: http://stackoverflow.com/a/25793347
type: Comment
has text: My point is that there's no need for an `else` in the conditionals because the code has no such logical case. (One can argue that it *might* someday and should be designed accordingly, though in that case polymorphism can cleanly replace this conditional. But that's not the question being asked.) Also, your last `if` statement is entirely superfluous. Once the loop is exited, `h <= 0` *must* be true *every time*. All you're testing with that conditional is whether or not the computer can do math. If it can't, the application won't be able to handle that anyway.
score: 1

trove4j
tags question: http://stackoverflow.com/q/25792456
tag name: trove4j
type: Tag

http://stackoverflow.com/comment/40355281
comment on: http://stackoverflow.com/a/25799125
has text: Only the `A1-A9` should be outside. `sumOfRand`, `sumOfCutoff`, and `sumOfRound` should decleared outside of the loop, but should be initialised to `0`
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25715916
duplicate of: http://stackoverflow.com/q/25597215
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/25716261
tagged with: java
has comment: http://stackoverflow.com/comment/40272934
score: -1
has body: I have been having some trouble: my previous question here explains it all. I was trying to write to a file in the external storage which on my device is /data/media or /sdcard. The file (when you adb pull it with device on) one saves two lines of text and then gets overwritten but once you adb pull it again in recovery with /data mounted, all the logs appear. I have tried mounting /data and then writing to the file but still no luck... Any help?
type: Question
upvote count: 0
has title: Writing to text file, file not updating
tagged with: bufferedreader
tagged with: android
has comment: http://stackoverflow.com/comment/40201387
answer count: 1
linked to: http://stackoverflow.com/q/25597215
favorite count: 0

http://stackoverflow.com/comment/40350963
type: QuestionComment
has text: `binary_place_holder` is a char, which is the reason why it's being compiled at all. Anyway, since `binary_place_holder` will (should) represent a 1 any time passing the condition, the multiplication can be omitted. If not, you will multiply `square_value`by 49 which is the decimal value of char '1'
type: Comment
comment on: http://stackoverflow.com/q/25796606
score: 0

http://stackoverflow.com/comment/40400949
score: 0
has text: Thank you. I updated my question with complete class. It is not clear for me that declaring the `@Bean(destroyMethod="shutdown")`.
type: Comment
comment on: http://stackoverflow.com/a/25823882
type: AnswerComment

http://stackoverflow.com/q/25743610
has answer: http://stackoverflow.com/a/25752470
tagged with: libgdx
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25752470
answer count: 1
downvote count: 0
favorite count: 0
has title: libGdx platform specific code
has body: I need to create specific code to access a Derby DB and the FoundationDB SQL parser from a libGdx based project, with a different implementation between the Desktop and the WebGL version of the application. The Desktop application can access the SQL parser and can connect to the DB locally, otherwhise the WebGL version uses the GWT RPC service to access data via a client-server mechanism. Is it possible to implement in a certain way this type of functionality? I would like also to discuss over a toy code implementation, if it's possible :) Here's the current (not working on the WebGL project) QueryManager code, stored in the main project folder: /** * */ package it.viscioletti.sqlapprentice.sql; import it.viscioletti.sqlapprentice.data.FieldDescription; import it.viscioletti.sqlapprentice.data.FieldType; import it.viscioletti.sqlapprentice.data.Row; import it.viscioletti.sqlapprentice.data.TableDescription; import it.viscioletti.sqlapprentice.gui.table.TableGui; import it.viscioletti.sqlapprentice.utils.Constants; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.sql.Types; import java.util.Vector; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Application.ApplicationType; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.foundationdb.sql.StandardException; import com.foundationdb.sql.parser.SQLParser; import com.foundationdb.sql.parser.StatementNode; /** * @author Federico * */ public class QueryManager { /* Member Variables: */ private float tablesAreaW, tablesAreaH, textAreaH; private Connection conn; private ResultSet rs; private Statement stmt; private String sql; private TableGui resultTable; /* Constructors: */ /** @throws SQLException */ public QueryManager(String sql) { // stores the SQL String this.sql = sql.trim(); // sets sizes used by the QueryManager…
has comment: http://stackoverflow.com/comment/40251857
type: AnsweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40251916
upvote count: 1
has comment: http://stackoverflow.com/comment/40252467
type: Question
tagged with: gwt

http://stackoverflow.com/comment/40446093
has text: or people that have an extension like -99.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25849909
score: 1

http://stackoverflow.com/q/25746204
answer count: 1
accepted answer: http://stackoverflow.com/a/25746486
tagged with: javascript
has comment: http://stackoverflow.com/comment/40257081
has comment: http://stackoverflow.com/comment/40256881
has comment: http://stackoverflow.com/comment/40257263
score: 0
has title: Copying a variable number of methods from one place to another in Java
has answer: http://stackoverflow.com/a/25746486
has comment: http://stackoverflow.com/comment/40257049
has comment: http://stackoverflow.com/comment/40256904
has body: I was wondering what would be the most efficient way of porting the following JavaScript code to Java? // Copies a variable number of methods from source to target. rebind = function(target, source) { var z = 1, c = arguments.length, func; while (++z &lt; c) { target[func = arguments[z]] = rebind(target, source, source[func]); } return target; }; // method is a getter-setter: // If passed with no arguments, gets the value. // If passed with arguments, sets the value and returns target. function rebind(target, source, func) { return function() { var value = func.apply(source, arguments); return value === source ? target : value; }; }
has comment: http://stackoverflow.com/comment/40257154
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40256775
has comment: http://stackoverflow.com/comment/40257035
tagged with: java
has comment: http://stackoverflow.com/comment/40257149
has comment: http://stackoverflow.com/comment/40256894

http://stackoverflow.com/q/25832317
tagged with: spring
tagged with: spring-mvc
has title: Spring Data Rest: Detected multiple association links with same relation type
has answer: http://stackoverflow.com/a/26390909
tagged with: java
has comment: http://stackoverflow.com/comment/40442112
tagged with: spring-data
upvote count: 7
has comment: http://stackoverflow.com/comment/40441934
type: Question
linked to: http://stackoverflow.com/q/24426644
has comment: http://stackoverflow.com/comment/40507885
has answer: http://stackoverflow.com/a/37350242
has comment: http://stackoverflow.com/comment/40438708
has comment: http://stackoverflow.com/comment/40442706
tagged with: spring-data-rest
answer count: 2
has comment: http://stackoverflow.com/comment/40507143
has comment: http://stackoverflow.com/comment/40507281
downvote count: 0
score: 7
favorite count: 0
type: UnansweredQuestion
has body: Regarding this question, I checked out Spring Data Rest Ambiguous Association Exception but couldn't get it to work for me. As you can see in my code below, I added @RestResource annotation with rel equal to some other value. Similar to the question above, POST requests work, but GET requests throw exception about multiple association links with the same relation type: "Could not write JSON: Detected multiple association links with same relation type! Disambiguate association @org.springframework.data.rest.core.annotation.RestResource(rel=createdBy, exported=true, path=, description=@org.springframework.data.rest.core.annotation.Description(value=)) @javax.persistence.ManyToOne(optional=true, targetEntity=void, cascade=[], fetch=EAGER) @javax.persistence.JoinColumn(referencedColumnName=ASSIGNABLE_ID, nullable=false, unique=false, name=CREATED_BY, updatable=true, columnDefinition=, foreignKey=@javax.persistence.ForeignKey(name=, value=CONSTRAINT, foreignKeyDefinition=), table=, insertable=true) private com.ag.persistence.domain.PersonEntity com.ag.persistence.domain.TeamEntity.createdBy using @RestResource! (through reference chain: org.springframework.hateoas.PagedResources[\"_embedded\"]->java.util.UnmodifiableMap[\"persons\"]->java.util.ArrayList[0]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Detected multiple association links with same relation type! Disambiguate association @org.springframework.data.rest.core.annotation.RestResource(rel=createdBy, exported=true, path=, description=@org.springframework.data.rest.core.annotation.Description(value=)) @javax.persistence.ManyToOne(optional=true, targetEntity=void, cascade=[], fetch=EAGER) @javax.persistence.JoinColumn(referencedColumnName=ASSIGNABLE_ID, nullable=false, unique=false, name=CREATED_BY, updatable=true, columnDefinition=, foreignKey=@javax.persistence.ForeignKey(name=, value=CONSTRAINT, foreignKeyDefinition=), table=, insertable=true) private com.ag.persistence.domain.Perso…

http://stackoverflow.com/comment/40227173
score: 0
type: Comment
type: QuestionComment
has text: Can you not factor out all the hardcoded calculations into numbers. Change this "8350 * 0.10 + (33950 - 8350) * 0.15 + (82250 - 33950) * 0.25 + (171550 - 82250) * 0.28 + (372950 - 171550) * 0.33" to whatever the result is. That will help readability a lot.
comment on: http://stackoverflow.com/q/25730312

http://stackoverflow.com/a/25742174
has comment: http://stackoverflow.com/comment/40249356
has comment: http://stackoverflow.com/comment/40249704
accepted answer of: http://stackoverflow.com/q/25742076
has comment: http://stackoverflow.com/comment/40250098
has comment: http://stackoverflow.com/comment/40250328
has comment: http://stackoverflow.com/comment/40249610
has comment: http://stackoverflow.com/comment/40249898
has comment: http://stackoverflow.com/comment/40249791
score: 0
type: AcceptedAnswer
has body: Change final boolean trouble; to boolean trouble = false; Your boolean value is final and thus cannot be modified, its default value is "false". That means that it is never changed from "false" no matter what happens next. By the way, if a number larger than 2 is input, the boolean value will also be "false". A check to see if the integer being input is in the right range (between 0 and 2) would be a good idea.
answers question: http://stackoverflow.com/q/25742076
type: Answer

http://stackoverflow.com/q/25765025
tagged with: http://stackoverflow.com/tag/html
has body: In my web page I required to fetch email and display content of the email. it's done success fully now only one issue is that when the content of the email is load in my page at that time the CSS of that mail is affect to my page and change the colors of link and so many thing. I have wrote following code &lt;div class="ticket-reply-content"&gt; &lt;!-- division to print the messages --&gt; ${replies.message_modify}&lt;!--this will load content dynamically --&gt; &lt;/div&gt; Please give me some solution or tag.
tagged with: css
has comment: http://stackoverflow.com/comment/40291608
score: 4
has answer: http://stackoverflow.com/a/25766752
has comment: http://stackoverflow.com/comment/40291684
has comment: http://stackoverflow.com/comment/40291094
tagged with: java
has comment: http://stackoverflow.com/comment/40291528
has comment: http://stackoverflow.com/comment/40291328
has answer: http://stackoverflow.com/a/25767856
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25765327
has comment: http://stackoverflow.com/comment/40291358
upvote count: 4
answer count: 4
downvote count: 0
tagged with: jquery
has comment: http://stackoverflow.com/comment/40291404
favorite count: 0
has comment: http://stackoverflow.com/comment/40291536
has title: How stop affecting the CSS of other content to our site?
has answer: http://stackoverflow.com/a/25767901
type: Question

http://stackoverflow.com/comment/40346664
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25795222
has text: Right... What if Spring had some sort of AbstractFactory that'd be called when using the uninstanciated service, then it'd check for a parameter meta-attribute and use it in the application configuration? Or have I gone completely insane? I think I need a break...

http://stackoverflow.com/q/25771670
type: Question
has body: I have this kind of response when having a Soap Fault calling a Java Web Service <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <soap:Fault> soap:Server Fault occurred while processing. <ns1:WaybillRegistrationFault xmlns:ns1="http://pod.waybillmanagement.ws.industrysystem.com.ar/"> 80000 El número de CTG 20140904 ya existe 1000 La carta de porte ya se encuentra registrada. </ns1:WaybillRegistrationFault> </soap:Fault> </soap:Body> </soap:Envelope> I did an Soap Handler with its handleFault method like this: public boolean handleFault(SOAPMessageContext context) { try { System.err.println("Handler handleFault"); if (context.getMessage().getSOAPBody().hasFault()) { SOAPFault fa = context.getMessage().getSOAPBody().getFault(); System.err.println(fa.getFaultString()); System.err.println("FaultCode: " + fa.getFaultCode() + " - Detail: " + fa.getDetail()); } return true; } catch (SOAPException ex) { System.err.println("SoapEx " + ex.getMessage()); return true; } } But in my output all I have is : Handler handleFault Fault occurred while processing. FaultCode: soap:Server - Detail: [detail: null] How do I process the errors node? Update: with fa.getDetail().getFirstChild().getTextContent() I get the text within the xml. How do I get that as an object. It be a WaybillRegistrationFault I think.
tagged with: java
score: 4
has title: Java - How to show Soap Fault
answer count: 2
accepted answer: http://stackoverflow.com/a/25776111
has answer: http://stackoverflow.com/a/48163602
favorite count: 0
has answer: http://stackoverflow.com/a/25776111
upvote count: 4
type: AnsweredQuestion
tagged with: netbeans
downvote count: 0
tagged with: soapfault
tagged with: jax-ws
tagged with: web-services
possible better answer: http://stackoverflow.com/a/48163602

http://stackoverflow.com/a/76837646
answers question: http://stackoverflow.com/q/25773721
has body: public static void main(String[] args){ String num="1122345.67823"; System.out.println(num.indexOf(".")); System.out.println(num.length()); //This is what u need// System.out.println("\n" +"Decimal digits: " + (num.length()-num.indexOf(".")-1)); System.out.println("\n" + "Integer Digits: " + (num.length() -(num.length()-num.indexOf(".")))); P.S if num is Integer instead of String just use the " String.valueOf(num)" to convert it.
type: Answer
score: 0

http://stackoverflow.com/q/25736801
has comment: http://stackoverflow.com/comment/40265058
has comment: http://stackoverflow.com/comment/40267484
favorite count: 0
has comment: http://stackoverflow.com/comment/40240907
has comment: http://stackoverflow.com/comment/40241159
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40265016
has answer: http://stackoverflow.com/a/25751869
upvote count: 1
has comment: http://stackoverflow.com/comment/40268080
has comment: http://stackoverflow.com/comment/40240996
has comment: http://stackoverflow.com/comment/40244471
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40240393
has comment: http://stackoverflow.com/comment/40240613
has body: In my Servlet, I would like to forward to another Servlet by way of calling a path defined in the web.xml. So for instance, in my web.xml, I have defined: User /user/* I would like to have my servlet map to request.getRequestDispatcher("/user/" + user.getUsername()).forward(request, response); However when I go to the Servlet that is supposed to launch this path, the page it returns is blank. Meaning, there is something wrong with the path. I know it is reaching this code because I put Sysout statements before it. Does anyone know why this isn't mapping properly? I tried every logical combination it seems ADDED This is the Servlet code that is supposed to handle this path String pathInfo = request.getPathInfo(); Pattern urlPattern = Pattern.compile("^/([^/]+)$"); Matcher matcher = urlPattern.matcher(pathInfo); if (matcher.matches()){ String userPath = matcher.group(1); my_proj.components.User user = UserManager.getUserByUsername(userPath); request.getSession().setAttribute("user", user); request.getRequestDispatcher("/resources/jsp/user_home.jsp").forward(request, response); }
has comment: http://stackoverflow.com/comment/40240155
has comment: http://stackoverflow.com/comment/40241104
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/40239998
has comment: http://stackoverflow.com/comment/40240348
has comment: http://stackoverflow.com/comment/40272496
has title: How to forward to a web.xml path from inside a servlet?
has comment: http://stackoverflow.com/comment/40264450
downvote count: 0
has comment: http://stackoverflow.com/comment/40240188
tagged with: url-mapping
has comment: http://stackoverflow.com/comment/40264326
answer count: 1

http://stackoverflow.com/a/53793800
score: 1
upvote count: 1
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25800533
has body: For anyone's interested, the pull request in George answer is no longer available in the master branch. The current proper way to this is by using instance API. Documentations are not available in the official docs, but the details and an example can be found in the news page below. http://sparkjava.com/news#spark-25-released

http://stackoverflow.com/comment/40476005
type: QuestionComment
has text: which activities are you talking about?
score: 0
comment on: http://stackoverflow.com/q/25866361
type: Comment

http://stackoverflow.com/a/25774820
score: 1
answers question: http://stackoverflow.com/q/25774785
upvote count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40309611
has body: There should not be a major difference in speed. However, the switch is far more readable and maintainable. Easy to read and understand Adding a new option would be very easier in the switch The switch option is easier to debug. See also Is the ternary operator faster than an “if” condition
type: Answer

http://stackoverflow.com/a/25721966
type: Answer
has body: Instead of formatting the Time with : you can try Calander: DateFormat df = new SimpleDateFormat("HH:mm:ss.SSSZ"); String date = df.format(Calendar.getInstance().getTime()); Whereas you can have DateFormat patterns such as: "HH:mm:ss.SSSZ"------- 12:08:56.235-0700 "yyyy.MM.dd G 'at' HH:mm:ss z" ---- 2001.07.04 AD at 12:08:56 PDT "hh 'o''clock' a, zzzz" ----------- 12 o'clock PM, Pacific Daylight Time "EEE, d MMM yyyy HH:mm:ss Z"------- Wed, 4 Jul 2001 12:08:56 -0700 "yyyy-MM-dd'T'HH:mm:ss.SSSZ"------- 2001-07-04T12:08:56.235-0700 "yyMMddHHmmssZ"-------------------- 010704120856-0700 "K:mm a, z" ----------------------- 0:08 PM, PDT "h:mm a" -------------------------- 12:08 PM "EEE, MMM d, ''yy" ---------------- Wed, Jul 4, '01
has comment: http://stackoverflow.com/comment/40212179
has comment: http://stackoverflow.com/comment/40212331
answers question: http://stackoverflow.com/q/25721865
score: 0

http://stackoverflow.com/comment/40381401
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25796449
has text: Can you show some code? What have you tried? To be honest, I am not sure what you are actually asking?
type: QuestionComment

http://stackoverflow.com/a/25850382
has body: ConcurrentLinkedQueue is wait-free (i.e. lock-free and threads won't starve) and doesn't perform any copying If you want to maintain a set instead of a list, then you can have multiple threads add objects to the ConcurrentLinkedQueue and have a single thread poll the queue and add the objects to an unsynchronized HashMap; this may be more efficient than using a ConcurrentHashMap. However this assumes that you can withstand a slight delay between an object being added and the object showing up in the set.
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/25832079
type: Answer
answers question: http://stackoverflow.com/q/25832079

http://stackoverflow.com/q/25789490
score: 1
tagged with: java
upvote count: 1
has title: CXF statistics tracking on the client side?
type: Question
downvote count: 0
has body: CXF on the server side offers CounterRepository with all kind of metrics for soap webservices. If I create a client with cxf, is there any similar metrics tracking? CounterRepository cannot be used here, as it must be registered with the cxf SpringBus, which is not used on plain webservice clients...
favorite count: 0
type: UnansweredQuestion
tagged with: soap
tagged with: spring
answer count: 0
tagged with: cxf

http://stackoverflow.com/a/25867462
has body: To add JVM parameters to zookeeper, create file named java.env under conf folder in each of zookeeper with below content. export JVMFLAGS="-Xms512m -Xmx512m"
accepted answer of: http://stackoverflow.com/q/25854617
score: 4
upvote count: 4
answers question: http://stackoverflow.com/q/25854617
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/a/25743055
upvote count: 5
has comment: http://stackoverflow.com/comment/40286486
type: Answer
downvote count: 0
score: 5
has body: PID 0 is the System Idle Process, which is surely not listening to port 80. How did you check which process was using the port? You can use netstat /nao | findstr "80" to find the PID and check what process it is.
answers question: http://stackoverflow.com/q/25742913

http://stackoverflow.com/q/25749851
has title: How to do Inner class object instantiaton with `new` Coffescript?
tagged with: syntax
answer count: 0
tagged with: java
tagged with: coffeescript
upvote count: 1
type: Question
has body: In Java, you could do something like this: public class World{ String name; World(String name){this.name = name;} public class WorldObject{ String type; WorldObject(String type){this.type = type;} String display(){ return type + " on " + name;} } //… public static void main(String[] args){ World w1 = new World("Jo"), w2 = new World("Kallisto"); WorldObject sand = w1.new WorldObject("sand"), rock = w2.new WorldObject("rock"); System.out.println(sand.display()); System.out.println(rock.display()); } } I wanted to emulate the same, or a similar, invocation syntax in coffeescript and ran into some anaesthetic formulations and am asking for some simpler solutions. First of, I'm pretty sure Javascript doesn't allow for the nice inference of name as Java does in this case, but please correct me if I'm wrong. Thus I figured I'd have to go with something like outer.name, but that's only of little concern. Note that this program prints sand on Jo rock on Kallisto as should the resulting coffee scripts. The simplest solution would be to go with a factory method.But I don't like factory methods, because the new keyword is always a very strong indicator that you create a new object. You could do that, but if you do, the instantiation of a WorldObject does look different. class World constructor: (@name) -&gt; worldObjectFactory: (bar) -&gt; new @WorldObject(bar,@) WorldObject: class @WorldObject constructor: (@bar, @outer) -&gt; display: ()-&gt; "#{@bar} in #{@outer.name}" w1 = new World "Jo" w2 = new World "Kallisto" sand = w1.worldObjectFactory "sand" rock = w2.worldObjectFactory "rock" console.log obj.display() for obj in [sand, rock] Another variation would be, to "sneak in" the outer object via defineProperty, but it looks ugly and messes with the things an user might expect. Furthermore, the syntax still isn't what I want (but the closest): class World constructor: (@name) -&gt; WorldObjectFactory = (outer) -&gt; class @WorldObject constructor: (@bar) -&gt; @outer = outer …
has comment: http://stackoverflow.com/comment/40405324
tagged with: javascript
has comment: http://stackoverflow.com/comment/40286576
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/25746173
type: UnansweredQuestion
has title: How to combine the KeyUpHandler and the ValueChangeHandler in GWT?
upvote count: 1
tagged with: gwt
has answer: http://stackoverflow.com/a/25778698
score: 1
tagged with: java
type: Question
answer count: 2
downvote count: 0
tagged with: event-handling
tagged with: handlers
favorite count: 0
has body: I found that the KeyUpHandler seems to be the most dynamic Handler for a TextBox if I want instant update after entering something. However considering that the values might change without somebody pressing a key gives the need to use a ValueChangeHandler, which unfortunately when used alone isn't as dynamic and isn't triggered everytime you change the contents of the TextBox with the keyboard. Right now I have a method like this to add both handlers to the TextBox, but I guess it's not the best way to add multiple handlers like that and probably not very performant either: private void addInputValueChangeHandlers(TextBox inputTextBox) { inputTextBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { updateResult(); } }); inputTextBox.addValueChangeHandler(new ValueChangeHandler&lt;String&gt;() { @Override public void onValueChange(ValueChangeEvent&lt;String&gt; event) { updateResult(); } }); } So is there a way to combine them or a handler that would give the same effect as this one?
has answer: http://stackoverflow.com/a/25817511

http://stackoverflow.com/comment/40345158
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25794589
has text: "they should return as their initial variable name" can you explain that?
score: 1

http://stackoverflow.com/q/25791787
has answer: http://stackoverflow.com/a/25792107
tagged with: serialization
accepted answer: http://stackoverflow.com/a/25792107
upvote count: 5
tagged with: android
has body: I get the following error when trying to pass a HashMap to my MainActivity class (TabooCards implements Serializable). I read around here that HashMap is serializable, and that any Objects contained in the HashMap must also be serializable. I assume Integer is serializable, and I know TabooCards is serializable, so what's going wrong? Code: AsyncTask onPostExecute: protected void onPostExecute(HashMap&lt;Integer, TabooCard&gt; result) { super.onPostExecute(result); Intent i = new Intent(getBaseContext(), MainActivity.class); i.putExtra("TABOO_CARDS", tabooCards); startActivity(i); } TabooCards: public class TabooCard implements Serializable{ /** * */ private static final long serialVersionUID = -6996042490365349623L; String mainWord, taboo1, taboo2, taboo3, taboo4, taboo5; public TabooCard() { this("Main Card", "Taboo 1", "Taboo 2", "Taboo 3", "Taboo 4", "Taboo 5"); } public TabooCard(String mainword, String taboo1, String taboo2, String taboo3, String taboo4, String taboo5) { setMainWord(mainword); setTaboo1(taboo1); setTaboo2(taboo2); setTaboo3(taboo3); setTaboo4(taboo4); setTaboo5(taboo5); } //Various getter/setter methods Logcat E/AndroidRuntime(28441): FATAL EXCEPTION: main E/AndroidRuntime(28441): Process: com.jaytj.taboo, PID: 28441 E/AndroidRuntime(28441): java.lang.RuntimeException: Parcel: unable to marshal value com.jaytj.taboo.TabooCard@42d2fce8 E/AndroidRuntime(28441): at android.os.Parcel.writeValue(Parcel.java:1266) E/AndroidRuntime(28441): at android.os.Parcel.writeMapInternal(Parcel.java:594) E/AndroidRuntime(28441): at android.os.Parcel.writeMap(Parcel.java:578) E/AndroidRuntime(28441): at android.os.Parcel.writeValue(Parcel.java:1197) E/AndroidRuntime(28441): at android.os.Parcel.writeArrayMapInternal(Parcel.java:618) E/AndroidRuntime(28441): at android.os.Bundle.writeToParcel(Bundle.java:1692) E/AndroidRuntime(28441): at android.os.Parcel.writeBundle(Parcel.java:636) E/AndroidRuntime(28441): at android.content.Intent.writeToParcel(Intent.java:741…
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
score: 5
tagged with: hashmap
has title: Unable to Marshal value on Serializable Data
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25858975
has comment: http://stackoverflow.com/comment/40463118
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40463112
tagged with: modulus
downvote count: 0
score: 1
tagged with: java
has title: Divide 2 numbers and see if the first one divides the second number evenly
type: Question
answer count: 2
tagged with: divide
has answer: http://stackoverflow.com/a/25859003
upvote count: 1
has body: I need to create a program that reads 2 integers from the keyboard and prints a message saying whether the first number divides the second evenly. I know I have to use either / or %, but it's not working. int y, x,z; System.out.print("Enter first number: "); x= keyboard.nextInt(); System.out.print("Enter second number: "); y= keyboard.nextInt(); z=y/x; if (z%2==0){ System.out.println("Divides evenly"); } else { System.out.println("Does not divide evenly"); } I have to divide y by x. So, for example, x= 25 y=100, it should come out even. Then x=35 y=100 not even. I've tried z==0 z%y==0 Not working.
has answer: http://stackoverflow.com/a/25858985
favorite count: 0

http://stackoverflow.com/q/25802249
has title: String literals and String which is acted upon intern() method will go in SCP area. Rest all in heap
tagged with: arrays
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40359510
favorite count: 0
has answer: http://stackoverflow.com/a/25802390
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/25802386
tagged with: java
downvote count: 1
type: Question
has body: String literals and String which is acted upon intern() method will go in SCP area. Rest all in heap. If that is the case if i create String s = new String("apple"); Obviously it will create one object in heap, my doubt is it will create "apple" in SCP(String Constant Pool) also. (Lets assume "apple" is not there in SCP). What about String[] arrays? Can you please elaborate in detail..

http://stackoverflow.com/comment/40414205
score: 1
has text: Becaus you define it inside the for loop, it's not visible outside the loop
comment on: http://stackoverflow.com/q/25832407
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25851889
has answer: http://stackoverflow.com/a/25869716
has comment: http://stackoverflow.com/comment/40451337
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40450369
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25869716
tagged with: hibernate-validator
type: Question
has answer: http://stackoverflow.com/a/25853093
has title: Disable Hibernate validation for Merge/Update
upvote count: 2
possible better answer: http://stackoverflow.com/a/25853093
answer count: 2
has body: I have a POJO called Order as follows: public class Order { @Id @GeneratedValue @Column(name="id") protected int id; @NotNull @Future protected Date desiredProcessingDate; protected Date actualProcessingDate; } As you can see, desiredProcessingDate must be specified and it must be in the future. A user will submit a new order through a form and specify a desiredProcessingDate, which is being validated as expected. The order is then persisted to the database via sessionFactory.getCurrentSession().persist(order); At a later date a scheduled service will retrieve the order from the database, process it and stamp the actualProcessingDate with the current timestamp. However, when this service calls sessionFactory.getCurrentSession().merge(order); the validation kicks in again and fails because desiredProcessingDate is now in the past. It seems like what I need to do is to tell the merge(order) operation not to validate, but am unsure how to do this. If this is not possible then it seems like to only way around it is to write a class-level custom validator which only checks that desiredProcessingDate is in the future if actualProcessingDate == null, which seems overly complex for what seems like a simple requirement. Any pointers would be appreciated.
has comment: http://stackoverflow.com/comment/40492148

http://stackoverflow.com/q/25736036
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25753645
possible better answer: http://stackoverflow.com/a/25745875
has title: Hibernate + JPA + jTDS + SQL Server = Unicode Problems
score: 0
tagged with: sql
has answer: http://stackoverflow.com/a/25745875
tagged with: unicode
linked to: http://stackoverflow.com/q/12512687
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24054648
accepted answer: http://stackoverflow.com/a/25753645
tagged with: java
tagged with: hibernate
has body: I maintain a piece of software that runs as a Servlet and can make use of MySQL, Oracle or SQL Server as the DB backend - depending on what the Customer wants to use. Everything works perfectly with MySQL and Oracle, and SQL Server works great too, except I cannot insert/update Unicode sequences into the database. I can do a manual insert in SQL Server Management Studio of a unicode sequence like this INSERT INTO mytable (msg) VALUES (N'Modern Standard Hindi (मानक हिन्दी), is a standardised and Sanskritised register of the Hindustani language.') This data is output in my software correctly, so this verifies that the database and the web front end can both handle unicode no problem. And here's my connection string jdbc:jtds:sqlserver://&lt;server ip&gt;:1433/MyDb As I said, Oracle and MySQL work perfectly using this setup. What's different about SQL Server? Note: I also tried the official Microsoft-provided JDBC driver with exactly the same results. If it makes a difference, I'm using JPA Repositories to do my DB interactions. The whole webapp is also set up as a SpringMVC application. Edit: I also tried adding useUnicode=true;characterEncoding=UTF-8 to the end of my connection string with the same results

http://stackoverflow.com/a/50748456
downvote count: 0
has body: Add following property to your pom.xml: &lt;properties&gt; &lt;m2eclipse.wtp.contextRoot&gt;my-context&lt;/m2eclipse.wtp.contextRoot&gt; &lt;/properties&gt;
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25792333

http://stackoverflow.com/q/25718246
tagged with: netty
has body: I have an application that both acts as a UDP server and as a TCP client. Therefore, I create two Bootstraps to set up Netty. Is it a good idea to share the same EventLoopGroup between the two Bootstraps? It would mean that the same thread pool will be used to: Receive/reply to UDP datagrams Receiving TCP data (Sending TCP data will be done by my application's threads.) Thanks, Mickael
score: 0
tagged with: java
answer count: 1
accepted answer: http://stackoverflow.com/a/25722608
has title: Sharing EventLoopGroup between client and server bootstraps
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/25722608

http://stackoverflow.com/q/25866302
linked to: http://stackoverflow.com/q/3715920
has body: I am using BCRYPT to hash our user's passwords on the database and since the connection from the client might not always be secure, I want to refrain from sending it to the server plain-text upon authentication. We are using Java / Spring's BCRYPT implementation. Is there a way to compare two hashes for the same origin? If no (which probably is the case): what is the best workaround to achieve a similar security level. Thanks for your suggestions.
answer count: 2
has comment: http://stackoverflow.com/comment/40487413
has answer: http://stackoverflow.com/a/25903996
downvote count: 0
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: bcrypt
has comment: http://stackoverflow.com/comment/40490181
score: 2
has comment: http://stackoverflow.com/comment/40476088
has comment: http://stackoverflow.com/comment/40476159
tagged with: java
has title: Compare two BCRYPTed passwords for same origin
has answer: http://stackoverflow.com/a/25874333
type: Question

http://stackoverflow.com/a/25829018
has comment: http://stackoverflow.com/comment/40408160
downvote count: 0
answers question: http://stackoverflow.com/q/25829005
has comment: http://stackoverflow.com/comment/40408148
has body: From your code, it seems that you intentionally want to skip printing pfirst. If so, try this: public void display() { Link pcurrent = pfirst.next; while(pcurrent!= null) { System.out.println(pcurrent); pcurrent = pcurrent.next; } } Here, I've changed how pcurrent is initialized before the loop, changed the loop condition, and changed the order of events inside the loop body. This should perhaps be better done as a for loop: for (Link pcurrent = pfirst.next; pcurrent != null; pcurrent = pcurrent.next) { System.out.println(pcurrent); } If you also want to print pfirst (which sounds like what you actually want to do), then just keep the initialization of pcurrent as you currently have it and still make the other changes.
has comment: http://stackoverflow.com/comment/40408159
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/40266009
comment on: http://stackoverflow.com/a/25751072
type: Comment
has text: You have demonstrated that `t0` and `t1` must be `double`, see `double elapseTime()` not `long` and if it was `long` multiplying by 1000 wouldn't make any difference. As it is `double` doing `1000 * ` would still be a double.
type: AnswerComment
score: 2

http://stackoverflow.com/q/25741025
has answer: http://stackoverflow.com/a/25744359
tagged with: ocr
favorite count: 0
has title: Java - One Character recognition through image
upvote count: 2
type: UnansweredQuestion
tagged with: text-recognition
type: Question
tagged with: java
has body: I am trying to use Ocr frameworks to recognize these type of images: These are 2 letters G. I tried using the aocr.jar from asprise, but this code does not seem to do the trick.. import com.asprise.ocr.Ocr; import java.io.File; public class textRecognizer { public static void main(String args[]){ Ocr.setUp(); Ocr ocr = new Ocr(); ocr.startEngine("eng", Ocr.SPEED_FAST); String s = ocr.recognize(new File[] {new File("C:\\Users\\juchtdi\\Pictures\\letter.png")}, Ocr.RECOGNIZE_TYPE_ALL, Ocr.OUTPUT_FORMAT_PLAINTEXT, 0, null); System.out.println(s.length()); System.out.println(s); ocr.stopEngine(); } } Anyone got an Idea how I can make this work? Eventually with other frameworks? thanks :) Edit: The compiling went without any runtime exceptions. s.length() returned 0. So it seems he reads nothing at all. When i replace the image with an image of real text, it outputs text perfectly. I expected/hoped for it to return 1 G
has comment: http://stackoverflow.com/comment/40247612
score: 2
tagged with: image-recognition
answer count: 1
has comment: http://stackoverflow.com/comment/40247785
has comment: http://stackoverflow.com/comment/40247389
downvote count: 0

http://stackoverflow.com/q/25800533
type: Question
upvote count: 4
answer count: 2
downvote count: 0
tagged with: jetty-9
score: 4
tagged with: spark-java
has answer: http://stackoverflow.com/a/33282632
has answer: http://stackoverflow.com/a/53793800
favorite count: 0
type: UnansweredQuestion
has title: Method to have both HTTPS and HTTP with embedded Spark server?
has body: I have small embedded server supporting HTTPS using Spark. I also want to support/catch some HTTP calls; e.g. like a help page and some redirections. For example a help page: http://localhost:8088/help .... renders .... http::8088//localhost/help.html or a login page: http://localhost::8088/login ... renders .... https::8089//localhost/login.html I have progressed to the stage where I have an embedded server that responds to either HTTP xor HTTPS -- One or the other, not both together. Is it possible to respond to both protocols with the same embedded Jetty (via Spark) server? If not, is it feasible to run two Jetty servers in the same embedded application? Can I run two Spark servers in the same application? (I'm taking it as 'read' that if Jetty won't do it asking Spark for that service will be a dead-end). My preferred answer would be if I can use my Spark server to listen and handle both protocols. My investigation so far suggest that only one mode is possible, largely because Spark is actually a static library you can only set-one port; and you may only have one 'Spark' server. Has anyone used the same port for both HTTP and HTTPS? (That just doesn't seem 'good' to me). I did find Unit Test code that looked like it was using both protocols, TestSparkUtil here: https://github.com/perwendel/spark/src/test/java/spark/util/SparkTestUtil.java However that's testing the server and uses lots of deprecated API-s. One final thought is, can I use a second (embedded) Jetty-only servlet to redirect HTTP calls to HTTPS? Would you recommend that? I'm sure there's an elegant solution here. Thanks in advance for your time to consider the questions framed herewithin.
tagged with: java
tagged with: http
tagged with: https

http://stackoverflow.com/a/60095664
downvote count: 0
has body: Yes, you can use both constructor in Lombok. @NoArgsConstructor @AllArgsConstructor @AllArgsConstructor generates a constructor requiring an argument for every field in the annotated class. So we have the Employee class with two fields: @AllArgsConstructor public class Employee { private String name; private int salary; } When we de-lombok the class, it becomes: public class Employee { private String name; private int salary; public Employee(String name, int salary) { this.name = name; this.salary = salary; } } @NoArgsConstructor generates a default constructor with no parameters. We have the following Employee class: @NoArgsConstructor public class Employee { private String name; private int salary; } When we look at the generated code, we see that Lombok adds a no-args constructor: public class Employee { private String name; private int salary; public Employee() { } } More examples
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25809156

http://stackoverflow.com/a/25734927
has comment: http://stackoverflow.com/comment/40236301
score: 1
answers question: http://stackoverflow.com/q/25734921
upvote count: 1
has comment: http://stackoverflow.com/comment/40236329
has comment: http://stackoverflow.com/comment/40236310
type: Answer
has comment: http://stackoverflow.com/comment/40236321
has comment: http://stackoverflow.com/comment/40236307
has comment: http://stackoverflow.com/comment/40236339
downvote count: 0
has body: Primitive types such as boolean can't be set to null. Set the boolean to true or false.

http://stackoverflow.com/comment/40270736
type: QuestionComment
comment on: http://stackoverflow.com/q/25753404
type: Comment
score: 1
has text: ok...but this seems to be more an **convention**, than an real **constant**.

http://stackoverflow.com/a/25729427
has comment: http://stackoverflow.com/comment/92471574
has body: You can't use value placeholders ("?") for things that aren't values (like your field-names). If you really want to do this, just build up the query, mapping the field-names in. Then apply the values with placeholders. BUT do make sure you check the field-names are as you would expect and escape/quote them properly. Oh - Not a java programmer, but do check that keySet() and values() return their results in the same order too. Edit: The "?" marks are value placeholders. They are used in database connection libraries of all sorts. They will be mapped to whatever parameterised query syntax the database can use. However, they only work for values - so the database can parse the query with the placeholders.
upvote count: 1
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25727924
answers question: http://stackoverflow.com/q/25727924
score: 0
has comment: http://stackoverflow.com/comment/40227456
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40327175
type: QuestionComment
has text: arey they showing any lint warnings?
score: 1
comment on: http://stackoverflow.com/q/25784891
type: Comment

http://stackoverflow.com/q/25786475
score: 1
tagged with: java
downvote count: 1
type: Question
accepted answer: http://stackoverflow.com/a/25787524
has comment: http://stackoverflow.com/comment/40329894
tagged with: data-structures
tagged with: servlets
answer count: 1
tagged with: jsp
has title: Storing string values with four levels of hierarchy
favorite count: 0
has body: The following image shows how my data needs to be stored and linked to each other: The values v1,v2 and so on are all unique. Av1...n and n1....n couple should be the same for different v1...n. Once stored, I need to retrieve it in the following format: V1,Av1,n1 V1,Av1.n2 . . . . v4,Av1,n1 How do you suggest I do this?
has answer: http://stackoverflow.com/a/25787524
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/q/25730340
answer count: 2
accepted answer: http://stackoverflow.com/a/25732044
has comment: http://stackoverflow.com/comment/40230340
has title: Why does one background thread have the same thread id as the main service thread?
has comment: http://stackoverflow.com/comment/40227473
has body: Trying to create 2 background threads and sending a message from thread0 to thread1 where it is handled by MessageHandler using the android Looper and message queue associated with thread1. I expected to see separate thread ids for threads 0,1 and the main thread. However, I was surprised to see something unexpected. 09-08 14:23:21.089: D/MQ(4514): Hi, the system is up! Today is: Sep 8, 2014 2:23:21 PM 09-08 14:23:21.099: V/MQ(4514): onStartCommand(). I am INSIDE THE main sERVICE Thread id = 1 09-08 14:23:21.099: V/MQ(4514): BackgroundThread0. Thread id = 280 sent message 0 09-08 14:23:21.099: V/MQ(4514): MessageHandler on thread Thread id = 1 received message 0 Why does BackgroundThread1 have the same thread id as the main service thread id = 1? I install it from Eclipse using Run As, and am starting it in a windows console window: D:\&gt;adb shell am startservice --user 0 -a android.intent.action.MAIN -n "com.sandbox.mq/.MainService" Starting service: Intent { act=android.intent.action.MAIN cmp=com.sandbox.mq/.MainService } -- package com.sandbox.mq; public class StartMainService extends Application { final static String TAG = "MQ"; public void onCreate() { super.onCreate(); Context context = getApplicationContext(); Log.d(TAG, "Hi, the system is up! Today is: " + DateFormat.getDateTimeInstance().format(new Date())); } } -- public class MainService extends Service { final static String TAG = "MQ"; BackgroundThread0 bthread0; BackgroundThread1 bthread1; public class MqBinder extends Binder { public MqBinder(Context ctxt) { Log.v(TAG, "MqBinder() " + "Thread id = " + Thread.currentThread().getId()); } } @Override public IBinder onBind(Intent arg0) { return new MqBinder(this); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.v(TAG, "onStartCommand(). I am INSIDE THE main sERVICE " + "Thread id = " + Thread.currentThread().getId()); bthread1 = new BackgroundThread1(); if (!bthread1.isAlive()) { bthread1.start(); } else { Log.v(TAG, "o…
tagged with: android
has comment: http://stackoverflow.com/comment/40230595
score: 0
tagged with: multithreading
has answer: http://stackoverflow.com/a/25732044
has comment: http://stackoverflow.com/comment/40229867
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25731079
has answer: http://stackoverflow.com/a/25731079
type: Question
tagged with: android-service

http://stackoverflow.com/comment/40466421
comment on: http://stackoverflow.com/a/25860903
score: 0
type: AnswerComment
type: Comment
has text: This is more of a comment than an answer.

http://stackoverflow.com/comment/40350970
has text: You might also be missing to use VAOs. See content added to the answer. It's really hard to tell what might be missing/wrong without seeing the relevant code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25780255
type: AnswerComment

http://stackoverflow.com/a/25830326
score: 12
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/129293220
has comment: http://stackoverflow.com/comment/40429436
has comment: http://stackoverflow.com/comment/40450657
upvote count: 12
has body: The error indicated that the Activity named android.speech.tts.engine.CHECK_TTS_DATA has not been exported as part of the ROM (Note: LG ROMs have been known to be problematic.) To prevent this error just do this: try { Intent intent = new Intent(TextToSpeech.Engine.ACTION_CHECK_TTS_DATA); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } catch (ActivityNotFoundException e) { Log.e("Oops! The function is not available in your device." + e.fillInStackTrace()); } Another method you can use is check first whether a package is callable, like: public static boolean isActivityCallable(Context context, String packageName, String className) { final Intent intent = new Intent(); intent.setClassName(packageName, className); List&lt;ResolveInfo&gt; list = getPackageManager(context).queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY); return list.size() &gt; 0; } Where packageName is TextToSpeech.Engine and className is TextToSpeech.Engine.ACTION_CHECK_TTS_DATA
answers question: http://stackoverflow.com/q/25830230

http://stackoverflow.com/q/25727629
upvote count: 1
type: Question
tagged with: apache-camel
has body: I'm running into an issue where I'm trying to insert BATCH of roughly 10,000 records into an Oracle 11g table of 13 columns. Actually this is blocked if I try more than 1000 records. Also, fine grained tests for a BATCH insert of 500 records is too slow as well. The BATCH is generating huge trace files on the database sever due to ORA-4031 errors. The SQL statement running in each session is over 80,000 lines long, taking as input over 42,000 bind variables. Driver: oracle.jdbc.driver.OracleDriver I'm trying to satisfy the requirement: If any data for an insert is invalid, I got to rollback. My question is: Is there a way to tell MyBatis to divide the incoming bulky batch into small batches say 10 records each, insert them but rollback all the batches if one of the batch fails and commit only when all the batches are sucessfully inserted? Or is there an alternative approach to this? Below is the xml mapping for the insert: &lt;insert id="insertToTable" parameterType="java.util.List"&gt; INSERT ALL &lt;foreach item="line" collection="list" &gt; &lt;foreach item="lineItem" collection="line.entrySet()" open="" close="" separator=""&gt; into TABLE_TEST_T (col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11, col12, col13) values( &lt;!-- #{lineItem.item1, jdbcType=DATE}, --&gt; #{lineItem.item1, jdbcType=VARCHAR}, #{lineItem.item2, jdbcType=VARCHAR}, #{lineItem.item3, jdbcType=VARCHAR}, #{lineItem.item4, jdbcType=NUMERIC}, #{lineItem.item5, jdbcType=NUMERIC}, #{lineItem.item6, jdbcType=NUMERIC}, #{lineItem.item7, jdbcType=NUMERIC}, #{lineItem.item8, jdbcType=NUMERIC}, #{lineItem.item9, jdbcType=NUMERIC}, #{lineItem.item10, jdbcType=NUMERIC}, #{lineItem.item11, jdbcType=NUMERIC}, #{lineItem.item12, jdbcType=NUMERIC}, #{lineItem.item13, jdbcType=NUMERIC} ) &lt;/foreach&gt; &lt;/foreach&gt; SELECT * FROM dual &lt;/insert&gt; Appreciate your feedback.
answer count: 2
downvote count: 0
tagged with: mybatis
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
has answer: http://stackoverflow.com/a/25727719
has answer: http://stackoverflow.com/a/25752346
has title: MyBatis 3.2.7 bulky BATCH insert is blocked
score: 1
tagged with: java

http://stackoverflow.com/comment/40218214
has text: Thanks, I'll have a go and see how I get on with this approach.
comment on: http://stackoverflow.com/a/25725179
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40265614
type: AnswerComment
comment on: http://stackoverflow.com/a/25750609
score: 0
type: Comment
has text: @K3NN3TH Again, you have views of only one type, therefore `getViewTypeCount()` should return 1 no matter how many views you have.

http://stackoverflow.com/a/25824478
has comment: http://stackoverflow.com/comment/40402757
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40400513
accepted answer of: http://stackoverflow.com/q/25824411
type: Answer
answers question: http://stackoverflow.com/q/25824411
has comment: http://stackoverflow.com/comment/40402807
has comment: http://stackoverflow.com/comment/40400700
has comment: http://stackoverflow.com/comment/40401627
upvote count: 1
has comment: http://stackoverflow.com/comment/40400362
has comment: http://stackoverflow.com/comment/40401758
score: 1
has body: Your considering way too many condition to achieve a simple task that makes your code look too messed up, why not print it old school manner : for (int i = 0; i &lt; row; i++) { for (int j = 0; j &lt; column; j++) { if ((i == j) || (i+j+1) == row ) System.out.print(my2dArray1[i][j]);//print content if diagonal else System.out.print('\t');//else print only tab space } System.out.println(); } or to simply put : for (int i = 0; i &lt; row; i++) { for (int j = 0; j &lt; column; j++) System.out.print(((i == j) || (i+j+1) == row ) ? my2dArray1[i][j] : '\t'); System.out.println(); } Logic : Left diagonal : i=j right diagonal : sum of (row index + column index) = total row count output screen 505 225 418 283 813 965 802 747 969 309 871 265 680 609 690 930 504 747 117 862 860 700 901 720 695 394 180 524 293 528 934 154 303 401 795 923 ------------------------ 505 965 747 871 690 930 860 700 394 293 934 923
has comment: http://stackoverflow.com/comment/40400197
has comment: http://stackoverflow.com/comment/40400135

http://stackoverflow.com/a/25852424
score: 1
has body: As suggested here, the usual implementation of tooltips requires support for chart entities, which is not available in DialPlot. Because DialPlot handles its own rendering, you might consider whether a DialLayer could meet your requirement. DialTextAnnotation or DialValueIndicator, illustrated here, may be suitable You could also implement your own DialLayer.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40452677
upvote count: 1
answers question: http://stackoverflow.com/q/25846488
type: Answer
accepted answer of: http://stackoverflow.com/q/25846488

http://stackoverflow.com/comment/40481610
has text: i need to browse the xl file in my local system and than i need to upload the xl file content in my database. i already did upload the xl file into db with static path. i need to upload file from dynamic path
type: Comment
comment on: http://stackoverflow.com/a/25867313
type: AnswerComment
score: 0

http://stackoverflow.com/a/25767811
type: Answer
has comment: http://stackoverflow.com/comment/40335063
score: 1
answers question: http://stackoverflow.com/q/25767533
has body: You can do this calling ApplicationContext.getBeansOfType(BaseCarService.class) when your context has been initialized (for example from bean that implements ContextLoaderListener), i.e. something like the following: public class BeansValidator impelements ContextLoaderListener { public void contextInitialized(ServletContextEvent event) { if (ApplicationContext.getBeansOfType(BaseCarService.class).isEmpty()) { // print log, throw exception, etc } } }
has comment: http://stackoverflow.com/comment/40332787
accepted answer of: http://stackoverflow.com/q/25767533
has comment: http://stackoverflow.com/comment/40327144
upvote count: 1
has comment: http://stackoverflow.com/comment/40332088
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40330442

http://stackoverflow.com/a/25726342
answers question: http://stackoverflow.com/q/25725910
has comment: http://stackoverflow.com/comment/40219705
has body: There are some problems with your code: String name = null; Don't start with a null String, otherwise, you will have a file name starting with "null" when you first concatenate something to it. Start with an empty String: String name = ""; But, your main problem is here: if (value == 1) { // ... value = 2; } if (value == 2) { // ... value = 1; } You will always enter the two if when value is 1, because at the end of the first if block, you are changing the value to 2, and testing if the value is 2 at the beginning of the second block. If you want to do that, you have to add an else: if (value == 1) { // ... value = 2; } else if (value == 2) { // ... value = 1; }
type: Answer
score: 1
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/40459520
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25856937
has text: Restrictions on the size of the redo log have nothing do do with performance. And as the whole problem is (only) about queries, not DML, redo logs will almost certainly not be a problem here.

http://stackoverflow.com/q/25847524
type: Question
has title: Java class import Error ! Liferay
has comment: http://stackoverflow.com/comment/40444937
score: -1
accepted answer: http://stackoverflow.com/a/25884779
has body: I created a java class in a hook and I imported it in asset_publisher/view.jsp like this: &lt;%@ page import="fr.liferay.hook.assetPublisher.TestAssetPublisherUtil"%&gt; and it gives this error : Only a type can be imported. fr.liferay.hook.assetPublisher.TestAssetPublisherUtil resolves to a package I am using Liferay 6.2 ce ga2
has comment: http://stackoverflow.com/comment/40445614
answer count: 1
has comment: http://stackoverflow.com/comment/40445024
has comment: http://stackoverflow.com/comment/40445508
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/40445837
tagged with: liferay-6
has comment: http://stackoverflow.com/comment/40442353
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25884779
tagged with: java
downvote count: 2
tagged with: import

http://stackoverflow.com/q/25803357
has body: I have two classes like these: public class Parent { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "DBId") private Long DBId = null; @ManyToOne(fetch = FetchType.EAGER) @LazyToOne(LazyToOneOption.FALSE) private SampleSet samples; } public class SampleSet { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Basic(optional = false) @Column(name = "DBId") private Long DBId = null; private String uniqueId; @ElementCollection(fetch = FetchType.EAGER) @CollectionTable(name = "SampleSet_samplesSet") private Set&lt;String&gt; samplesSet = new TreeSet&lt;&gt;(); } and I have a code like this: public void modifyAndSaveParent(Parent p, Session session) { SampleSet s = (SampleSet) session.getNamedQuery("SampleSet.loadByUniqueId").setParameter("uniqueId", p.getSampleSet().getUniqueId()).uniqueResult(); if (s == null) throw new RuntimeException(); else p.setSampleSet(s); session.save(p); session.flush(); } The problem is that an exception is thrown on session.flush(): org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: SampleSet at org.hibernate.engine.internal.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:249) at org.hibernate.type.EntityType.getIdentifier(EntityType.java:509) at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:309) at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:319) at org.hibernate.type.TypeHelper.findDirty(TypeHelper.java:294) at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:4051) at org.hibernate.event.internal.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:535) at org.hibernate.event.internal.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:235) at org.hibernate.event.internal.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:164)…
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25811396
type: Question
has comment: http://stackoverflow.com/comment/40363394
has comment: http://stackoverflow.com/comment/40361663
has comment: http://stackoverflow.com/comment/40362961
has title: Hibernate @ManyToOne mapping: object references an unsaved transient instance
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40362640
tagged with: many-to-one
type: UnansweredQuestion
tagged with: hibernate-mapping
has comment: http://stackoverflow.com/comment/40363340
has comment: http://stackoverflow.com/comment/40361628
has answer: http://stackoverflow.com/a/25803705
has answer: http://stackoverflow.com/a/25804134

http://stackoverflow.com/a/25989970
score: 3
has comment: http://stackoverflow.com/comment/40938645
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25786922
has body: I left this project for some time, and came back to it yesterday. AND I MADE IT. The problem was that the UNITY receiver had to be also registered in the ANDROID manifest, in fact i think it has to be registered in both of the manifests. I hope this helps someone someday :D
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/98135070
answers question: http://stackoverflow.com/q/25786922
downvote count: 0
has comment: http://stackoverflow.com/comment/40963695
type: Answer

http://stackoverflow.com/comment/40290031
score: 0
comment on: http://stackoverflow.com/q/25764126
type: Comment
type: QuestionComment
has text: But i want to print data in column wise. Any suggestions please

http://stackoverflow.com/comment/40476087
comment on: http://stackoverflow.com/q/25866464
score: 0
type: Comment
type: QuestionComment
has text: Compile your program and call it with CallableStatement directly from your database.

http://stackoverflow.com/q/25830673
possible better answer: http://stackoverflow.com/a/25830778
has comment: http://stackoverflow.com/comment/40714109
has answer: http://stackoverflow.com/a/25830778
type: Question
answer count: 2
has title: Android: Don't open app after performing notification on-click action
has body: The main part of my app is a service that displays a notification. The GUI of the app is only used to be able to change some settings. When I click on that notification, some data should be send in the background without opening the app. To do that, I created an invisible activity. When I open the app (the configuration part) and exit it with the back button, everything works as intended; when clicking on the notification the data is send without opening the app. When I exit the app with the home button, every time I click the notification the app opens again. This is my notification and the Intent to call the data activity: PendingIntent toggleLightsIntent = PendingIntent.getActivity( this, 0, new Intent(this, HyperionToggleSwitchActivity.class), PendingIntent.FLAG_NO_CREATE); Notification notification = new Notification.Builder(this) .setSmallIcon(R.drawable.ic_launcher) .setContentTitle("HyperionSwitch") .setContentText("Switch lights") .setContentIntent(toggleLightsIntent) .build(); And this is the part where I send the data: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); sendJson(blue); finish(); } What do I have to change so the app won't open when clicking the notification? It's my first app and took me quite a while to get what I have so far...
downvote count: 0
favorite count: 0
tagged with: notifications
has comment: http://stackoverflow.com/comment/40663770
has comment: http://stackoverflow.com/comment/40411840
tagged with: android
has answer: http://stackoverflow.com/a/25976383
has comment: http://stackoverflow.com/comment/40438947
has comment: http://stackoverflow.com/comment/40674611
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40663957
has comment: http://stackoverflow.com/comment/40445457
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25976383
tagged with: java

union
type: Tag
tag name: union
tags question: http://stackoverflow.com/q/25840152

http://stackoverflow.com/comment/40240996
type: QuestionComment
comment on: http://stackoverflow.com/q/25736801
score: 0
has text: Then your pattern still doesn't match.
type: Comment

http://stackoverflow.com/a/25806206
has comment: http://stackoverflow.com/comment/40366906
accepted answer of: http://stackoverflow.com/q/25806174
score: -1
answers question: http://stackoverflow.com/q/25806174
has comment: http://stackoverflow.com/comment/40366991
upvote count: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40366083
has comment: http://stackoverflow.com/comment/40366445
has comment: http://stackoverflow.com/comment/40366884
type: Answer
has comment: http://stackoverflow.com/comment/40366944
has comment: http://stackoverflow.com/comment/40366068
has body: You can try something similar public static int pmove() throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String br_rl = br.readLine(); int br_int = Integer.parseInt(br_rl); if (br_int &gt; 0 &amp;&amp; br_int &lt; 10) { return br_int; } else { throw new IOException("Input Out of Range"); } } You can create your own custom Exception to do this in better way.
downvote count: 1

http://stackoverflow.com/a/25865777
type: Answer
has body: Correct receiver entry in your Manifest should be just <action android:name="android.intent.action.BOOT_COMPLETED" />
score: 0
answers question: http://stackoverflow.com/q/25865686

http://stackoverflow.com/q/25764775
upvote count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/40290552
has comment: http://stackoverflow.com/comment/40290332
type: AnsweredQuestion
downvote count: 0
has title: Intellij marks all methods as unused even though they are used
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/40292002
has answer: http://stackoverflow.com/a/71531030
type: Question
accepted answer: http://stackoverflow.com/a/25767959
has comment: http://stackoverflow.com/comment/40314991
tagged with: intellij-idea
possible better answer: http://stackoverflow.com/a/71531030
has body: Here is part of the code. public class MyPolynomial { private double coeffs[]; private int degree; public MyPolynomial(double ... coeffs) { if (coeffs != null &amp;&amp; coeffs.length &gt; 0) { this.coeffs = new double[coeffs.length]; System.arraycopy(coeffs, 0, this.coeffs, 0, coeffs.length); } //this.coeffs = Arrays.copyOf(coeffs, coeffs.length); } public MyPolynomial(String filename) { Scanner in = null; try { in = new Scanner(new File(filename)); } catch (FileNotFoundException e) { e.printStackTrace(); } this.degree = in.nextInt(); coeffs = new double[degree+1]; for (int i = 0; i &lt; coeffs.length; i++) { coeffs[i] = in.nextDouble(); } } public String getCoeffs() { return Arrays.toString(coeffs); } } The class, the constructors, as well as all the methods are marked as unused. But I did use them in the test file. It compiles and runs as expected. Part of the test file: MyPolynomial aTest = new MyPolynomial(1, 2, 3, 4, 5); System.out.println(aTest.getCoeffs()); System.out.println(aTest.getDegree()); System.out.println(aTest);
has comment: http://stackoverflow.com/comment/40296260
answer count: 2
has answer: http://stackoverflow.com/a/25767959

http://stackoverflow.com/a/25816386
has body: The problem is mousepoint may not be set by the time move() is called. Just check to see if it is null in your move() method. It doesn't look like you've started to add the code to "escape the mouse pointer" -- I'm guessing you can handle figuring that part out on your own. public void move(Ball ball, Point mouse) { Point p = ball.getLocation(); Point speed = ball.getSpeed(); Dimension size = ball.getSize(); if (mouse != null) { System.out.println(mouse.x); // here } int vx = speed.x; int vy = speed.y; // ...
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40385574
accepted answer of: http://stackoverflow.com/q/25816205
upvote count: 5
answers question: http://stackoverflow.com/q/25816205
type: Answer
has comment: http://stackoverflow.com/comment/40385730
has comment: http://stackoverflow.com/comment/40386583
downvote count: 0
has comment: http://stackoverflow.com/comment/40386123
score: 5

http://stackoverflow.com/comment/40309663
comment on: http://stackoverflow.com/q/25771993
score: 1
has text: Still not a SSCCE. Where's your actual drawing code?
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40412478
comment on: http://stackoverflow.com/q/25831366
type: Comment
type: QuestionComment
has text: @Code-Apprentice I wanted the array to have inside its two elements, the integers 1 and 2, not show the number two twice over. You have solved my quexstion, however. Many thanks!
score: 0

http://stackoverflow.com/q/25847186
upvote count: 2
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/25848456
score: 2
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: oracle-database
has title: Aggregate HQL result to list
has body: I want to group some sql data using criteria. Lets start with entity which looks mostly like this: class CityEntity { private String name; private Date lastVisited; } What I want to do is to find all cities and return result in a tranformer: class CityTransformer { private String name; private List&lt;Date&gt; lastVisited; } So as you can see sql result should group by name and put dates to a list. I want to do it using criteria so it will look almost like this: Criteria criteria = session.createCriteria(CityEntity.class, "ce"); criteria.setProjection(Projections.projectionList().add(Projections.groupProperty("name"), "name")); criteria.setResultTransformer(Transformers.aliasToBean(CityTransformer.class)); List&lt;CityTransformer&gt; cities = criteria.list(); The problem is that I don't know how to aggregate dates (lastVisited) to list. Any help? For example the input will look like this (name, lastVisited): [Los Angeles, 10-11-2014], [Los Angeles, 11-12-2011], [LosAngeles, 10-01-2011], [Berlin, 01-10-2011] and output should look like this [LosAngeles, list[10-11-2014, 11-12-2011, 10-01-2011]], [Berlin, list[01-10-2011]]

http://stackoverflow.com/q/25742488
accepted answer: http://stackoverflow.com/a/25748360
score: 0
answer count: 1
has title: New relic Maven exception
has body: I´m using New relic on my Maven integration test, and sometimes when I run the integration test and my agent with the confirugraiton on the VM -javaagent:/path/to/newrelic.jar is running, I receive this exception ERROR: Aborted Maven execution for InterruptedIOException java.net.SocketTimeoutException: Accept timed out at java.net.PlainSocketImpl.socketAccept(Native Method) at java.net.AbstractPlainSocketImpl.accept(AbstractPlainSocketImpl.java:398) at java.net.ServerSocket.implAccept(ServerSocket.java:530) at java.net.ServerSocket.accept(ServerSocket.java:498) at hudson.maven.AbstractMavenProcessFactory$SocketHandler$AcceptorImpl.accept(AbstractMavenProcessFactory.java:183) 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 hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:299) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:280) at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:239) at hudson.remoting.UserRequest.perform(UserRequest.java:118) at hudson.remoting.UserRequest.perform(UserRequest.java:48) at hudson.remoting.Request$2.run(Request.java:328) at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:724) Anyone know anything about this issue? Regards.
has comment: http://stackoverflow.com/comment/40249918
tagged with: maven
tagged with: newrelic
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25748360
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40249836

http://stackoverflow.com/a/25853014
has comment: http://stackoverflow.com/comment/40452716
has body: Double click on the Tomcat server entry in the Servers tab, you'll get the server configuration. At the left column, under Server Locations, select Use Tomcat installation (note, when it is grayed out, read the section leading text! ;) ). This way Eclipse will take full control over Tomcat, this way you'll also be able to access the default Tomcat homepage with the Tomcat Manager when running from inside Eclipse. I only don't see how that's useful while developing using Eclipse. NOTE: Simply because the Tomcat homepage is not in the work space metadata the Tomcat homepage is not one of the Eclipse projects. Below steps to change server location. Right click on my tomcat server in "Servers" view, select "Properties…" In the "General" panel, click on the "Switch Location" button The "Location: [workspace metadata]" bit should have been replaced by something else. Open (or close and reopen) the Overview screen for the server.
answers question: http://stackoverflow.com/q/25852787
has comment: http://stackoverflow.com/comment/40466280
has comment: http://stackoverflow.com/comment/40458909
has comment: http://stackoverflow.com/comment/40452675
has comment: http://stackoverflow.com/comment/40452328
has comment: http://stackoverflow.com/comment/40458710
upvote count: 1
has comment: http://stackoverflow.com/comment/40459458
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/40479472
score: 0
type: Comment
type: QuestionComment
has text: when they are acronyms, letters are separated by dots.
comment on: http://stackoverflow.com/q/25844721

http://stackoverflow.com/comment/40357956
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25728006
score: 1
has text: @AlexanderZhak its not working please help me

http://stackoverflow.com/q/25760526
tagged with: http://stackoverflow.com/tag/c
accepted answer: http://stackoverflow.com/a/25760665
type: Question
answer count: 1
has body: in photoshop, normally I need to adjust by hand to set the maximum value of R,G or B. is there any image library (python,java,C#.) to get ,to calculate or to set the maximum of R,G,and B? I have a look at PIL (python image library) but not found the point. Thanks
tagged with: python
has answer: http://stackoverflow.com/a/25760665
score: 0
tagged with: php
has title: get the max of R,G,B of one image by using programming
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40299760
comment on: http://stackoverflow.com/q/25762308
has text: BigMatt Please paste the code of Generator.Also,specify if Generator is class or interface
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25793856
has body: I have N-queen problem written in Java and C#. You can find out more about 8-queen problem here. Here is Java code: package nqueens; import java.util.Arrays; public class NQueens { public static void main(String args[]) { int n = 13; int[] ploca = new int[n]; postaviKraljicuNaPlocu(0, ploca); } private static void postaviKraljicuNaPlocu(int Ki, int[] ploca) { int n = ploca.length; if (Ki == n) { System.out.println(Arrays.toString(ploca)); } else { for (int kolona = 0; kolona &lt; n; kolona++) { if (jeLiSigurnoMjesto(kolona, Ki, ploca)) { ploca[Ki] = kolona; postaviKraljicuNaPlocu(Ki + 1, ploca); ploca[Ki] = -1; } } } } private static boolean jeLiSigurnoMjesto(int kolona, int Ki, int[] ploca) { for (int i = 0; i &lt; Ki; i++) { if (ploca[i] == kolona) { return false; } if (Math.abs(ploca[i] - kolona) == Math.abs(i - Ki)) { return false; } } return true; } } Here is C# code: using System; namespace nkraljica { public class NKraljica { public static void Main(string[] args) { int n = 13; int[] ploca = new int[n]; postaviKraljicuNaPlocu(0, ploca); } private static void postaviKraljicuNaPlocu(int Ki, int[] ploca) { int n = ploca.Length; if (Ki == n) { Console.WriteLine(string.Join("", ploca)); } else { for (int kolona = 0; kolona &lt; n; kolona++) { if (jeLiSigurnoMjesto(kolona, Ki, ploca)) { ploca[Ki] = kolona; postaviKraljicuNaPlocu(Ki + 1, ploca); ploca[Ki] = -1; } } } } private static bool jeLiSigurnoMjesto(int kolona, int Ki, int[] ploca) { for (int i = 0; i &lt; Ki; i++) { if (ploca[i] == kolona) { return false; } if (Math.Abs(ploca[i] - kolona) == Math.Abs(i - Ki)) { return false; } } return true; } } } For N=13, Java code finishes in 1,7 second, but C# in 17,3 seconds. Why is difference so big?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40345956
has comment: http://stackoverflow.com/comment/40343649
linked to: http://stackoverflow.com/q/4616742
has comment: http://stackoverflow.com/comment/40347831
has comment: http://stackoverflow.com/comment/40344025
upvote count: 3
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/25796494
has title: Java vs C# algorithm execution
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/40345274
tagged with: algorithm
has comment: http://stackoverflow.com/comment/40350273
score: 0
answer count: 1

http://stackoverflow.com/q/25867461
score: 0
tagged with: 3d
tagged with: calculus
has title: 2D array to 3D plane
has comment: http://stackoverflow.com/comment/40492743
has comment: http://stackoverflow.com/comment/40619672
tagged with: geometry
answer count: 0
type: UnansweredQuestion
has body: I am trying to create a 3D plane out of a collection of 2D points for a game I am making. I have omitted the Z axis in my illustration as the depth is constant. Also the plane will consist of multiple 3D models; one per line segment: The original 2D points will form the top layer of the plane. I have successfully created the 3D plane v1, but as you can see from the illustration it leaves me with some issues with overlapping and cracks in the ground. My problem is understanding how to properly calculate the positions for A1, ...., E1 while still keeping the thickness of the line constant. Let me add that I have already available the signed angle of each line segment and also that a line segment can be on top of another forming a ceiling. This is however randomly generated. Can someone please help point me in the direction of the calculations/algorithm that are needed to properly calculate this? I have been thinking of Pythagoras, but want to avoid the square root, hence I think the line angles can prove useful.
type: Question
tagged with: 2d
tagged with: java

http://stackoverflow.com/comment/40277258
type: AnswerComment
type: Comment
has text: it displays synatx error nea CURDATE() what can I do to solve this?
comment on: http://stackoverflow.com/a/25737116
score: 0

http://stackoverflow.com/q/25799671
tagged with: deployment
has answer: http://stackoverflow.com/a/25838097
favorite count: 0
tagged with: netbeans
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/28248736
has title: Netbeans GlassFish Server 4, deploy, Connection refused: connect, false , The module has not been deployed. See the server log for details
tagged with: java
has comment: http://stackoverflow.com/comment/40355399
has answer: http://stackoverflow.com/a/29707415
upvote count: 10
type: Question
tagged with: jakarta-ee
score: 10
tagged with: glassfish
answer count: 3
has body: My problem is that i get this message after i run any web application. example, in netbeans i create new project and chose webapplication i leave everything default i don't change the names. then i deploy the first time it works but when i close netbeans and open it later and try to deploy the same project that was working before i get that error, no first it get stuck at "Starting GlassFish Server 4" then i stop it and redeploy and i get Starting GlassFish Server 4 GlassFish Server 4 is running. In-place deployment at C:\Users\****\Documents\NetBeansProjects\WebApplication1\build\web GlassFish Server 4, deploy, Connection refused: connect, false C:\Users\***\Documents\NetBeansProjects\WebApplication1\nbproject\build-impl.xml:1045: The module has not been deployed. See the server log for details. BUILD FAILED (total time: 8 seconds) so this has cost me my exam because i didn't know how to deal with it, it was devastating to feel so powerless, i immediately got disorientated and before i knew it, it was time to hand in our work and i was still stuck at first task and every other task depended on the success of the first task. Anyway since then i have been deleting glassfish and reinstalling to get it to work(too bad i dint think of this during my exams, also should have focused more on practice than theory then i could have see the problem already). have tried adding netbeans to fire wall, changing ports and some other stuff suggested by others, still no luck, result is always the same i even used a brand new virtual machine and i still get the same message when i close netbeans and reopen it later. again when i delete glassfish and reinstall it i works just fine. here is my server log, apologies, i don't know how to make it pretty yet. Server Log: [2014-09-13T04:14:44.926+0200] [glassfish 4.1] [INFO] [NCLS-LOGGING-00009] [javax.enterprise.logging] [tid: _ThreadID=17 _ThreadName=RunLevelControllerThread-1410574484853] [timeMillis: 1410574484926] [levelValue: 800] [[ …
downvote count: 0

http://stackoverflow.com/comment/40308654
type: QuestionComment
comment on: http://stackoverflow.com/q/25763862
has text: You can accept multiple formats as shown [here](http://stackoverflow.com/a/2241997/230513).
score: 0
type: Comment

http://stackoverflow.com/a/25727773
type: AcceptedAnswer
downvote count: 0
score: 4
has body: What you want to do is to combine a function with a consumer. You can do it this way: food.stream().map(String::toUpperCase).forEach(System.out::println); Alternatively you can use a lambda expression: food.forEach(x-&gt;System.out.println(x.toUpperCase())); Besides these straight-forward approaches, you can combine functions to create a new function but not a function with a consumer, however, with the following quirky code you can do it: Function&lt;String,String&gt; f0=String::toUpperCase; food.forEach(f0.andThen(" "::concat).andThen(System.out::append)::apply); This get even uglier if you try to inline the first expression for a one-liner…
type: Answer
has comment: http://stackoverflow.com/comment/40223460
answers question: http://stackoverflow.com/q/25727647
accepted answer of: http://stackoverflow.com/q/25727647
has comment: http://stackoverflow.com/comment/40222369
upvote count: 4

http://stackoverflow.com/comment/40392101
type: Comment
has text: Thanks for that. Working fine now. Appreciate it.
comment on: http://stackoverflow.com/a/25819859
score: 0
type: AnswerComment

http://stackoverflow.com/q/25846722
has comment: http://stackoverflow.com/comment/40441559
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/40440552
answer count: 3
has comment: http://stackoverflow.com/comment/40440842
score: 3
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/40440792
has answer: http://stackoverflow.com/a/25846854
has answer: http://stackoverflow.com/a/25847671
has comment: http://stackoverflow.com/comment/40440466
has answer: http://stackoverflow.com/a/25846959
tagged with: indexing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25847671
possible better answer: http://stackoverflow.com/a/25846854
has body: i am trying to remove all text except last 10 characters but getting error in android 09-15 16:22:58.146: E/AndroidRuntime(13630): java.lang.StringIndexOutOfBoundsException: length=228; index=263 but it is working on java when i tried it in separate class. here is what i tried? can anybody tell me if there is any issue regarding substring in android? String allchar = "PJGOGROG fnkmslkjsfsdmnsgdnklnsgklsgknlgrf jkghijgdlkjkgjdfkjgf kjlgdfkjlfdgfjklklj kljfdkjlfkjldfdkjslkljdfskjlfsjkldfsjklkljs fdsjklsdfkljsfdkljkhgfhhgdfsgkhdfskghfdskghfdsghsfdghafevbhfsvgydcgubcdmgycdgfehkhfeghjgh68 Alias12345"; String number = ""; String reqtext = allchar.replaceAll("\\s+",""); number = reqtext.substring(reqtext.length()-10 ); System.out.println(number);
upvote count: 3
tagged with: java
tagged with: substring
type: Question
downvote count: 0
has title: Remove all characters except last n characters from a string

http://stackoverflow.com/comment/45300126
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25866386
has text: Thanks, your solution worked. However I think you made a mistake: The line should be `private GzipFilter filter = new GzipFilter(Gzip.gzip(8192),102400,shouldGzip);` See [the source](https://github.com/playframework/playframework/blob/2.3.x/framework/src/play-filters-helpers/src/main/scala/play/filters/gzip/GzipFilter.scala): `private val DefaultChunkSize = 8192`. Or am I wrong?
score: 0

http://stackoverflow.com/comment/40281902
comment on: http://stackoverflow.com/q/25759473
has text: @SparkOn That won't work, you won't be able to pass a Double[] to a method that expects a double[]. Autoboxing does not work that way around because of the possibility of null object references. What value would you expect the double representation of a null Double object to have?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25722696
tagged with: maven
upvote count: 1
has answer: http://stackoverflow.com/a/25723074
type: AnsweredQuestion
tagged with: cxf
score: 1
has title: Where I put auto-generated classes?
tagged with: java
type: Question
tagged with: cxf-codegen-plugin
answer count: 1
accepted answer: http://stackoverflow.com/a/25723074
downvote count: 0
has body: I use cxf maven plugin to generate classes for web services. I wonder which directory I specify for &lt;sourceRoot&gt;. Is it a good practice to put the generated classes in ${basedir}\target\classes ?
favorite count: 0

http://stackoverflow.com/a/25820754
has body: Solved the Problem. thank for your reply guys. I mistyped the name as ojdbc.jar instead of ojdbc6.jar. Wasted more than 3 hours for my silly mistake. grrrr.. I would not have noticed it If I didnt copied it for pasting it here.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25820652

http://stackoverflow.com/a/25795060
type: Answer
answers question: http://stackoverflow.com/q/25793549
score: 1
has body: @ResponseStatus(HttpStatus.BAD_REQUEST) will set the status code to 400. However, the .andExpect(status().isOk()) snippet will compare the status code to 200, which will fail the test and line where you print the content will never be reached.
upvote count: 1
has comment: http://stackoverflow.com/comment/40346602
downvote count: 0

http://stackoverflow.com/a/25722837
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40213071
has body: Are you looking for this solution? package benchmark; public class Benchmark { public static void main(String[] args) { long startTime = System.currentTimeMillis(); long endTime = startTime + 1000; long index = 0; long index2 = 0; long index3 = 0; while (true) { Math.sqrt(index); long now = System.currentTimeMillis(); if (now &gt; endTime) { break; } index++; } while (true) { Math.sqrt(index2); long now2 = System.currentTimeMillis(); if (now2 &gt; endTime) { break; } while (true) { Math.sqrt(index3); long now3 = System.currentTimeMillis(); if (now3 &gt; endTime) { break; } } } long total = (index + index2 + index3) / 3; System.out.print(total + &quot; loops per second on average.&quot;); } }
answers question: http://stackoverflow.com/q/25722761
upvote count: 1
has comment: http://stackoverflow.com/comment/40213161

http://stackoverflow.com/comment/40350056
type: QuestionComment
has text: ^^^ yea, that's javacv, not opencv's own wrappers.
type: Comment
comment on: http://stackoverflow.com/q/25732685
score: 0

http://stackoverflow.com/comment/40243614
comment on: http://stackoverflow.com/a/25738601
score: 0
type: AnswerComment
has text: yes I have changed like this, `DateFormat df = new SimpleDateFormat("yyyy-mm-dd"); Date frmDate= df.parse("2014-01-01"); Date toDate=df.parse("2014-09-01");` but no use
type: Comment

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/25786880
type: Tag
tags question: http://stackoverflow.com/q/25712918

http://stackoverflow.com/a/25717795
has body: try int i = 1; for (pegawai p : list_pegawai) { Row row2 = sheet.createRow(i++); row2.createCell(0).setCellValue(p.getName()); row2.createCell(1).setCellValue(p.getAddress()); row2.createCell(2).setCellValue(p.getPh()); } you are already iterating through the list, no need to do twice. you do not want to create a new row everytime
answers question: http://stackoverflow.com/q/25717637
has comment: http://stackoverflow.com/comment/40210916
accepted answer of: http://stackoverflow.com/q/25717637
score: 3
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40206153
has comment: http://stackoverflow.com/comment/40209698
has comment: http://stackoverflow.com/comment/40205559
type: Answer
has comment: http://stackoverflow.com/comment/40210853
has comment: http://stackoverflow.com/comment/40236088
upvote count: 3

http://stackoverflow.com/a/25759248
type: Answer
answers question: http://stackoverflow.com/q/25758844
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25758844
score: 4
type: AcceptedAnswer
downvote count: 0
has body: All of the device information you can get below the ways. Hope for help. Get CPU Core of device /** * Gets the number of cores available in this device, across all processors. * Requires: Ability to peruse the filesystem at "/sys/devices/system/cpu" * @return The number of cores, or 1 if failed to get result */ private int getNumCores() { //Private Class to display only CPU devices in the directory listing class CpuFilter implements FileFilter { @Override public boolean accept(File pathname) { //Check if filename is "cpu", followed by a single digit number if(Pattern.matches("cpu[0-9]+", pathname.getName())) { return true; } return false; } } try { //Get directory containing CPU info File dir = new File("/sys/devices/system/cpu/"); //Filter to only list the devices we care about File[] files = dir.listFiles(new CpuFilter()); //Return the number of cores (virtual CPU devices) return files.length; } catch(Exception e) { //Default to return 1 core return 1; } } Get Total RAM of device public static String getTotalRAM() { RandomAccessFile reader = null; String load = null; try { reader = new RandomAccessFile("/proc/meminfo", "r"); load = reader.readLine(); } catch (IOException ex) { ex.printStackTrace(); } finally { // Streams.close(reader); } return load; } Other information of device String _OSVERSION = System.getProperty("os.version"); String _RELEASE = android.os.Build.VERSION.RELEASE; String _DEVICE = android.os.Build.DEVICE; String _MODEL = android.os.Build.MODEL; String _PRODUCT = android.os.Build.PRODUCT; String _BRAND = android.os.Build.BRAND; String _DISPLAY = android.os.Build.DISPLAY; String _CPU_ABI = android.os.Build.CPU_ABI; String _CPU_ABI2 = android.os.Build.CPU_ABI2; String _UNKNOWN = android.os.Build.UNKNOWN; String _HARDWARE = android.os.Build.HARDWARE; String _ID = android.os.Build.ID; String _MANUFACTURER = android.os.Build.MANUFACTURER; String _SERIAL = android.os.Build.SERIAL; String _USER = android.os.Build.USER; String _HOST = android.os.Build.H…
has comment: http://stackoverflow.com/comment/40282057
has comment: http://stackoverflow.com/comment/40281553

http://stackoverflow.com/comment/40245049
type: QuestionComment
type: Comment
has text: we will have only that top level element in json for 999. that's it. It will fall in "Breaking condition" mentioned in my problem statement. no need to traverse for any element which is not present as key in map. but it should be in json as next element without any child element.
comment on: http://stackoverflow.com/q/25736280
score: 0

informix
tags question: http://stackoverflow.com/q/25789283
tag name: informix
type: Tag

http://stackoverflow.com/comment/40490353
score: 0
comment on: http://stackoverflow.com/q/25872369
type: Comment
type: QuestionComment
has text: Could you please give the exact error message ? Or better the stacktrace ...

http://stackoverflow.com/comment/40396225
has text: I have been able to reproduce this. I am currently looking for the cause and a potential solution.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25819496

http://stackoverflow.com/comment/40474258
score: 0
has text: Ok, thank you, that was the most helpful comment ever. I was just looking for someone to show me where did i go wrong. If you can show me what to change in my code that would be nice. If not thank you anyway.
type: AnswerComment
comment on: http://stackoverflow.com/a/25863621
type: Comment

http://stackoverflow.com/comment/40315704
score: 0
type: Comment
type: QuestionComment
has text: Can you provide the reference for "the web tutorials ask that I create an interface for every table in the database"?
comment on: http://stackoverflow.com/q/25778190

http://stackoverflow.com/a/41644646
has body: I know this question already been answered, but I wanted to share my version of the solution. When I use the server's timestamp, i usually need to use it more than once, i.e I have some kind of startTime and endTime which both depend on the server's time, where startTime is NOW and endTime is X seconds / minutes / hours after startTime, so to spare the multiple requests to the server I save the server's time in a root child called serverTime in the database, and I use it to set all dependent values. Another thing, because of the way Firebase works with the ServerValue.Timestamp, eventually it fires 2 events (added and changed), the first one with local timestamp and the second with the actual server's timestamp. So to overcome the issue of not receiving the correct time I added a simple OnCompleteListener. A short example code: import android.support.annotation.NonNull; import com.google.android.gms.tasks.OnCompleteListener; import com.google.android.gms.tasks.Task; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.ServerValue; import com.google.firebase.database.ValueEventListener; public class ServerTime { public interface OnTimeRetrievedListener { void onTimeRetrieved(Long timestamp); } private final DatabaseReference db; public ServerTime(DatabaseReference db) { this.db = db.child("serverTime"); } /** * Gets the server's timestamp in milliseconds. * @param listener {@link OnTimeRetrievedListener} */ public void getTime(final OnTimeRetrievedListener listener) { if (listener == null) { return; } db.setValue(ServerValue.TIMESTAMP).addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() { @Override public void onComplete(@NonNull Task&lt;Void&gt; task) { db.addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { listener.onTimeRetrieved(dataSnapshot.getValue(…
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25744398
score: 2
upvote count: 2

http://stackoverflow.com/comment/40323312
comment on: http://stackoverflow.com/a/25780427
has text: @khmarbaise: Atul already said *is not you asked for* but can you imagine a single reason to include sources in an *executable* jar along with .class files ?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40300585
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25770216
has text: Change textview's property to multilines

http://stackoverflow.com/q/25771068
favorite count: 0
has answer: http://stackoverflow.com/a/25771136
has title: Hibernate: mapping nested objects -EDITED-
has body: For example, I have the following tables: USER: | USERID | USERNAME | USERTYPEID | USERTYPE: | USERTYPEID | USERTYPENAME | So clearly USERTYPEID is a foreign key that a user use to refer to usertype. The JAVA implementation is as such: I have a class User and a class UserType, where looks like: public class User { private int id; private UserType ut; .... } public class UserType { ... } In the User.hbm.xml: &lt;hibernate-mapping&gt; &lt;class name="com.pretech.User" table="User"&gt; &lt;meta attribute="class-description"&gt; This class contains the employee detail. &lt;/meta&gt; &lt;id name="id" type="int" column="UserID"&gt; &lt;generator class="native"/&gt; &lt;/id&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; So my questions follows: 1) what should I put to map the UserType here and indicate UserType as foreign key? 2) In the case of User includes a list of UserType (may not conceptually true but just want to use as an example), such as: public class User { private int id; private List&lt;UserType&gt; uts; } what shoud I do about the hibernate mapping? EDIT: Added explanation about foreign key stuff.
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40308384
tagged with: java
tagged with: hibernate
score: -1
accepted answer: http://stackoverflow.com/a/25771136
type: Question
answer count: 2
upvote count: 0
possible better answer: http://stackoverflow.com/a/25771212
has comment: http://stackoverflow.com/comment/40302079
has answer: http://stackoverflow.com/a/25771212
tagged with: hibernate-mapping

http://stackoverflow.com/q/25822894
has comment: http://stackoverflow.com/comment/40412721
has body: I am building my new Vaadin application for Prototype using the link https://vaadin.com/wiki/-/wiki/Main/Creating+a+simple+login+view I have 3 views 1) Login View 2) Main View 3) Registration View and 1) base class LoginUI.java which handles the navigation. So, to put together, I have a Login View which is the main login screen and has 2 buttons, one to Login to application and another one to Register a new user. and these 3 views are handled by a base class called LoginUI.java The problem I am currently facing is that I am successfully able to login to application i.e. the navigation from Login View to Main View is perfectly fine. But, when I click Register button, the navigation does not take me to Registration View at all. It still holds me at Login View (instead of navigating to Registration View). Could some one please help me here? I believe the problem is mainly in beforeViewChange method in LoginUI.java But am unable to fix it The classes are as below 1) LoginUI.java public class LoginUI extends UI { @WebServlet(value = "/*", asyncSupported = true) @VaadinServletConfiguration(productionMode = false, ui = LoginUI.class) public static class Servlet extends VaadinServlet { } @Override protected void init(VaadinRequest request) { // // Create a new instance of the navigator. The navigator will attach // itself automatically to this view. // new Navigator(this, this); // // The initial log view where the user can login to the application // getNavigator().addView(SimpleLoginView.NAME, SimpleLoginView.class); getNavigator().addView(RegistrationView.NAME, RegistrationView.class); // // Add the main view of the application // getNavigator().addView(MainView.NAME, MainView.class); // // We use a view change handler to ensure the user is always redirected // to the login view if the user is not logged in. // getNavigator().addViewChangeListener(new ViewChangeListener() { @Override public boolean beforeViewChange(ViewChangeEvent event) { // Check if a user has logged i…
type: UnansweredQuestion
tagged with: vaadin7
answer count: 0
score: 0
tagged with: java
tagged with: vaadin
type: Question
has title: Navigation issues
has comment: http://stackoverflow.com/comment/40402122

http://stackoverflow.com/a/25822481
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40615518
has body: You don't need a server for every group. All you need to add very member of a group to a separate instance of the group object. When you want to broadcast a message to every player in the sending players group, you iterate over the group collection that the sending players group is part of, and send the message to every player in that group. You might not want to send the sending player the new state, unless it has changed in regards to their perspective. You then keep the sending player updated client-side, so the players won't notice any input lag.
answers question: http://stackoverflow.com/q/25822363

hashmap
tags question: http://stackoverflow.com/q/25752910
tags question: http://stackoverflow.com/q/25844388
tags question: http://stackoverflow.com/q/25843919
tags question: http://stackoverflow.com/q/25852516
tags question: http://stackoverflow.com/q/25773886
tags question: http://stackoverflow.com/q/25782057
tags question: http://stackoverflow.com/q/25808956
tags question: http://stackoverflow.com/q/25729872
tags question: http://stackoverflow.com/q/25723609
tags question: http://stackoverflow.com/q/25714902
tags question: http://stackoverflow.com/q/25792456
tags question: http://stackoverflow.com/q/25794381
tags question: http://stackoverflow.com/q/25805914
tags question: http://stackoverflow.com/q/25764169
tags question: http://stackoverflow.com/q/25718340
tags question: http://stackoverflow.com/q/25862076
tags question: http://stackoverflow.com/q/25788501
type: Tag
tags question: http://stackoverflow.com/q/25714520
tags question: http://stackoverflow.com/q/25737641
tags question: http://stackoverflow.com/q/25728730
tags question: http://stackoverflow.com/q/25866974
tags question: http://stackoverflow.com/q/25800304
tags question: http://stackoverflow.com/q/25742014
tags question: http://stackoverflow.com/q/25777960
tag name: hashmap
tags question: http://stackoverflow.com/q/25828888
tags question: http://stackoverflow.com/q/25791787
tags question: http://stackoverflow.com/q/25726016

http://stackoverflow.com/comment/40341267
type: Comment
has text: Thank you. This wasn't in the documentation, but it is in the source code. I fixed the arguments in the answer as well.
type: AnswerComment
comment on: http://stackoverflow.com/a/25792547
score: 0

http://stackoverflow.com/comment/40454479
type: AnswerComment
type: Comment
has text: I updated the answer, hopefully making it more clear. Actually all you need to do is merge the library jar with your jar.
comment on: http://stackoverflow.com/a/25853152
score: 0

http://stackoverflow.com/q/25768397
has body: I have noticed that Java compiler does not converting String addition (+) to StringBuilder.append() method. I have created a class which has only one method public void doSomething(String a, String b) { String c = a + "a"; String d = b + "b"; String e = c + d; String f = e; System.out.println(f); } After compilation and decompilation my method looked like this: public void doSomething(String paramString1, String paramString2) { String str1 = paramString1 + "a"; String str2 = paramString2 + "b"; String str3 = str1 + str2; String str4 = str3; System.out.println(str4); } Why compiler not optimizing my code? I am using ant for packaging and debug setting is false. I've also tried javac for single java file but result is the same.
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40297641
accepted answer: http://stackoverflow.com/a/25769023
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40298123
has answer: http://stackoverflow.com/a/25768731
type: Question
tagged with: stringbuilder
answer count: 3
has answer: http://stackoverflow.com/a/25769023
has title: Java compiler not optimizing string concatenation
downvote count: 0
has comment: http://stackoverflow.com/comment/40297301
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/40297397
possible better answer: http://stackoverflow.com/a/25769526
has answer: http://stackoverflow.com/a/25769526
has comment: http://stackoverflow.com/comment/40297753

http://stackoverflow.com/a/25719032
has comment: http://stackoverflow.com/comment/40206937
score: 0
has comment: http://stackoverflow.com/comment/40206468
type: Answer
has comment: http://stackoverflow.com/comment/40206996
has body: .*?q=(http:.*?)&amp;amp Try this.This gives all the matches. See here. http://regex101.com/r/iX5xR2/9
has comment: http://stackoverflow.com/comment/40206880
answers question: http://stackoverflow.com/q/25718046

http://stackoverflow.com/comment/40210194
type: Comment
comment on: http://stackoverflow.com/a/25721024
has text: @TheLostMind I think i answered how String concatenation works using + operator,but yes String.valueOf is important
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40198844
type: Comment
comment on: http://stackoverflow.com/a/25714974
has text: get hold of the bound object info (id) and delete that in the database, and re aquire the data from the db and then set them in the singleton refernece
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40258984
type: Comment
has text: Did you obtain a solution
comment on: http://stackoverflow.com/a/25747151
type: AnswerComment
score: 0

http://stackoverflow.com/q/25797538
type: Question
score: -1
has title: Spring third party authentication
answer count: 2
upvote count: 0
tagged with: spring-security
favorite count: 0
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/25799556
has answer: http://stackoverflow.com/a/25802903
has body: What I want is first check local database for authentication. if user is not authenticated. make a rest call with username and password to another server which returns a success message and complete user bean. which I want to store in spring security session. how can I achive this.? I tried with loadUserByUsername() method but there is no password parameter.
tagged with: java
downvote count: 1

http://stackoverflow.com/comment/40487670
has text: Not at all. I didn't say that I want to convert label's string to a color but a JPanel
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25872055

http://stackoverflow.com/comment/40398012
comment on: http://stackoverflow.com/q/25823367
type: QuestionComment
has text: @hexafraction yes but it wasnt there a few minutes ago :))
score: 0
type: Comment

http://stackoverflow.com/comment/40386828
comment on: http://stackoverflow.com/a/25813398
has text: There's always going to be a delay, but you can try making the chunk size smaller so that it reads less from the mic before outputting. There has to be something in the output buffer before it can be written
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25748254
type: Answer
has comment: http://stackoverflow.com/comment/40279900
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40399287
has comment: http://stackoverflow.com/comment/40298959
has comment: http://stackoverflow.com/comment/40642981
accepted answer of: http://stackoverflow.com/q/25746812
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40399944
has body: Think of the VM as a library of C/C++ code that your application has called into. Sometimes it calls back into your code. Singletons will not be recreated -- it's just a method call. The Dalvik VM threads are just pthreads, and whichever thread executes the native call from Java-language code will be the thread that executes your C++ code. Your best bet is to attach a native debugger. FWIW, one way to crash with nothing in logcat is to have native recursion that overflows the stack. Another way is to change the signal handlers for SIGSEGV / SIGBUS and friends.
downvote count: 0
answers question: http://stackoverflow.com/q/25746812

http://stackoverflow.com/comment/40281770
score: 1
comment on: http://stackoverflow.com/a/25737155
has text: @javanoob Added examples of required classes.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40395035
has text: The reverse operation is easy if you don't append to an initially empty string sucessively, but start with a dummy string of the same length as the encrypted string, all spaces initially, say, and then fill in the slots according to `j`.
score: 0
comment on: http://stackoverflow.com/q/25820101
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25818497
type: AcceptedAnswer
downvote count: 0
has body: the purpose of this function is to take string with only lower case letters (a-z) in it and check whether all symbols are unique, ie it will return true for abc and return false for abca this is done in next way: for each symbol from string we're calculating it order number in alphabet, so a becomes 0, b becomes 1, z will become 25 we have variable checker which is used as mask to store bit, each bit means that we've met some symbol from alphabet to set/test bit in this variable they're using bitshift 1 &lt;&lt; val so, to understand this function fully I suggest you to read about bit masks and bit arithmetic
type: Answer
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/25818459
answers question: http://stackoverflow.com/q/25818459

http://stackoverflow.com/a/25739032
has comment: http://stackoverflow.com/comment/40257539
has comment: http://stackoverflow.com/comment/40249676
type: Answer
has comment: http://stackoverflow.com/comment/40249774
score: 2
has comment: http://stackoverflow.com/comment/40250315
downvote count: 0
answers question: http://stackoverflow.com/q/25737778
has comment: http://stackoverflow.com/comment/40249895
has comment: http://stackoverflow.com/comment/40256280
has comment: http://stackoverflow.com/comment/40256015
has body: Why not use a class and override the equals method? import java.awt.Color; public class Card{ int number; String state; Color color; String suit; public Card(int number, String state, Color color, String suit) { super(); this.number = number; this.state = state; this.color = color; this.suit = suit; } public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } public String getState() { return state; } public void setState(String state) { this.state = state; } public Color getColor() { return color; } public void setColor(Color color) { this.color = color; } public String getSuit() { return suit; } public void setSuit(String suit) { this.suit = suit; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((color == null) ? 0 : color.hashCode()); result = prime * result + number; result = prime * result + ((state == null) ? 0 : state.hashCode()); result = prime * result + ((suit == null) ? 0 : suit.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Card other = (Card) obj; if (color == null) { if (other.color != null) return false; } else if (!color.equals(other.color)) return false; if (number != other.number) return false; if (state == null) { if (other.state != null) return false; } else if (!state.equals(other.state)) return false; if (suit == null) { if (other.suit != null) return false; } else if (!suit.equals(other.suit)) return false; return true; } } If you are using Eclipse IDE all of this is generated automatically, you only have to declare the 4 fields. From the menù: Source -> Generate getters and setters. Source -> Generate constructor using fields. Source -> Generate hashCode() and equals(). Then you can create a Card object: Card card1 = new Card(1, "open", Color.RED, "diamond"); Card card2 = new Card(1, "solid", Color.GREEN, "diamond…
upvote count: 2

http://stackoverflow.com/q/25716464
tagged with: constructor
type: UnansweredQuestion
has title: Difference between two String constructors
has answer: http://stackoverflow.com/a/25716479
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: I'm wondering the difference between the following 2 statements: String str = new String(new char[]{'a', 'b'}); and String str = new String(new byte[]{'a', 'b'}); I get the same thing in the outcome. The only difference i can think of is that i don't have to convert the array type to byte[] when i have a char[] and vice versa. TIA.
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40201439
tagged with: string
favorite count: 0

http://stackoverflow.com/comment/49105965
type: AnswerComment
comment on: http://stackoverflow.com/a/25770246
has text: @ZakTaccardi for your input
score: 0
type: Comment

http://stackoverflow.com/q/25756743
has comment: http://stackoverflow.com/comment/40480733
upvote count: 1
has title: Start Tomcat on Console from Jenkins
type: Question
has answer: http://stackoverflow.com/a/25871201
tagged with: batch-file
answer count: 2
possible better answer: http://stackoverflow.com/a/66699366
downvote count: 0
has comment: http://stackoverflow.com/comment/40526125
has answer: http://stackoverflow.com/a/66699366
tagged with: tomcat
favorite count: 0
has body: I have a batch file which start Tomcat as follows (when running it on Windows it works fine) ... start C:\Users\root\tomcat\tomcat2\bin\startup.bat The batch file is called from Jenkins as follows I have this error in the Jenkins Consol at the end of the build D:\jenkins\workspace\Start 3T2&gt;start C:\Users\root\tomcat\tomcat2\bin\startup.bat Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information Finished: SUCCESS When I check the task manager I see that the server is started but in background. I need actually to start Tomcat it in the Console. This is what I did : I added -Dhudson.util.ProcessTree.disable=true in jenkins-slave.xml used to start jenkins slave service. I added set BUILD_ID=dontkillme in startup.bat to stop Jenkins from stopping the process in the end. I think Tomcat start correctly in the end but not in Console. I'm running Windows 2012 server/Tomcat7/Jenkins 1.578. Any idea on how to start Tomcat in a Console ?
accepted answer: http://stackoverflow.com/a/25871201
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40525744
tagged with: jenkins
has comment: http://stackoverflow.com/comment/40482982
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40519826

http://stackoverflow.com/comment/42953564
type: Comment
score: 0
has text: Hi Ranjinth, sorry for the late response. I was actually able to deploy my Play app on Azure using this tutorial http://msopentech.com/blog/2014/09/26/new-tutorial-running-play-framework-applications-microsoft-azure-cloud-services/
type: AnswerComment
comment on: http://stackoverflow.com/a/26155164

http://stackoverflow.com/a/25867445
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25806919
answers question: http://stackoverflow.com/q/25806919
type: Answer
has body: Java Annotation Element Method return @Override public boolean process(Set&lt;? extends TypeElement&gt; annotations, RoundEnvironment roundEnv) { Set&lt;? extends Element&gt; elements = roundEnv.getElementsAnnotatedWith(CustomAnnotation.class); for(Element te : elements){ CustomAnnotation annotation = te.getAnnotation(CustomAnnotation.class); String folder = annotation.folder(); //... do sth with folder in context of te. //te represent annotated method, e.g. testMethod from your example } return true; } Also remember to annotate your CompileTimeAnnotationProcessor with @SupportedAnnotationTypes("package.CustomAnnotation") and @SupportedSourceVersion(SourceVersion.RELEASE_7) (or whatever version of Java syntax are you going to support). In case of further problems, I recommend to read this great tutorial blog post.

http://stackoverflow.com/a/25736958
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25736900
type: Answer
has body: Here is the rule for width in format specifiers If the string representation of the value does not fill the minimum length, the field will be left-padded with spaces. If the converted value exceeds the minimum length, however, the converted result will not be truncated. So your expectation to truncate the value is wrong. It is used only for padding.

http://stackoverflow.com/q/25713884
has answer: http://stackoverflow.com/a/48023014
has comment: http://stackoverflow.com/comment/40197246
answer count: 10
has comment: http://stackoverflow.com/comment/40197002
has comment: http://stackoverflow.com/comment/40197262
favorite count: 0
has answer: http://stackoverflow.com/a/42849578
has answer: http://stackoverflow.com/a/46972961
has comment: http://stackoverflow.com/comment/40196660
has answer: http://stackoverflow.com/a/25743802
accepted answer: http://stackoverflow.com/a/25714960
has comment: http://stackoverflow.com/comment/40197690
has title: JPA Transient Annotation and JSON
tagged with: spring
has answer: http://stackoverflow.com/a/52777157
has comment: http://stackoverflow.com/comment/40198276
has body: This is a follow up to the following question on the JPA Transient annotation Why does JPA have a @Transient annotation? I have a transient variable that I do not want to persist and it is marked with the transient annotation. However, when I want to produce JSON from my rest controller, this transient variable is not available in the outputted JSON. The POJO PublicationVO is straight forward with no fancy attributes, just some private attributes (that are persisted) with getters and setters and 1 transient variable. @RequestMapping(value = { "{publicationId}"}, method = RequestMethod.GET, produces = "application/json") @ResponseBody public PublicationVO getPublicationDetailsJSON(@PathVariable(value = "publicationId") Integer publicationId) { LOG.info("Entered getPublicationDetailsJSON - publicationId: " + publicationId); //Call method to get the publicationVO based on publicationId PublicationVO publicationVO = publicationServices.getPublicationByIdForRestCalls(publicationId); LOG.info("publicationVO:{}", publicationVO); LOG.info("Exiting getPublicationDetailsJSON"); return publicationVO; } The PublicationVO is as follows package com.trinity.domain.dao; import java.util.Calendar; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Transient; import com.fasterxml.jackson.annotation.JsonInclude; @Entity @Table(name = "publication") public class PublicationVO { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "id", unique = true, nullable = false) private Integer id; @Column(name = "publicationName", unique = false, nullable = false, length = 200) private String publicationName; @Column(name = "publicationSource", unique = false, nullable = false, length = 45) …
type: AnsweredQuestion
upvote count: 46
possible better answer: http://stackoverflow.com/a/30372930
linked to: http://stackoverflow.com/q/2154622
has comment: http://stackoverflow.com/comment/40196864
tagged with: java
has answer: http://stackoverflow.com/a/58196099
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/25714960
has comment: http://stackoverflow.com/comment/40197392
has comment: http://stackoverflow.com/comment/40197545
score: 46
type: Question
has comment: http://stackoverflow.com/comment/75061586
linked to: http://stackoverflow.com/q/21708339
downvote count: 0
tagged with: jackson
has answer: http://stackoverflow.com/a/47242519
tagged with: rest
has answer: http://stackoverflow.com/a/30372930
has comment: http://stackoverflow.com/comment/40196572
has comment: http://stackoverflow.com/comment/40197333
has answer: http://stackoverflow.com/a/45958216

http://stackoverflow.com/q/25840793
downvote count: 0
has body: I have about 10,000,000 records inside a redis database. I received a single columned CSV file with about 100,000 strings which correspond to keys in my redis database. For each of these strings inside the CSV I need to increment the value in redis by one. Normally to increment the INCR command is used, but is there a way I can make this faster than creating a loop that iterates 100,000 times and sends an INCR command one by one to change each key value individually? Is there a more mass way to update?
accepted answer: http://stackoverflow.com/a/25841626
favorite count: 0
possible better answer: http://stackoverflow.com/a/25846877
tagged with: redis
has answer: http://stackoverflow.com/a/25846877
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has title: redis mass incrementation updates
tagged with: performance
has answer: http://stackoverflow.com/a/25841626
answer count: 2

http://stackoverflow.com/q/25843781
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25843797
has answer: http://stackoverflow.com/a/25843854
score: 0
answer count: 2
has title: Same output for hashCode() and identityHashCode()
has answer: http://stackoverflow.com/a/25843797
possible better answer: http://stackoverflow.com/a/25843854
has body: Consider the following code: public class MyClass { public static void main(String[] args) { Object obj = new Object(); System.out.println(obj.hashCode()); System.out.println(System.identityHashCode(obj)); } } Output: 328332828 328332828 Then what is the use of using hashCode() and identityHashCode()?
type: AnsweredQuestion
tagged with: hashcode

http://stackoverflow.com/q/25847296
has answer: http://stackoverflow.com/a/25882858
type: UnansweredQuestion
has title: Updated Image not getting reflected
tagged with: java
tagged with: file
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25847522
tagged with: crop
tagged with: ajax
has body: I am trying to crop image.There is an ajax call made to the server end where cropping takes place and original file gets replaced with cropped image. Now when i get back the control, i still see the old image even though cropped image exists at the same location. Changes reflect only after page refresh which i don't want users to do it.Code for crop image is as follows BufferedImage originalImgage = ImageIO.read(new File(filePath+"\\"+subFolder+"\\"+fileName)); ImageIO.write(originalImgage,extention,new File(filePath+"\\"+subFolder+"\\"+dateStamp+"_"+fileName));//save original image BufferedImage SubImgage = originalImgage.getSubimage(xAxis,yAxis,width,height); File outputfile = new File(filePath+"\\"+subFolder+"\\"+fileName); ImageIO.write(SubImgage,extention,outputfile); pls help Thanks
score: 0

http://stackoverflow.com/q/25844862
answer count: 2
has comment: http://stackoverflow.com/comment/40511340
linked to: http://stackoverflow.com/q/25474317
has comment: http://stackoverflow.com/comment/40437974
tagged with: android
has comment: http://stackoverflow.com/comment/40437564
has comment: http://stackoverflow.com/comment/40438168
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25846680
has title: My App not posting data to a MySQL database on android
has comment: http://stackoverflow.com/comment/40438278
has comment: http://stackoverflow.com/comment/40437189
type: Question
has answer: http://stackoverflow.com/a/25844966
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/40438069
tagged with: mysql
has body: My App can't post data to a MySQL database on Android. The App is not responding because I add this line of code. //StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); //StrictMode.setThreadPolicy(policy); It crashes without this line of code. Here's my code. MainActivity.java package com.example.testingtesting; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; 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.HttpClient; import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicNameValuePair; import android.annotation.SuppressLint; import android.os.Bundle; import android.os.StrictMode; import android.support.v7.app.ActionBarActivity; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends ActionBarActivity { EditText et1,et2,et3; Button b; InputStream is = null; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); setContentView(R.layout.activity_main); et1 = (EditText)findViewById(R.id.editText1); et2 = (EditText)findViewById(R.id.editText2); et3 = (EditText)findViewById(R.id.editText3); b = (Button)findViewById(R.id.button1); b.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String name = "" +et1.getText().toString(); String age = "" +et2.getText()…
tagged with: eclipse

http://stackoverflow.com/comment/40686266
type: AnswerComment
type: Comment
has text: I was unsure about the performance of ByteBuffer vs java.io.Bits so ran a quick test. Results show that for storing java.io.Bits is the fastest with absolute BB right after, and for reading absolute BB is the fastest with relative big endian and then little endian following, Bits slowest. Here's a pastebin link to detailed results and src code for my test: http://pastebin.com/XStkmN8s
score: 0
comment on: http://stackoverflow.com/a/25814396

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/25744217

http://stackoverflow.com/comment/40220056
type: Comment
has text: Ah, it might be because I am using an online editor. I can't have a real JDE on this system. That makes sense, thanks!
type: AnswerComment
comment on: http://stackoverflow.com/a/25725875
score: 0

http://stackoverflow.com/a/62661709
upvote count: 16
answers question: http://stackoverflow.com/q/25738569
has comment: http://stackoverflow.com/comment/119993486
downvote count: 0
has body: If you need to map json type property to json format when responding to the client (e.g. rest API response), add @JsonRawValue as the following: @Column(name = "params", columnDefinition = "json") @JsonRawValue private String params; This might not do the DTO mapping for server-side use, but the client will get the property properly formatted as json.
has comment: http://stackoverflow.com/comment/124347534
type: Answer
score: 16

code-generation
tag name: code-generation
tags question: http://stackoverflow.com/q/25840792
tags question: http://stackoverflow.com/q/25751758
tags question: http://stackoverflow.com/q/25760531
type: Tag

http://stackoverflow.com/q/25835786
has answer: http://stackoverflow.com/a/25835858
has body: In the following code: public class FooMain { private static void foo(byte b) {} public static void main(String args[]) throws Exception { byte b1 = 0; // javac doesn't complain byte b2 = 127+30000-30000; // javac apparently does arithmetic and doesn't complain foo(0); // javac complains here and requires a cast to (byte). Why? } } why does the javac compiler complain on the call to foo while it is apparently able to deduce that the literals or even literal arithmetic expressions supplied are safe to be assigned to byte variables? I am using Oracle javac 1.7.0_60.
answer count: 2
upvote count: 1
tagged with: java-7
downvote count: 0
favorite count: 0
tagged with: javac
accepted answer: http://stackoverflow.com/a/25835841
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25835841
possible better answer: http://stackoverflow.com/a/25835858
type: Question
has title: integer literals as byte variables/parameters: when exactly does the compiler complain?

http://stackoverflow.com/q/25732741
has body: My pc runs windows 7. Where exactly can i find which java version my pc uses (Probably i use jdk_8 version)? My goal is to find which one of these versions: default-jre gcj-4.8-jre-headless openjdk-7-jre-headless gcj-4.6-jre-headless openjdk-6-jre-headless is the equivalent for linux.
has answer: http://stackoverflow.com/a/25732769
tagged with: linux
has comment: http://stackoverflow.com/comment/40232055
answer count: 5
possible better answer: http://stackoverflow.com/a/25732750
has answer: http://stackoverflow.com/a/25732750
has title: Where can i find which version of java my pc uses
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25732782
type: Question
has answer: http://stackoverflow.com/a/25732751
accepted answer: http://stackoverflow.com/a/25732782
score: 0
tagged with: windows
has answer: http://stackoverflow.com/a/25889324

http://stackoverflow.com/a/25716919
score: 1
accepted answer of: http://stackoverflow.com/q/25716899
has comment: http://stackoverflow.com/comment/40202621
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25716899
upvote count: 1
has body: In JSON array starts with [ and object starts with {. forecast is not an array in your JSON, so change this JSONArray forecast = new JSONArray(data.getJSONArray("forecast").toString()); to JSONObject forecast = new JSONObject(data.getJSONObject("forecast").toString()); Additionally, forecastday is the array. So change the logic accordingly.
type: Answer
downvote count: 0

http://stackoverflow.com/comment/40210463
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25719418
type: Comment
has text: inputStream is the `FileInputStream` of the zip that I want to add. I am closing it to free its resources once its copied.

http://stackoverflow.com/comment/40420888
score: 0
type: QuestionComment
type: Comment
has text: Isn't that exactly what you want?
comment on: http://stackoverflow.com/q/25835799

http://stackoverflow.com/comment/40470063
type: Comment
comment on: http://stackoverflow.com/q/25862888
has text: Do you want `href="/1"` in all 3 cases?
score: 0
type: QuestionComment

http://stackoverflow.com/q/25764459
has answer: http://stackoverflow.com/a/70050214
tagged with: spring
has answer: http://stackoverflow.com/a/78780620
has answer: http://stackoverflow.com/a/60503546
type: AnsweredQuestion
tagged with: java
upvote count: 136
possible better answer: http://stackoverflow.com/a/41914719
has answer: http://stackoverflow.com/a/62971900
has body: I have a very simple Spring Boot app that I'm trying to get working with some externalised configuration. I've tried to follow the information on the spring boot documentation however I'm hitting a road block. When I run the app below the external configuration in the application.properties file does not get populated into the variable within the bean. I'm sure I'm doing something stupid, thanks for any suggestions. MyBean.java (located in /src/main/java/foo/bar/) package foo.bar; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.stereotype.Component; @Component public class MyBean { @Value("${some.prop}") private String prop; public MyBean() { System.out.println("================== " + prop + "================== "); } } Application.java (located in /src/main/java/foo/) package foo; import foo.bar.MyBean; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.SpringApplication; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @Configuration @ComponentScan @EnableAutoConfiguration public class Application { @Autowired private MyBean myBean; public static void main(String[] args) { SpringApplication.run(Application.class, args); } } application.properties (located in /src/main/resources/) some.prop=aabbcc Log output when executing the Spring Boot app: grb-macbook-pro:properties-test-app grahamrb$ java -jar ./build/libs/properties-test-app-0.1.0.jar . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|======…
has answer: http://stackoverflow.com/a/41914719
has answer: http://stackoverflow.com/a/72547797
has answer: http://stackoverflow.com/a/25765032
type: Question
has answer: http://stackoverflow.com/a/48577132
tagged with: spring-boot
has answer: http://stackoverflow.com/a/57373755
answer count: 13
has answer: http://stackoverflow.com/a/79495726
downvote count: 0
accepted answer: http://stackoverflow.com/a/25765032
has answer: http://stackoverflow.com/a/58480940
favorite count: 0
has comment: http://stackoverflow.com/comment/40290028
has title: Spring Boot application.properties value not populating
has answer: http://stackoverflow.com/a/61462823
has answer: http://stackoverflow.com/a/68753846
score: 136

http://stackoverflow.com/a/25849131
upvote count: 4
has body: Do an inner join to a values table select ... from table_name inner join (values (first_value), (second_value) ) s(column_name) using (column_name) ; Or, easier to string build, to an unnested array select ... from table_name inner join unnest( array[first_value, second_value] ) s(column_name) using (column_name) ;
has comment: http://stackoverflow.com/comment/40444723
downvote count: 0
answers question: http://stackoverflow.com/q/25848652
accepted answer of: http://stackoverflow.com/q/25848652
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40446270
type: Answer

http://stackoverflow.com/q/25765883
tagged with: hibernate-envers
has title: Why cant I close HibernateSessionFactory and reopen it and it still work?
has comment: http://stackoverflow.com/comment/40293240
has comment: http://stackoverflow.com/comment/40292450
type: UnansweredQuestion
answer count: 0
score: 0
has body: I'm having a problem with closing Hibernate Session Factory, my application allows the user to recreate the database, so when they want to do that firstly I close the hibernate session factory to free Hibernates grip on the database. public static void closeFactory() { if(factory != null) { factory.close(); } } Then I wait a few seconds which seems to help Thread.sleep(10000); Then I recreate the database, (FWIW regular hibernate and Envers - I need to create factory for Envers tables to be created), and close the factory down again. public static void recreateDatabase() { Configuration config; config = HibernateUtil.getInitializedConfigurationAndRebuildAuditTables(); new SchemaExport(config).create(true, true); factory = config.buildSessionFactory(); factory.close(); factory=null; } But then when I test a session with: public static Session getSession() { if (factory == null) { createFactory(); } Session hibernateSession = factory.openSession(); return hibernateSession; } and try to use it to access a Hibernate based class (Song.class )it fails complaining org.hibernate.exception.SQLGrammarException: Table "SONG" not found; SQL statement: basically it cant see any of the tables. I can stop this problem by not closing the SessionFactory after recreating the table public static void recreateDatabase() { Configuration config; config = HibernateUtil.getInitializedConfigurationAndRebuildAuditTables(); new SchemaExport(config).create(true, true); factory = config.buildSessionFactory(); } however there are two problems with this I don't understand why I cant close and session reopen the factory I was originally looking a this code because I was getting occasional Hibernate problems and I wanted to be able to reset the session factory. Can anyone explain this to me please ? Note Without the factory = config.buildSessionFactory(); line in the createDatabase() methodafter tables are created I just get ....... create index IDX_SONG_CHANGES_REPORTID on SongChanges (reportId) a…
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/comment/40194836
type: QuestionComment
has text: You could split into sentences first (long pause) and during the iteration you can split the current sentence into words (short pause).
comment on: http://stackoverflow.com/q/25712998
score: 0
type: Comment

http://stackoverflow.com/comment/40411554
comment on: http://stackoverflow.com/q/25830919
score: 0
type: QuestionComment
type: Comment
has text: This shouldn't be a problem. Any code compiled with Java 1.6 can run on Java 1.8.

http://stackoverflow.com/a/25823574
has comment: http://stackoverflow.com/comment/40398191
has body: you can inject touch events to the system, here is a tutorial about this http://www.pocketmagic.net/2012/04/injecting-events-programatically-on-android/
type: Answer
has comment: http://stackoverflow.com/comment/40398181
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25823546
has comment: http://stackoverflow.com/comment/40398172
upvote count: 1

http-status-code-503
tags question: http://stackoverflow.com/q/25833295
type: Tag
tag name: http-status-code-503

http://stackoverflow.com/q/25845645
has comment: http://stackoverflow.com/comment/40438535
has comment: http://stackoverflow.com/comment/40439198
tagged with: java
has title: Generate new file at every hour in Log4j.xml
type: Question
has answer: http://stackoverflow.com/a/25846731
score: 0
answer count: 1
has body: I want to create log file for every hour with new name using log4j. I am using application server as JBoss EAP 6.2. Please help me out how to configure it in log4j.xml.
tagged with: log4j
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40439154

http://stackoverflow.com/comment/40297247
has text: ar1[i] = ((int) Math.random() * 100);
comment on: http://stackoverflow.com/q/25768435
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/25866877
has body: Calendar calendar = Calendar.getInstance(); calendar.set(1997, 11, 2); SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); System.out.println(dateFormat.format(calendar.getTime()));
type: Answer
score: 0
answers question: http://stackoverflow.com/q/25866708

http://stackoverflow.com/q/25825952
upvote count: 5
has answer: http://stackoverflow.com/a/25826007
has comment: http://stackoverflow.com/comment/40402440
has comment: http://stackoverflow.com/comment/40402419
has comment: http://stackoverflow.com/comment/40402485
has answer: http://stackoverflow.com/a/25826064
accepted answer: http://stackoverflow.com/a/25826064
answer count: 4
has title: Create range of years from start to end.
downvote count: 0
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40402477
tagged with: java
possible better answer: http://stackoverflow.com/a/25827010
has answer: http://stackoverflow.com/a/25827010
score: 5
has answer: http://stackoverflow.com/a/25826197
has body: I'm looking for the simplest way to create range of years that I can put into a list starting with a from year and ending with an end year. Example String fromYear = "2010" String toYear = "2014" expecting to create a list of years ["2010","2011","2012","2013","2014"] No I know I need to convert the string to an Integer Integer from = fromYear != null ? Integer.parseInt(fromYear) : null; Integer to = toYear != null ? Integer.parseInt(toYear) : null; From there I'm lost as for the most efficient way to complete this.
favorite count: 0

http://stackoverflow.com/a/26936691
answers question: http://stackoverflow.com/q/25758581
type: Answer
has body: The Android SDK does not support Java 8. You have to install Java 7. And verify that Android xbit version is the same xbit version than the Java installed
score: 0

http://stackoverflow.com/q/25854118
type: AnsweredQuestion
tagged with: connection-pooling
score: 1
tagged with: java
has title: warning messages with hikaricp
type: Question
accepted answer: http://stackoverflow.com/a/25873568
answer count: 2
downvote count: 0
tagged with: hikaricp
has body: I am using hikaricp as my database connection pool. I am closing the connection when I am done with my SQL statement by calling close on the connection which I believe you should return the connection proxy back to the pool . Yet, I see the following warning (not error) message and I have to wonder whether its an issue that needs to be addressed because I'm not cleaning up my connection resources properly. I am not using a try with resources but using a try catch finally (I close the connection in the finally &amp; I realize that in certain conditions, the finally may actually not get called but it is being called in my case). any thoughts? 2014-09-15 13:59:26,083 WARN c.z.h.p.LeakTask [Hikari Housekeeping Timer (pool wmHikariCp)] Connection leak detection triggered, stack trace follows java.lang.Exception at com.abc.test.DBConnPool.getConnection(DBConnPool.java:71) at com.abc.test.TestProj.callDB(TestApp.java:30) at com.abc.test.TestProj.main(TestApp.java:81)
has answer: http://stackoverflow.com/a/25862064
favorite count: 0
tagged with: database-connection
possible better answer: http://stackoverflow.com/a/25862064
has answer: http://stackoverflow.com/a/25873568
upvote count: 1

http://stackoverflow.com/a/25870804
accepted answer of: http://stackoverflow.com/q/25870418
type: AcceptedAnswer
downvote count: 0
has body: These warnings are from Android Studio and are not supported by Eclipse. You can turn of the message in 'Preferences > Java > Compiler > Errors/Warnings', expand the 'Annotations' section and change 'Unhandled token in @SuppressWarnings' to Ignore.
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25870418
upvote count: 4
has comment: http://stackoverflow.com/comment/59982880

http://stackoverflow.com/a/25827134
answers question: http://stackoverflow.com/q/25826778
has body: First of all download Apache Tomcat Server as Zip file from http://tomcat.apache.org/download-60.cgi. Then unzip and save at some location(Remember the location). Goto Eclipse->Preferences->Server->Runtime Environments->Add Popup will come, choose version of Apache Tomcat Server that you have downloaded Click on Next. Enter the some name of the server(This will appear in servers view), Enter the location of the server and then click on finish. Now Goto Window->Show View->search for servers and click on OK. Now Now choose the servers view. The server added by you will appear there. Now double click on that server, it will open the configuration settings menu. Make sure you have selected "Use Tomcat installation (takes control of Tomcat installation)" and also change the HTTP/1.1 Port Number from default 8080 to something else(8081 for e.g.) if you have any other software using that port. And then save it Now right click on the server and then click on start. That's it you have successfully configured Apache Tomcat. You should get Tomcat's welcome page when you go and visit "localhost:8081/" in your web browser.
has comment: http://stackoverflow.com/comment/40405635
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40405670

http://stackoverflow.com/comment/40230117
score: 1
comment on: http://stackoverflow.com/q/25731679
type: Comment
has text: Uh... Java. Which uses JNI to hook into the OS, which would be in C/C++ like @DeepanshuBedi said. -- With that said, you should not be using AWT directly now-days... use either Swing (the replacement for AWT which fixes/improves many things), or JavaFX (the Swing replacemnet) if you are starting out on a new project
type: QuestionComment

http://stackoverflow.com/q/25836068
type: UnansweredQuestion
has title: "Variable might not have been initialized" -- Text Based Adventure in Java
answer count: 4
has body: So I'm trying to create a text-based adventure. It starts in a room, and gives you two room options. From there, each room option has 2 more options. And then each room has a "yes" or "no" option.. There are a total of 15 rooms, and 8 different outcomes. I am supposed to be creating this using if statements. However I keep getting an error that says "variable may not have been initalized" for the variables room2, room3, room4, room5, room6, &amp; room7. I know that it is because the variables are declared within the if statement, but I do not know the correct solution. Any help would be much appreciated. Thanks. import java.util.Scanner; public class Adventure1 { public static void main( String[] args ) { Scanner keyboard = new Scanner(System.in); String room1, room2, room3, room4, room5, room6, room7; System.out.println( "Welcome to Carolyn's Tiny Adventure! " ); System.out.println( "You are in a SUPER creepy house! " ); System.out.println( "Do you want to go upstairs or into the basement ? " ); System.out.println( "(upstairs OR basement)" ); room1 = keyboard.next(); if ( room1.equals("upstairs") ) { System.out.println( "You notice there is a ladder that leads to an attic." ); System.out.println( "Do you want to go up or explore the bedrooms? (up OR bedrooms) " ); room2 = keyboard.next(); } if ( room1.equals("basement") ) { System.out.println( "There's nothing in the basement except an old rocking chair &amp; a dusty cabinet. " ); System.out.println( "Do you want to open or would you rather rock on the chair? (open OR chair) " ); room3 = keyboard.next(); } if ( room2.equals("up") ) { System.out.println( "It's super dark up here, &amp; there's dust and spiders everywhere. " ); System.out.println( "But you see a cool looking chest. Do you want to open it? (yes OR no) " ); room4 = keyboard.next(); } if ( room2.equals("bedrooms") ) { System.out.println( "You find what looks like a child's bedroom. " ); System.out.println( "Do you want to see what's inside the closet? (…
has answer: http://stackoverflow.com/a/25836146
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40421056
type: Question
has answer: http://stackoverflow.com/a/25836102
has answer: http://stackoverflow.com/a/25836297
has answer: http://stackoverflow.com/a/25836101
has comment: http://stackoverflow.com/comment/40421129
tagged with: variables
tagged with: initialization
has comment: http://stackoverflow.com/comment/40421468

http://stackoverflow.com/comment/40320002
type: AnswerComment
comment on: http://stackoverflow.com/a/25767139
has text: Thanks for the detailed description of the issue.
score: 0
type: Comment

http://stackoverflow.com/comment/40209996
has text: Thank you for your great help.Surly I'll test it :)
score: 0
comment on: http://stackoverflow.com/q/25719070
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25783449
tagged with: java
possible better answer: http://stackoverflow.com/a/25783489
type: Question
has answer: http://stackoverflow.com/a/25783489
has title: Redirect OutputStream to a file
score: 0
answer count: 2
upvote count: 1
downvote count: 1
tagged with: outputstream
favorite count: 0
has answer: http://stackoverflow.com/a/25783608
accepted answer: http://stackoverflow.com/a/25783608
type: AnsweredQuestion
has body: I have to use a method to write a model, from an api. mode.write(OutputStream out); At the moment I am doing that to see my output on my console: model.write(System.out); However, I would like to specify a file path to write the output to a file. Any recommendations how I could take this OutputStream and change it into a FileOutputStream to write it to a file? I appreciate your answer!

http://stackoverflow.com/q/25783758
has answer: http://stackoverflow.com/a/25799662
score: 0
answer count: 2
tagged with: dynamic-proxy
tagged with: exception
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27547327
has comment: http://stackoverflow.com/comment/40332635
tagged with: java
has title: Getting UndeclaredThrowableException in a Thrift call
linked to: http://stackoverflow.com/q/5490139
type: Question
tagged with: thrift
has body: I am getting this java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy1.getMyObject(Unknown Source) I went through a similar post here and this article posted in one the comments . But in this case the I am calling following method using a ThriftClient which was created using com.twitter.common.thrift.ThriftFactory&lt;T&gt; myThriftClient.getMyObject() Is there any way of knowing what is the actual cause of this error ? Should I need to change something in thrift side code ?

http://stackoverflow.com/comment/43053975
type: AnswerComment
comment on: http://stackoverflow.com/a/25913330
type: Comment
has text: What is your exact need ? there is already an answer using Jersey (the one rated '5' which got the bounty)
score: 0

http://stackoverflow.com/comment/40354718
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25799125
has text: Ok so that did print out each "The residuals after nth time are:" statement. But I also needed to print the accumulator statements. Is there a way to include that without having the loops again?

http://stackoverflow.com/comment/40402807
type: Comment
comment on: http://stackoverflow.com/a/25824478
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61176/discussion-between-noobeditor-and-ajmal-khan).
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40292836
has text: I can't tell from your edited question exactly what your project structure is. Although there is some flexibility if you are in charge of the classpath (you are not), the standard and recommended way is this: project/src/main/resources/ini.yaml
comment on: http://stackoverflow.com/a/25736487
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40442469
type: QuestionComment
comment on: http://stackoverflow.com/q/25847960
has text: you sure have log4j.jar in your classpath?
score: 0
type: Comment

http://stackoverflow.com/comment/40288387
type: QuestionComment
comment on: http://stackoverflow.com/q/25763121
has text: Also tried as PNG but will same result :(
score: 0
type: Comment

http://stackoverflow.com/comment/40353070
score: 0
comment on: http://stackoverflow.com/q/25781750
type: Comment
type: QuestionComment
has text: so what happens if you do not flush? I usually use a printWriter in this case. Maybe you could a bit more of your code.

http://stackoverflow.com/q/25732685
has answer: http://stackoverflow.com/a/25797077
tagged with: java-native-interface
tagged with: java
tagged with: eclipse
type: AnsweredQuestion
tagged with: ubuntu
has comment: http://stackoverflow.com/comment/40350056
accepted answer: http://stackoverflow.com/a/25797077
type: Question
has title: Open Cv Face Recognition in java : symbol lookup error
has comment: http://stackoverflow.com/comment/40242346
linked to: http://stackoverflow.com/q/22948553
has body: I tried adding the FaceRecognition wrapper for Opencv in java after this example. I had some issues since I'm trying to do this on Ubuntu, but I was able to create the .so file in the end. Still I can't use it since I get the error: /usr/lib/jvm/java-7-openjdk-amd64/bin/java: symbol lookup error: /home/vlad/workspace/HelloJNI/jni/libRecognizer.so: undefined symbol: _ZN2cv24createLBPHFaceRecognizerEiiiid My makefile looks like this: # Define a variable for classpath CLASS_PATH = ../bin # Define a virtual path for .class in the bin directory vpath %.class $(CLASS_PATH) all : libRecognizer.so # $@ matches the target, $&lt; matches the first dependancy libRecognizer.so : facerec.cpp g++ -fPIC -o $@ -shared -Wl,-rpath, -I"/usr/lib/jvm/java-7-openjdk-amd64/include" -I"/usr/lib/jvm/java-7-openjdk-amd64/include/linux" $&lt; #cc -fPIC -I"/usr/lib/jvm/java-7-openjdk-amd64/include" -I"/usr/lib/jvm/java-7-openjdk-amd64/include/linux" -Wl, -shared -o $@ # $@ matches the target, $&lt; matches the first dependancy #HelloJNI.o : HelloJNI.c HelloJNI.h # gcc -m64 -I"/usr/lib/jvm/java-7-openjdk-amd64/include" -I"/usr/lib/jvm/java-7-openjdk-amd64/include/linux" -c $&lt; -o $@ # $* matches the target filename without the extension LBPHFaceRecognizer.h : LBPHFaceRecognizer.class javah -classpath $(CLASS_PATH):../jni/opencv-249.jar $* clean : rm LBPHFaceRecognizer.h LBPHFaceRecognizer.o libRecognizer.so I tried "ldd" and "libopencv_java249.so" seems to be there: vlad@woow-1022:~/workspace/HelloJNI/jni$ ldd libRecognizer.so linux-vdso.so.1 =&gt; (0x00007fff969fe000) /home/vlad/workspace/HelloJNI/jni/libopencv_java249.so (0x00007fb24797a000) libstdc++.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fb247658000) libgcc_s.so.1 =&gt; /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fb247441000) libdl.so.2 =&gt; /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb24723d000) libpthread.so.0 =&gt; /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb24701f000) librt.so.1 =&gt; /lib/x86_64-linux-gnu/libr…
score: 0
has comment: http://stackoverflow.com/comment/40241521
answer count: 1
tagged with: opencv

http://stackoverflow.com/q/25845280
has comment: http://stackoverflow.com/comment/40438181
accepted answer: http://stackoverflow.com/a/25845298
tagged with: garbage-collection
upvote count: 1
has answer: http://stackoverflow.com/a/25845300
linked to: http://stackoverflow.com/q/850878
tagged with: java
duplicate of: http://stackoverflow.com/q/850878
possible better answer: http://stackoverflow.com/a/25845300
answer count: 2
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/25845298
has title: Do I need to set local variables to NULL after usage
favorite count: 0
type: Question
has body: Do I need to set local variables to null after usage , for garbage collector, to collect those local variables ?

http://stackoverflow.com/a/25748838
score: 1
has body: Integer/Integer is an Integer which is casted to a Double so ,it remains an Integer expanded to a Double. Change it to tf = ( (double)word.getValue() / noOfTerms );
upvote count: 1
answers question: http://stackoverflow.com/q/25748763
type: Answer
downvote count: 0

http://stackoverflow.com/a/25835023
accepted answer of: http://stackoverflow.com/q/25834844
answers question: http://stackoverflow.com/q/25834844
score: 0
type: AcceptedAnswer
has body: Ok, well JB Nizet answered it pretty easily, but here is the code I used: public class Data2DFrame extends JFrame{ public Data2DFrame(Data2D data2D,double min,double max,Data2DColorMap data2DColorMap) { // Set image if data is nonempty if (data2D.height &gt; 0 &amp;&amp; data2D.width &gt; 0) { // Set data panel Data2DPanel data2DPanel = new Data2DPanel(data2D,min,max,data2DColorMap); data2DPanel.toggleKeyBoard(); // Allow keyboard interaction data2DPanel.toggleMouse(); // Allow mouse interaction // data2DPanel.setPreferredSize(new Dimension(data2D.width,data2D.height)); // Set colorbar Data2DColorBar data2DColorBar = new Data2DColorBar(min,max,data2DColorMap); // data2DColorBar.setPreferredSize(new Dimension(100,data2D.height)); // Arrange this.setLayout(new BorderLayout()); this.add(data2DPanel,BorderLayout.CENTER); this.add(data2DColorBar,BorderLayout.LINE_END); this.pack(); } } }
type: Answer

http://stackoverflow.com/comment/40444138
has text: Classes are alwyas shared but they are stateless. It is instances of class which you share state across threads.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25847219
type: Comment

http://stackoverflow.com/comment/40466071
comment on: http://stackoverflow.com/q/25860502
has text: @SamDJava i'm running an exponential alg. and I don't think I made a mistake on the logic.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40479829
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25865735
has text: True, if that is important then the first task will have to schedule the next one. It doesn't say 20 sec after the last one "completed" though, so that is ambiguous (Also, it will clutter the tasks)

http://stackoverflow.com/q/25717476
linked to: http://stackoverflow.com/q/19803332
has comment: http://stackoverflow.com/comment/40206592
has body: I have developed an SWT application on windows and when i try it MAC OS X Mavericks , the SWT menu bar behaves strangely.It does not show up immediately.But if i minimize the app,click somewhere on the desktop and maximize the app,the menu works perfectly.How do i fix this weird behaviour? PS: I have already seen this Eclipse menus disabled on OS X 10.9 Beta 6 and it dint solve my issue. A part of my code looks like this public class Dummy2 { public static void main(String args[]) { Display display= new Display(); Shell shell= new Shell(); Menu bar= new Menu(shell,SWT.BAR); shell.setMenuBar(bar); MenuItem fileitem=new MenuItem(bar,SWT.CASCADE); MenuItem edititem=new MenuItem(bar,SWT.CASCADE); MenuItem helpitem=new MenuItem(bar,SWT.CASCADE); fileitem.setText("File"); edititem.setText("Edit"); helpitem.setText("Help"); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }
tagged with: macos
has comment: http://stackoverflow.com/comment/40207477
linked to: http://stackoverflow.com/q/18383381
answer count: 0
type: UnansweredQuestion
score: 0
tagged with: swt
has title: Menu bar behaving strangely on MAC
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/40451388
type: QuestionComment
comment on: http://stackoverflow.com/q/25852516
score: 0
type: Comment
has text: @njzk2 actually, _that_ wouldn't compile... `Integer i = null; int[x] = i` would throw an NPE.

http://stackoverflow.com/a/25815835
upvote count: 1
has body: You have to use: @UiField (provided = true) SuggestBox actorSuggestBox = new SuggestBox(new CustomSuggestOracle()); You need to initialize this widget before you call the binder (createAndBindUi).
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25815500
type: Answer
answers question: http://stackoverflow.com/q/25815500
score: 1

http://stackoverflow.com/comment/40332615
comment on: http://stackoverflow.com/q/25788055
score: 0
has text: yes, read the doc : http://developer.android.com/guide/webapps/webview.html
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40255345
type: QuestionComment
score: 0
has text: This is probably best handled through Mathworks support.
comment on: http://stackoverflow.com/q/25719867
type: Comment

http://stackoverflow.com/q/25811901
tagged with: java
has title: Cropping Images in Java
type: Question
has comment: http://stackoverflow.com/comment/40376722
has answer: http://stackoverflow.com/a/25812152
score: -1
tagged with: crop
tagged with: image
has answer: http://stackoverflow.com/a/25812072
answer count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/40376515
upvote count: 1
has comment: http://stackoverflow.com/comment/40377173
has comment: http://stackoverflow.com/comment/40376849
favorite count: 0
has body: I am trying to build a code for OMR recognition using Java. I am facing a problem when the objects in the scanned image do not have the same positions as the template Image I use. To solve this I decided to place borders in the Image and when I cut out the Image using the borders, I can get proper values. Now for this I have been cutting out the Images manually, but I want to cut the Images using Java as well. I know that I can get a rectangular selection from the CropImageFilter class. But how can I let the program know the point from where it needs to begin? Can anyone help me out with this?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40377253

http://stackoverflow.com/comment/40407202
has text: I think you must register an `BroadcastReceiver` to listen when `Wifi` is connected. I'll include some code to help you to start this. Wait a minute.
type: AnswerComment
comment on: http://stackoverflow.com/a/25828381
type: Comment
score: 0

http://stackoverflow.com/comment/40417513
type: QuestionComment
type: Comment
score: 5
has text: Just a point of English usage -- if and else blocks are not "loops" since they don't in fact control a loop as for loops or while loops do. You can call them control blocks or something else, but you'll not want to call them loops. There, I'm done.
comment on: http://stackoverflow.com/q/25834251

http://stackoverflow.com/a/25730848
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/25730571
type: Answer
has body: Batch files alone can't be executed. They need an application to run them. In your case, that application is cmd.exe. Windows Explorer takes care of this when you run a batch by clicking on it. Java doesn't have this luxury. Runtime.getRuntime().exec("cmd /c start HelloWorld.bat"); // * Another similar command that anyone reading this would be familiar with is: java HelloWorld.java Notice how you had to specify which application you wanted to use to run this file? Typing the file name, HelloWorld.java, all by itself would not accomplish much. *The /c switch puts the output in a new window which terminates when the batch file has completed.
score: 2

http://stackoverflow.com/a/25738186
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/42669824
has comment: http://stackoverflow.com/comment/40243222
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/42655037
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25737992
has body: Will the CronTriggerFactoryBean.setCronExpression() method work?
answers question: http://stackoverflow.com/q/25737992

http://stackoverflow.com/a/25807931
type: Answer
has body: I used Glassfish Metro and Netbeans to consume a similar service. There is a good guide here: https://metro.java.net/1.5/guide/Creating_a_Client_to_Consume_a_WSIT_Enabled_Web_Service.html After creating the web service client you can see it in Web Service References folder, right click on it and select "Edit Web Service Attributes...". In the popup you can enter your login details. In the servlet you can use the code you wrote for accessing Person.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25783137
upvote count: 1
has comment: http://stackoverflow.com/comment/40397300

http://stackoverflow.com/q/25798308
tagged with: jersey
answer count: 1
has body: Here is my test final Client client = Client.create(); final WebResource webResource = client.resource(ORDER_API); final MultivaluedMap<String, String> formData = new MultivaluedMapImpl(); formData.add("name", "Autobot-00"); formData.add("resExpiryKey", "19000"); final ClientResponse response = webResource.type(MediaType.APPLICATION_JSON) .header("Content-Type", MediaType.APPLICATION_JSON).post(ClientResponse.class, formData); assertEquals(response.getStatus(), 200); and my pom.xml looks like com.sun.jersey jersey-client 1.18.1 test When I run the test, I see the following com.sun.jersey.api.client.ClientHandlerException: com.sun.jersey.api.client.ClientHandlerException: A message body writer for Java type, class com.sun.jersey.core.util.MultivaluedMapImpl, and MIME media type, application/json, was not found at com.sun.jersey.client.urlconnection.URLConnectionClientHandler.handle(URLConnectionClientHandler.java:155) at com.sun.jersey.api.client.Client.handle(Client.java:652) at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682) at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74) at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570) What is missing?
score: 0
has answer: http://stackoverflow.com/a/29857321
type: UnansweredQuestion
has title: class com.sun.jersey.core.util.MultivaluedMapImpl, and MIME media type, application/json, was not found
tagged with: maven
type: Question
tagged with: java
tagged with: http://stackoverflow.com/tag/json

http://stackoverflow.com/a/58670520
type: Answer
has body: int selectedRadioButtonID = radio_group.getCheckedRadioButtonId(); // If nothing is selected from Radio Group, then it return -1 if (selectedRadioButtonID != -1) { RadioButton selectedRadioButton = findViewById(selectedRadioButtonID); String selectedRadioButtonText = selectedRadioButton.getText().toString(); answerList.add(selectedRadioButtonText); } else { Toast.makeText(this, "select radio button", Toast.LENGTH_SHORT).show(); return false; } For Deatils, check this
answers question: http://stackoverflow.com/q/25824786
score: 0

http://stackoverflow.com/comment/61268393
score: 0
type: QuestionComment
type: Comment
has text: Possible duplicate of [Using gson, how to exclude a numeric type (double, integer) with default value from serialization?](http://stackoverflow.com/questions/5316787/using-gson-how-to-exclude-a-numeric-type-double-integer-with-default-value-f)
comment on: http://stackoverflow.com/q/25804952

http://stackoverflow.com/a/25790043
has comment: http://stackoverflow.com/comment/40336465
has comment: http://stackoverflow.com/comment/40336854
has comment: http://stackoverflow.com/comment/40338968
type: Answer
has comment: http://stackoverflow.com/comment/40339195
upvote count: 3
has comment: http://stackoverflow.com/comment/40337075
has comment: http://stackoverflow.com/comment/40337622
score: 3
accepted answer of: http://stackoverflow.com/q/25789930
has body: For loop should be &lt; not &lt;=. System.out.println("Even Numbers"); for (int i=0; i &lt; arr.length;i++){ if((arr[i] % 2) == 0) { System.out.println(arr[i]); } } System.out.println("Odd Numbers"); for (int i=0; i &lt; arr.length;i++){ if((arr[i] % 2) != 0) { System.out.println(arr[i]); } } ArrayList&lt;Integer&gt; array = new ArrayList&lt;Integer&gt;(); int[] intArray; Scanner scanner = new Scanner(System.in); int a = 0; while(a != -1) { System.out.println("Please enter an integer -1 to quit: "); a = scanner.nextInt(); if(a != -1) { array.add(a); } } intArray = new int[array.size()]; for(int i = 0; i &lt; array.size(); i++) { intArray[i] = array.get(i); } for(int b = 0; b &lt; intArray.length; b++) { System.out.println("Integer" + b + ": " + intArray[b]); } Put this code in your main method and execute. I hope this helps you with your problem.
has comment: http://stackoverflow.com/comment/40339515
has comment: http://stackoverflow.com/comment/40338493
answers question: http://stackoverflow.com/q/25789930
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40215877
type: AnswerComment
has text: edited my answer. hope I helped :)
type: Comment
comment on: http://stackoverflow.com/a/25722153
score: 0

http://stackoverflow.com/tag/pdf
tags question: http://stackoverflow.com/q/25746560
tags question: http://stackoverflow.com/q/25780301
type: Tag
tag name: pdf
tags question: http://stackoverflow.com/q/25809298
tags question: http://stackoverflow.com/q/25789094
tags question: http://stackoverflow.com/q/25805136
tags question: http://stackoverflow.com/q/25763640
tags question: http://stackoverflow.com/q/25781927
tags question: http://stackoverflow.com/q/25847016
tags question: http://stackoverflow.com/q/25852042
tags question: http://stackoverflow.com/q/25766536
tags question: http://stackoverflow.com/q/25734138
tags question: http://stackoverflow.com/q/25780258
tags question: http://stackoverflow.com/q/25721190

http://stackoverflow.com/comment/40318688
type: Comment
has text: That depends on your installer you are using. Look for options to create env vars during installation. and set it's value to app directory or path that the Installer must be providing you
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25779894

http://stackoverflow.com/comment/40495364
has text: It would be better to ask on android developer tools g+ page or create issue in their issues tracker.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25872159

http://stackoverflow.com/q/25838241
answer count: 2
downvote count: 0
favorite count: 0
tagged with: groovy
has body: I'm essentially trying to create a CLI with Groovy. I have a whole JavaFX GUI set up in Java and I want to be able to type in groovy script to run different functions inside a groovy script. For example, say I have this script: void meow() { println "walrus" } I want to be able to type in "meow();" and press enter and evaluate it using the script as a reference. I've tried using shell.evaluate(inputStr, "src/Server/Scripting/CommandLineScript.groovy"); but to no avail; it just comes up with the error: groovy.lang.MissingMethodException: No signature of method: CommandLineScript.meow() is applicable for argument types: () values: [] I can call other standard functions, such as: shell.evaluate("println 'Hello World!';"); but I just can't run my own methods... How to solve it?
has answer: http://stackoverflow.com/a/25855547
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25855629
tagged with: command-line-interface
tagged with: groovyshell
type: Question
has title: How do I evaluate a Groovy string within a script?

http://stackoverflow.com/q/25716906
has comment: http://stackoverflow.com/comment/40202796
has comment: http://stackoverflow.com/comment/40203908
favorite count: 0
tagged with: android
downvote count: 1
type: AnsweredQuestion
upvote count: 0
tagged with: android-broadcast
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/25718335
has comment: http://stackoverflow.com/comment/40203427
type: Question
possible better answer: http://stackoverflow.com/a/25717176
tagged with: android-fragments
has body: in my newInstance i am going to create a thread then copy a file from a external storage in to internal storage and processing on it. after that i want to inform my fragment to update. how can i do this? first: there is no context so i can not call broadcast inside my thread. second: there is no activity yet getActivity is null because onCreate method has not been called, so runOnUiThread dose not work. public class PageFragment extends Fragment { public static PageFragment newInstance(int pageNumber){ Bundle args = new Bundle(); args.putInt(EXTRA_PAGENUMBER, pageNumber); PageFragment fragment = new PageFragment(); fragment.setArguments(args); new Thread(new Runnable() { @Override public void run() { // call fragment to update }).start(); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } }
tagged with: java
has answer: http://stackoverflow.com/a/25717176
score: -1
has answer: http://stackoverflow.com/a/25718335
answer count: 2
has title: how to update my fragment from a thread in newInstance function?

http://stackoverflow.com/comment/40204671
has text: the values are indeed being changed to what i want, so the if statements are irrelevant in this case. also postInvalidate() did not work :(
comment on: http://stackoverflow.com/a/25718132
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40482631
type: Comment
comment on: http://stackoverflow.com/q/25869837
score: 0
type: QuestionComment
has text: @Joffrey In some sense it is correct answer. AtomicReference is part of Java and is a reference. And you can pass it. So formally you can pass something by reference :)

http://stackoverflow.com/comment/40510936
type: Comment
has text: Thanks for the quick response, @nmore! Hopefully I'm not making a fool of myself here, but it looks to me like consecutiveVowels only resets if it encounters a consonant. So when we start checking a new word, consecutiveVowels isn't necessarily 0. If consecutiveVowels is always 0 at the start of a new word, why would we need the +consecutiveVowels part of i < word.length() - maxConsecutiveVowels + consecutiveVowels;? Otherwise, your explanation makes complete sense, thanks!
score: 0
comment on: http://stackoverflow.com/a/25859256
type: AnswerComment

http://stackoverflow.com/comment/40201016
comment on: http://stackoverflow.com/a/25716154
type: Comment
has text: @PatrickWMcMahon Please read what I wrote, ***again.*** I said *'data members'.* Getters and setters are not data, and they are not serialized. Your question doesn't even make sense. Getters and setters for instance data members cannot be static in the first place.
score: 1
type: AnswerComment

http://stackoverflow.com/q/25760676
answer count: 1
has body: I need to use this function, java.io.File.File(File dir, String name) public File (File dir, String name) Added in API level 1 Constructs a new file using the specified directory and name. Parameters dir the directory where the file is stored. name the file's name. Throws NullPointerException if name is null. Now as we can see it needs file dir and name as parameters. Now I am selecting an Image from gallery by intent. How can I get the dir and name for the selected file.? Here is the snippet: public File String_to_File(String img_url) { try { File rootSdDirectory = Environment.getExternalStorageDirectory(); --------------------------------------------------------------------------------------- **casted_image = new File(rootSdDirectory, "attachment.jpg");** --------------------------------------------------------------------------------------- if (casted_image.exists()) { casted_image.delete(); } casted_image.createNewFile(); FileOutputStream fos = new FileOutputStream(casted_image); URL url = new URL(img_url); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setRequestMethod("GET"); connection.setDoOutput(true); connection.connect(); InputStream in = connection.getInputStream(); byte [ ] buffer = new byte [1024]; int size = 0; while ((size = in.read(buffer)) &gt; 0) { fos.write(buffer, 0, size); } fos.close(); return casted_image; } catch (Exception e) { System.out.print(e); // e.printStackTrace(); } return casted_image; } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) { Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); St…
score: 0
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/40283427
has comment: http://stackoverflow.com/comment/40283381
type: UnansweredQuestion
has title: How to get Directory and file name of an image selected from gallery
has answer: http://stackoverflow.com/a/25761233
tagged with: dir
type: Question
tagged with: android
tagged with: path

http://stackoverflow.com/q/25752210
has body: I use AsyncTask in my App for download a url. I use a ProgressDialog on onPreExecute() for waiting. But I cant see ProgressDialog while process finish and i see it for a moment. want to see it while downloading not after that. can any one help me. thanks my code is like this: private class loadMoreListView extends AsyncTask&lt;Void, Void, Void&gt; { @Override protected void onPreExecute() { // Showing progress dialog before sending http request pDialog = new ProgressDialog(SingleMenuItemActivity.this); pDialog.setMessage("Please Wait ..."); pDialog.isIndeterminate(); pDialog.setCancelable(false); pDialog.show(); } protected Void doInBackground(Void... unused) { runOnUiThread(new Runnable() { public void run() { // do something for downloading } }); return (null); } protected void onPostExecute(Void unused) { // closing progress dialog pDialog.dismiss(); } }
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25752984
has answer: http://stackoverflow.com/a/25752553
has comment: http://stackoverflow.com/comment/40268460
tagged with: java
tagged with: progressdialog
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25752553
tagged with: android-asynctask
type: Question
has title: Can't see ProgressDialog while AsyncTask run in background
possible better answer: http://stackoverflow.com/a/25752381
tagged with: android
has answer: http://stackoverflow.com/a/25752381

http://stackoverflow.com/comment/40399516
comment on: http://stackoverflow.com/q/25820706
score: 0
type: Comment
type: QuestionComment
has text: Can you provide more details about how you are calling RapidMiner from Java?

http://stackoverflow.com/q/25804948
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40366718
has body: JBoss will not start with my current configuration. I receive the error: Error occurred during initialization of VM Could not reserve enough space for object heap Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Press any key to continue . . . The JAVA_OPTS being used by JBoss are: -client -Dprogram.name=standalone.bat -Xms128 -Xmx2G -XX:MaxPermSize=256M -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Xms1024m -Xmx2048m -XX:PermSize=32m -XX:MaxPermSize=512m -Xss2m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -Djavax.xml.soap.MessageFactory=org.apache.axis.soap.MessageFactoryImpl -Djavax.xml.soap.SOAPConnectionFactory=org.apache.axis.soap.SOAPConnectionFactor‌​yImpl -Djavax.xml.soap.SOAPFactory=org.apache.axis.soap.SOAPFactoryImpl"
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25807261
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25807498
has answer: http://stackoverflow.com/a/25805431
has comment: http://stackoverflow.com/comment/40367402
linked to: http://stackoverflow.com/q/9519315
tagged with: jboss6.x
has title: JBoss6 fails to start on Windows (32bit) machine with JDK 7
possible better answer: http://stackoverflow.com/a/25807498
answer count: 3
tagged with: java-7
downvote count: 0
tagged with: jvm-arguments
favorite count: 0
has comment: http://stackoverflow.com/comment/40366670
has comment: http://stackoverflow.com/comment/40365984
has answer: http://stackoverflow.com/a/25807261

http://stackoverflow.com/q/25824764
accepted answer: http://stackoverflow.com/a/25824868
score: 20
answer count: 3
upvote count: 20
has answer: http://stackoverflow.com/a/25824792
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25824792
has title: Java compare integer and bigInteger
has answer: http://stackoverflow.com/a/25824833
has comment: http://stackoverflow.com/comment/40400238
tagged with: bigint
tagged with: biginteger
tagged with: java
has comment: http://stackoverflow.com/comment/40400439
type: Question
has answer: http://stackoverflow.com/a/25824868
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40400453
has body: How do I compare an int with a BigInteger in Java? I specifically need the know if an int is less than a BigInteger. Here is the code I am using: private static BigInteger two = new BigInteger("2"); private static BigInteger three = new BigInteger("3"); private static BigInteger zero = new BigInteger("0"); public static BigInteger bigIntSqRootCeil(BigInteger x) throws IllegalArgumentException { if (x.compareTo(BigInteger.ZERO) &lt; 0) { throw new IllegalArgumentException("Negative argument."); } if (x == BigInteger.ZERO || x == BigInteger.ONE) { return x; } BigInteger two = BigInteger.valueOf(2L); BigInteger y; for (y = x.divide(two); y.compareTo(x.divide(y)) &gt; 0; y = ((x.divide(y)).add(y)).divide(two)); if (x.compareTo(y.multiply(y)) == 0) { return y; } else { return y.add(BigInteger.ONE); } } private static boolean isPrimeBig(BigInteger n){ if (n.mod(two) == zero) return (n.equals(two)); if (n.mod(three) == zero) return (n.equals(three)); BigInteger m = bigIntSqRootCeil(n); for (int i = 5; i &lt;= m; i += 6) { if (n.mod(BigInteger.valueOf(i)) == zero) return false; if(n.mod(BigInteger.valueOf(i + 2)) == zero) return false; }; return true; }; Thanks.

http://stackoverflow.com/q/25716974
has body: So I am pretty stuck. I have some code that is being using inside my main method which needs to override the given methods and print out a statement. I got the statement in offer(E s) to work, but can't seem to get the statements in peek() and size() to print. They are functioning properly, but the statements "Peeking at list" and "Reporting list size" just won't print in their methods. If some people can shed some light it would be greatly appreciated! The main is located in a separate file import java.io.*; import java.util.*; import java.awt.*; //for Point public class StudentList&lt;E&gt;extends LinkedList&lt;E&gt; { public boolean offer(E s) { super.offer(s); System.out.println("Offering "+ s); return true; } public boolean contains(Object o) { super.contains(o); return false; } public E peek(E slist){ super.peek(); System.out.println("Peeking at list") ; return slist; } public int size(Integer ilist){ System.out.println("Reporting list size"); size(ilist); //System.out.println("Reporting list size"); return ilist; } } Here is the main method: public class OfferDriver { public static void main ( String[] args) { StudentList&lt;Integer&gt; ilist = new StudentList&lt;Integer&gt;( ); StudentList&lt;String&gt; slist = new StudentList&lt;String&gt;( ); String s; Integer i; Scanner in = new Scanner(System.in); System.out.print("Please enter a word to offer (\"stop\" to stop):\t"); while (in.hasNext()) { s = in.next(); if (s.equalsIgnoreCase("stop")) { break; } slist.offer(s); System.out.println("Size is: " + slist.size()); System.out.print("Please enter a word to offer (\"stop\" to stop):\t"); } System.out.println("\n" + slist); String si = slist.peek(); System.out.println("Testing peek(): " + si); System.out.print("Please enter an integer to offer (&lt;any word&gt; to stop):\t"); while (in.hasNextInt()) { i = in.nextInt(); ilist.offer(i); System.out.println("Size is: " + ilist.size()); System.out.print("Please enter an integer to offer (&lt;any word&gt; to stop):\t"…
tagged with: java
has answer: http://stackoverflow.com/a/25717785
type: Question
tagged with: inheritance
has title: Print statements inside overridden methods not appearing
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25716994
has answer: http://stackoverflow.com/a/25717010
type: UnansweredQuestion

http://stackoverflow.com/a/25733967
score: 1
has body: Usually for UI rendering Formatter&lt;T&gt; is used with ConversionService. But prior to Spring 3, PropertyEditors were used. I've shared sample github project for your case https://github.com/jama707/SpringSelectBoxSample @Component("courseFormatter") public class CourseFormatter implements Formatter&lt;Course&gt; { private CourseRepository courseRepository=new CourseRepository(); @Override public String print(Course course, Locale arg1) { return course.getName(); } @Override public Course parse(String actorId, Locale arg1) { return courseRepository.getCourse(actorId); } }
accepted answer of: http://stackoverflow.com/q/25731951
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25731951

http://stackoverflow.com/q/25808548
linked to: http://stackoverflow.com/q/19551984
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: Struts2 not able to retrieve contained Object used as an attribute in action class
type: Question
tagged with: struts2
upvote count: 1
has body: Hi I have created an action class "MyClass" in Struts2 and i want to fetch its instance variable "validationResult" in my jsp file but i am getting null though another instance variable "version" is getting populated.When I am displaying their contents using <s:iterator> tag it is displaying the contents of instance variable "validationResult" also. Action Class package my.com; public class MyClass extends ActionSupport{ private String version; private List<VersionTO> validationResult; @Override public String execute() throws Exception { validationResult=Arrays.asList(new VersionTO ("abc","def","ghi","jkl"), new VersionTO("mno","pqr","stu","vwx")); version="212"; return SUCCESS; } public String getVersion() { return Version; } public void setVersion(String version) { this.version = version; } public List<VersionTO> getValidationResult() { return validationResult; } public void setValidationResult(List<VersionTO> validationResult) { this.validationResult = validationResult; } } Bean pack my.be; public class VersionTO { private String server; private String version; private String versionOn; private String compared; public VersionTO() { super(); } public VersionTO(String server, String version, String versionOn, String compared) { this.server = server; this.version = version; this.versionOn = versionOn; this.compared = compared; } public String getServer() { return server; } public void setServer(String server) { this.server = server; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public String getVersionOn() { return versionOn; } public void setVersionOn(String versionOn) { this.versionOn = versionOn; } public String getCompared() { return compared; } public void setCompared(String compared) { this.comparedVersion = compared; } } JSP <jsp:useBean id="ver" class="MyClass" scope="page"> <jsp:setProperty name="ver" property="*" /> </jsp:useBean> <jsp:getProperty name="ver" property="vdVersion"/> <jsp:g…
answer count: 1
has answer: http://stackoverflow.com/a/25808598
accepted answer: http://stackoverflow.com/a/25808598
tagged with: jsp
favorite count: 0

http://stackoverflow.com/q/25796118
type: AnsweredQuestion
has body: I thought that the stream API was here to make the code easier to read. I found something quite annoying. The Stream interface extends the java.lang.AutoCloseable interface. So if you want to correctly close your streams, you have to use try with resources. Listing 1. Not very nice, streams are not closed. public void noTryWithResource() { Set&lt;Integer&gt; photos = new HashSet&lt;Integer&gt;(Arrays.asList(1, 2, 3)); @SuppressWarnings("resource") List&lt;ImageView&gt; collect = photos.stream() .map(photo -&gt; new ImageView(new Image(String.valueOf(photo)))) .collect(Collectors.&lt;ImageView&gt;toList()); } Listing 2. With 2 nested try public void tryWithResource() { Set&lt;Integer&gt; photos = new HashSet&lt;Integer&gt;(Arrays.asList(1, 2, 3)); try (Stream&lt;Integer&gt; stream = photos.stream()) { try (Stream&lt;ImageView&gt; map = stream .map(photo -&gt; new ImageView(new Image(String.valueOf(photo))))) { List&lt;ImageView&gt; collect = map.collect(Collectors.&lt;ImageView&gt;toList()); } } } Listing 3. As map returns a stream, both the stream() and the map() functions have to be closed. public void tryWithResource2() { Set&lt;Integer&gt; photos = new HashSet&lt;Integer&gt;(Arrays.asList(1, 2, 3)); try (Stream&lt;Integer&gt; stream = photos.stream(); Stream&lt;ImageView&gt; map = stream.map(photo -&gt; new ImageView(new Image(String.valueOf(photo))))) { List&lt;ImageView&gt; collect = map.collect(Collectors.&lt;ImageView&gt;toList()); } } The example I give does not make any sense. I replaced Path to jpg images with Integer, for the sake of the example. But don't let you distract by these details. What is the best way to go around with those auto closable streams. I have to say I'm not satisfied with any of the 3 options I showed. What do you think? Are there yet other more elegant solutions?
has answer: http://stackoverflow.com/a/35012785
linked to: http://stackoverflow.com/q/22125169
tagged with: java-stream
has title: Java 8 Streams and try with resources
tagged with: java
possible better answer: http://stackoverflow.com/a/25796264
linked to: http://stackoverflow.com/q/22921623
type: Question
has answer: http://stackoverflow.com/a/25796264
has comment: http://stackoverflow.com/comment/40348653
accepted answer: http://stackoverflow.com/a/25840780
downvote count: 0
score: 32
has comment: http://stackoverflow.com/comment/40348604
upvote count: 32
favorite count: 0
has answer: http://stackoverflow.com/a/25804551
has answer: http://stackoverflow.com/a/25840780
tagged with: java-8
answer count: 4

http://stackoverflow.com/a/25795025
answers question: http://stackoverflow.com/q/25794908
score: 1
has body: You could use str.indexOf("string", str.indexOf("string") + 1); instead of your offset, and still use your substring to replace it.
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/q/25872895
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25872896
has title: IntelliJ gets stuck on "Copying resources"
upvote count: 6
accepted answer: http://stackoverflow.com/a/25872896
has body: Had a problem trying to debug a Java application that I had using IntelliJ IDEA 13. When attempting debugging, it would get stuck in the make process, displaying "Copying resources" indefinitely.
score: 6
has answer: http://stackoverflow.com/a/58628654
linked to: http://stackoverflow.com/q/57759901
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/58628654
tagged with: java
type: Question
answer count: 2
tagged with: intellij-idea

http://stackoverflow.com/q/25828614
tagged with: javascript
has comment: http://stackoverflow.com/comment/40407571
score: 0
has comment: http://stackoverflow.com/comment/40407362
tagged with: restful-architecture
has title: How to Generate HTML5 Markup from a RESTful Web Service?
tagged with: rest
type: UnansweredQuestion
has body: I am somewhat new to javascript. Is there a common technique, best practice, javascript library/framework etc for converting JSON data from REST web services into HTML5 markup? I am building a web application that uses a HTML5/Javascript page to consume JSON from RESTful web services (written in Java). It will be a single-page web app that I want to inject additional HTML5 controls into, depending on the actions that the user performs on the page. I am not writing several HTML5 templates and simply injecting JSON data into the controls, which seems to be one of the more common techniques out there, but instead generating HTML5 markup on the fly. I am doing this because there are a large amount of variations in HTML5 control types and positioning that I want to occur in the web app due to the interactions and data involved. So, more specifically, something like this: My Web App At the moment I can only think of two ways to do what I want to do: Send JSON straight to the page, and write Javascript (or use a library) to generate the HTML5 markup based on the JSON data Send the HTML5 markup straight to the page, letting the web service do all the HTML5 conversion (perhaps with slower performance due to markup being transferred across the network?) Thanks for the feedback.
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/40407356
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40407386
type: Question

http://stackoverflow.com/q/25758161
has comment: http://stackoverflow.com/comment/40279104
has body: After deploying my war on my server I get the following error, org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632) at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073) at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1857) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NoClassDefFoundError: org/apache/commons/beanutils/Converter at java.lang.Class.getDeclaredFields0(Native Method) at java.lang.Class.privateGetDeclaredFields(Class.java:2436) at java.lang.Class.getDeclaredFields(Class.java:1806) at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106) at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:261) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:140) at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65) at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:400) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:876) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:371) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apac…
has comment: http://stackoverflow.com/comment/40279218
score: 0
has comment: http://stackoverflow.com/comment/40279058
tagged with: apache
has title: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]
answer count: 1
tagged with: lifecycleexception
has answer: http://stackoverflow.com/a/25758359
has comment: http://stackoverflow.com/comment/40279007
has comment: http://stackoverflow.com/comment/40289726
has comment: http://stackoverflow.com/comment/40278972
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40279171
has comment: http://stackoverflow.com/comment/40278969
has comment: http://stackoverflow.com/comment/40279199
has comment: http://stackoverflow.com/comment/40280050
type: Question
tagged with: java

http://stackoverflow.com/a/25896369
type: Answer
accepted answer of: http://stackoverflow.com/q/25844868
answers question: http://stackoverflow.com/q/25844868
has comment: http://stackoverflow.com/comment/40583736
type: AcceptedAnswer
score: 0
has body: Your server.xml should look more like this &lt;Connector address="${OPENSHIFT_JBOSSEWS_IP}" port="${OPENSHIFT_JBOSSEWS_HTTP_PORT}" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /&gt; However I would suggest going over this article instead for Tomcat applications on OpenShift https://developers.openshift.com/en/tomcat-overview.html.

http://stackoverflow.com/comment/40321254
score: 0
has text: Ooh.. that's strange, even I couldnt see any issues which causes this problem unless you are passing some dates which doesnt have any data in db. You can add `@Type(type="date")` to your date fields once and check.
comment on: http://stackoverflow.com/q/25780996
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40450909
type: QuestionComment
type: Comment
has text: your best bet would be to initialize an array and store all the user guesses in it. Create a loop with couple of conditions (1. when the number entered matches a previous entered number and 2. if the entered number does not match the random number) that will cycle through the whole array.
comment on: http://stackoverflow.com/q/25852163
score: 0

http://stackoverflow.com/comment/40369383
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25805470
score: 0
has text: `I wanted to make it a bit fresher and use annotations mapping` you should then drop all the old XML configuration, and put the annotations wherever needed. Convention otherwise will scan each action, not only the annotated ones, and messing the configuration.

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/25867178
tag name: ksoap2

http://stackoverflow.com/comment/40391777
comment on: http://stackoverflow.com/q/25819745
type: Comment
has text: This could help you http://docs.oracle.com/javase/tutorial/uiswing/painting/step2.html
type: QuestionComment
score: 1

http://stackoverflow.com/comment/40291068
type: QuestionComment
has text: if you can't change your cron job not to halt, then your process should move the file somewhere else before processing, I think
comment on: http://stackoverflow.com/q/25765114
score: 1
type: Comment

http://stackoverflow.com/comment/40453296
type: Comment
has text: By exact vs. approximate I mean that if the locations can be estimated to within some small fraction that would be good enough. i.e. I'd love to know that X is at [4,5] but if I can tell that it's within a circle of radius 0.001 centered at [4,5] then that's sufficient. The points are static once placed. My original train of thought was to place A at [0,0] and X at [0,AX] to get a basic frame of reference. After that we know that B must be on or inside a circle centered at X with radius BX. From there I'm not sure where to go, or if it's even possible without knowing at least one Y.
comment on: http://stackoverflow.com/a/25852037
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40382639
has text: Like this: "user_ids"=>"[I@4210c9d0"}
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25814448
score: 0

http://stackoverflow.com/a/25723352
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40244744
has body: I think that the problem is here: } catch (IOException ioe) { Timber.d(ioe, "IOException"); } The problem is that one of the subtypes of IOException is ... InterruptedIOException. And when that exception is thrown (in response to an interrupt), the thread's interrupted flag is cleared. Now it is "pretty unlikely" that this code is going to be interrupted in the middle of a send call. But if it does, then you will effectively "eat" an interrupt. I think you should change the above to: } catch (InterruptedIOException ioe) { Thread.currentThread().interrupt(); } catch (IOException ioe) { Timber.d(ioe, "IOException"); } In addition, if are going to test the interrupt flag later on, you are also "eating" it when you catch InterruptedException at the end of the snippet, and you should set it again ... as above.
accepted answer of: http://stackoverflow.com/q/25722710
type: Answer
has comment: http://stackoverflow.com/comment/40243319
answers question: http://stackoverflow.com/q/25722710
score: 1

http://stackoverflow.com/a/31765308
type: Answer
answers question: http://stackoverflow.com/q/25763155
score: 0
has body: How about doing it in the @Query itself? Something like: @Query("select new com.my.dto(e.name, e.age, e.address)" + " from Entity e" + "where e.name like ?1 " + "and e.age like ?2 " + "and e.street like (CASE WHEN ?3 IS NULL THEN '%' ELSE ?3 END)") List&lt;Item&gt; findItemsFiltered(String name, String age, String street); Another way would be to have a custom parameter annotation like @Default but that would require customizing the repository implementation itself I believe. Another alternative is the Specification as M. Deinum mentioned.

http://stackoverflow.com/comment/40210257
has text: Object oriented would be to place the hex representation in the enum, as it is clearly intrinsic to Color. A switch is less strict.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25720973
score: 1

http://stackoverflow.com/q/25819511
type: Question
has answer: http://stackoverflow.com/a/25819587
score: 0
answer count: 1
has title: Avoid overwriting xlsx file in Apache poi
tagged with: apache-poi
type: UnansweredQuestion
has body: I am using Apache poi to write in to an excel and given download option to that file. But each time when I download, it's overwriting the existing file and even file size is also increasing. I want to create a new file by same name each time. ServletContext servletContext = httpSession.getServletContext() String absolutePathToIndexJSP = servletContext.getRealPath("/") + "File/filename.xlsx FileInputStream fis = new FileInputStream(new File(absolutePathToIndexJSP)); System.out.println("file path : " + absolutePathToIndexJSP); XSSFWorkbook workbook = new XSSFWorkbook(fis); XSSFSheet sheet = workbook.getSheetAt(0); XSSFCellStyle style = workbook.createCellStyle(); style.setAlignment(XSSFCellStyle.ALIGN_RIGHT); XSSFRow row = sheet.createRow(0); row.setHeight((short) 2000); XSSFCell r1c = row.createCell(0); row.removeCell(r1c); r1c.setCellValue("Ptoto"); for (int s = 0; s &lt; arrayJson.length(); s++) { System.out.println(s); int imageCount = s + 1; System.out.println(imageCount); String absolutePathToImage = servletContext.getRealPath("/") + "imgData/" + imageCount + ".jpg"; System.out.println("writing image"); System.out.println("path : " + absolutePathToImage); InputStream inputStream = new FileInputStream(absolutePathToImage); byte[] bytes = IOUtils.toByteArray(inputStream); int pictureIdx = workbook.addPicture(bytes, Workbook.PICTURE_TYPE_JPEG); inputStream.close(); CreationHelper helper = workbook.getCreationHelper(); Drawing drawing = null; drawing = sheet.createDrawingPatriarch(); ClientAnchor anchor = helper.createClientAnchor(); row.removeCell(r1c); anchor.setCol1(s + 1); anchor.setRow1(0); double scale = 0.11; //Creates a picture Picture pict = drawing.createPicture(anchor, pictureIdx); //Reset the image to the original size pict.resize(scale); } fos = new FileOutputStream(absolutePathToIndexJSP); System.out.println("file written"); workbook.write(fos); fos.flush(); fos.close();
tagged with: java

http://stackoverflow.com/a/25822196
answers question: http://stackoverflow.com/q/25821886
score: 0
type: Answer
has body: Obviously you have some memory leakage in your application. Look for any object being created repeatedly like Statement or PreparedStatement object and not being closed.(I have had this issue).Or you can check if any object being created in any servlet that is not being disposed of. Do provide the stack trace with the file which contains the code that caused this exception for further specific help.

http://stackoverflow.com/q/25846509
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25849213
accepted answer: http://stackoverflow.com/a/25849213
upvote count: 3
has answer: http://stackoverflow.com/a/25846553
tagged with: onresume
favorite count: 0
has title: Android make contol of ADmob hide addview window after click on it
possible better answer: http://stackoverflow.com/a/25846553
tagged with: android
type: AnsweredQuestion
score: 3
downvote count: 0
has body: I am developing an android application and I want close the window of view adds after I click on the adds window using Resume event.I put a rule in resume event but this rule make adds never show. so if there is a way to make the view adds disappears when I return to my application? this is my code: @Override protected void onResume() { // TODO Auto-generated method stub if (adView != null) { adView.destroy(); } super.onResume(); }
tagged with: java
tagged with: adview

http://stackoverflow.com/comment/40199570
score: 0
type: Comment
type: AnswerComment
has text: Am I allowed to do `for (Bird bird : animals)` where `animals` is an `ArrayList<Animal>` even though some of the items in `animals` might not be `Birds`?
comment on: http://stackoverflow.com/a/25715296

http://stackoverflow.com/q/25790012
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25922392
tagged with: java
type: Question
has title: Multiple login with spring security + web services
answer count: 1
tagged with: spring-security
score: 0
has body: I am working with spring-security 3.1 to implement two different logons. The first thing I have to a database that brings me CustomUserDetailService credentials datos.Este the same database is for administrator access. The second port is for the user but the information comes from a web service I call him with me a method validates the user. The problem I have with the second port, and to develop a CustomAuthenticationProvider for the second AuthenticationManager (web service), but when I try to access the spring-security user sends me to error page login.html? Error = true the furmulario administrator access. Esteb is my configuration file: &lt;http pattern="../resources/**" security="none" /&gt; &lt;http pattern="/login.html*" security="none" /&gt; &lt;http pattern="/loginUser.html*" security="none" /&gt; &lt;!-- USER --&gt; &lt;http auto-config="true" authentication-manager-ref="wsAuthenticationManager" use-expressions="true" pattern="/testUser/**"&gt; &lt;intercept-url pattern="/loginUser.html" access="permitAll" /&gt; &lt;intercept-url pattern="/testUser/**" access="hasRole('user')" /&gt; &lt;access-denied-handler error-page="/403" /&gt; &lt;form-login login-page="/loginUser.html" authentication-failure-url="/loginUser.html?login_error=true" default-target-url="/testUser" /&gt; &lt;logout invalidate-session="true" logout-success-url="/logintUser.html" /&gt; &lt;/http&gt; &lt;beans:bean id="customAuthenticationProvider" class="net.universia.test.service.CustomAuthenticationProvider" /&gt; &lt;!-- Acceso contra WS --&gt; &lt;authentication-manager id="wsAuthenticationManager"&gt; &lt;authentication-provider ref="customAuthenticationProvider" /&gt; &lt;/authentication-manager&gt; &lt;!--ADMIN --&gt; &lt;http auto-config="true" use-expressions="true" authentication-manager-ref="authenticationManager" &gt; &lt;intercept-url pattern="/login.html" access="permitAll" /&gt; &lt;intercept-url pattern="/test/**" access="hasRole('admin')" /&gt; &lt;intercept-url pattern="/…

http://stackoverflow.com/comment/40427034
type: Comment
comment on: http://stackoverflow.com/q/25839160
type: QuestionComment
score: 0
has text: And why exactly are you adding 5 to `typ.indexOf("#")`?

format
tags question: http://stackoverflow.com/q/25866708
tags question: http://stackoverflow.com/q/25807636
tag name: format
tags question: http://stackoverflow.com/q/25755797
tags question: http://stackoverflow.com/q/25800611
tags question: http://stackoverflow.com/q/25750641
tags question: http://stackoverflow.com/q/25835145
type: Tag
tags question: http://stackoverflow.com/q/25803115

http://stackoverflow.com/comment/40490802
has text: Ah, in the future, please tag stack overflow questions that are assignments as "homework" you'll still get good answers, but people will know its for learning and give you less trouble with the tiny details.
comment on: http://stackoverflow.com/a/25872618
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40392967
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25820449
has text: Logcat/Error stack trace?

http://stackoverflow.com/a/25884259
type: Answer
downvote count: 3
answers question: http://stackoverflow.com/q/25872404
has body: you can do same thing using IText also, use this code. import java.io.FileOutputStream; import java.io.StringReader; import com.lowagie.text.Document; import com.lowagie.text.PageSize; import com.lowagie.text.html.simpleparser.HTMLWorker; import com.lowagie.text.pdf.PdfWriter; public class Test { public static void main(String ... args ) { try { Document document = new Document(PageSize.LETTER); PdfWriter.getInstance(document, new FileOutputStream("E:\\yogesh\\test.pdf")); document.open(); document.addAuthor("author"); document.addSubject("subject"); document.addCreationDate(); document.addTitle("title"); HTMLWorker htmlWorker = new HTMLWorker(document); String str = " "+ " Demo " + " DEMO DEMO " + " "; htmlWorker.parse(new StringReader(str)); document.close(); System.out.println("Done"); } catch (Exception e) { e.printStackTrace(); } } }
upvote count: 0
has comment: http://stackoverflow.com/comment/40508849
has comment: http://stackoverflow.com/comment/84354269
score: -3

http://stackoverflow.com/a/25764076
has comment: http://stackoverflow.com/comment/40289384
upvote count: 3
answers question: http://stackoverflow.com/q/25763711
has comment: http://stackoverflow.com/comment/40289449
has comment: http://stackoverflow.com/comment/40289510
has comment: http://stackoverflow.com/comment/40317759
has body: Because the url pattern specified is /rest/* Moreover your servlet tag should be like this HelloServlet com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages Package1 you can specify additional path in your resource-method to call it individually like @Path("/hello") public class Hello { @GET @Path("/intextform") @Produces(MediaType.TEXT_PLAIN) public String helloWorld(){ return "Hello from Jersey!"; } } Then right-click on the project and run on server Try this url http://localhost:8080/JerseyDemoProject/rest/hello/intextform
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40289533
has comment: http://stackoverflow.com/comment/40289316
type: Answer
has comment: http://stackoverflow.com/comment/40291024

http://stackoverflow.com/comment/40287178
type: QuestionComment
has text: Don't be scared to ask the person who asked you what they meant. But normally means you do a restart on an application server for an application.
score: 2
comment on: http://stackoverflow.com/q/25762954
type: Comment

http://stackoverflow.com/a/25852124
has body: To convert your number in base 36: BigInteger number = new BigInteger("48565664968483514466"); String numberInBase36 = number.toString(36); System.out.println(numberInBase36);
type: Answer
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/25851786

http://stackoverflow.com/comment/40338049
comment on: http://stackoverflow.com/q/25727002
type: Comment
has text: @LouisJacomet Currently I fixed it by handling the serialization myself before sending to the cache. However, this is not the ideal solution it would be better if ehcache could handle that it self. I don't have the exception but there wasn't much to it, it was failing on a $Proxy class and showed no detail in the stack. However, I will add how I am interacting with the cache (it is via spring `@Cacheable` annotation)
score: 0
type: QuestionComment

javahl
tags question: http://stackoverflow.com/q/25752332
type: Tag
tag name: javahl

http://stackoverflow.com/comment/40345855
has text: @SagarPilkhwal oh yes, I forgot. I tried that as well.
score: 0
comment on: http://stackoverflow.com/q/25794912
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25805333
downvote count: 0
has body: Initialization order. aMethod() is called before the line private int x = 5 Playing round with code examples like this is a great way to learn the order in which things are executed. Try adding a static and non-static initialization block too.
score: 3
answers question: http://stackoverflow.com/q/25805231
upvote count: 3
type: Answer

http://stackoverflow.com/comment/40357613
has text: So in the first case, when a1 is initiated using "A a1= new C();", it contains int x= 1 , but not int x= 100 as a class C object? Thanks!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25801051
type: Comment

http://stackoverflow.com/comment/40489816
type: Comment
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61362/discussion-between-samdjava-and-ninana).
comment on: http://stackoverflow.com/q/25872068
score: 0

http://stackoverflow.com/comment/40459415
comment on: http://stackoverflow.com/q/25856919
score: 0
type: QuestionComment
has text: The properties file? I'm just using it to store some information entered by the user so that the next time the program is run, that information isn't erased.
type: Comment

http://stackoverflow.com/comment/40320745
score: 0
type: Comment
type: QuestionComment
has text: Java. I thought this may be language independent.
comment on: http://stackoverflow.com/q/25781054

http://stackoverflow.com/a/25748320
score: 0
answers question: http://stackoverflow.com/q/25748195
has body: In short, Object is not a myclass: myclass extends Object, i.o.w., Object is a superclass of myclass. If you had List&lt;? extends myclass&gt; test_list = new ArrayList&lt;Object&gt;(); You'd have a compile failure. If you had List&lt;Object&gt; test_list = new ArrayList&lt;myclass&gt;(); It would compile, but you'd need the explicit cast. What you had is (if you squint) like: List&lt;Object&gt; test_list = new ArrayList&lt;Object&gt;(); Because List&lt;Object&gt; is (probably) more general than List&lt;? super myclass&gt; (it may be the essentially the same, if myclass doesn't extend any other class). This would work just fine: List&lt;? extends myclass&gt; test_list = new ArrayList&lt;myclass&gt;();
type: Answer

http://stackoverflow.com/q/25716988
type: Question
has body: I have an android application that will connect to a server. I would like the android application to be able to validate that the server cert was signed by a root certificate created by myself. I've tried to add the root ca to my trust store: InputStream rootCa = getResources().openRawResource(R.raw.root_ca); CertificateFactory cf = CertificateFactory.getInstance("X.509"); trustStore.load(null,null); trustStore.setCertificateEntry("serverRoot", cf.generateCertificate(rootCa)); SSLSocketFactory sf = new SSLSocketFactory(trustStore); sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); but I keep getting this error: javax.net.ssl.SSLPeerUnverifiedException: No peer certificate Any suggestions on how to do this?
score: 0
has title: Verify host certificate was signed by a root
has comment: http://stackoverflow.com/comment/40202346
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40203571
has comment: http://stackoverflow.com/comment/40202467

http://stackoverflow.com/comment/40437988
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25843805
has text: Hi @MagicWand.Thank you somuch for going into my question.I have seen that link before posting question.My server configuration is follows: <fileset dir="${wlp.install.dir}/lib" includes="db2jcc.jar db2jcc_license_cisuz.jar db2jcc_license_cu.jar"/> <jdbcDriver libraryRef="DB2JCC4Lib"/> <properties.db2.jcc databaseName="DB2TEST" password="YYYYY" portNumber="20025" serverName="xyxyxyxxyx" user="XXXXX"/> . Where should i add "progressivesteaming=2" in server.xml?

http://stackoverflow.com/comment/40246499
has text: I know, but the session scoped bean is in HttpSession. Is this singleton serialized to session as well?
comment on: http://stackoverflow.com/q/25740440
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25817431
answers question: http://stackoverflow.com/q/25813654
upvote count: 3
score: 3
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25813654
has body: There are 2 problems. First, Why can't I assign Generic&lt;T&gt; to SuperGeneric&lt;SuperT&gt;? The answer is: for the very same reason why you can't assign Generic&lt;T&gt; to Generic&lt;SuperT&gt;. The problem is caused by the generic type, not by automatic uppercasting Generic to SuperGeneric. Also check wildcards, which could provide some work around. Second, Why doesn't Lists.newArrayList() work as one would expect? Let's consider following hierarchy: class SuperT | class MiddleT extends SuperT / \ class SubT1 extends MiddleT class SubT2 extends MiddleT And let's have a simplified version of the toList() method, that only takes 2 parameters: &lt;T&gt; List&lt;T&gt; toList(T t1, T t2) { ... } Now when compiler sees toList(A, B) anywhere, it will try to find closest common ancestor of A and B, and substitues that for T. For example, toList(new SubT1(), new SubT2()) here the closest common ancestor is MiddleT, so the returned value is List&lt;MiddleT&gt;. If you want List&lt;SuperT&gt; as return value you need to tell the compiler that you want substitute SuperT for type T: List&lt;SuperT&gt; list = Lists.asList(new SubT1(), new SubT2()); // compile error (in 1.7 version) List&lt;SuperT&gt; list = Lists.&lt;SuperT&gt; asList(new SubT1(), new SubT2()); // OK (The SubT1 and SubT2 classes are unnecessary, the explample would work just as fine with asList(new MiddleT(), new MiddleT()), but I wanted to show how the compiler substitues the closest common supertype for T if you don't write it explicitly) But fear not, Java 8 comes to save the day. With JDK 1.8.0_11 the following compiles just fine: List&lt;SuperT&gt; list = Lists.asList(new SubT1(), new SubT2()); // OK in 1.8 version I guess the compilator now looks what the result is being used for when deciding what T should be.

http://stackoverflow.com/a/25761247
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25760971
has body: If you really want to instantiate the class variable in the method, called by the constructor you could do it like this: import java.util.ArrayList; public class One { private ArrayList&lt;Integer&gt; list; public One() { addString(); } private void addString() { list = new ArrayList&lt;&gt;(); list.add(1); list.add(2); list.add(3); list.add(4); } }
score: 1
downvote count: 0

http://stackoverflow.com/comment/40359232
type: QuestionComment
comment on: http://stackoverflow.com/q/25802052
score: 2
type: Comment
has text: And why do you need reverse order? Just sort it, and take the last `k` elements.

http://stackoverflow.com/comment/97480027
type: Comment
has text: @Speise have a look at this issue, Spring will provide a proper builder https://github.com/spring-projects/spring-hateoas/issues/864
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/48415363

http://stackoverflow.com/q/25720252
type: Question
has comment: http://stackoverflow.com/comment/40209469
has answer: http://stackoverflow.com/a/25722100
has body: I'm trying to write an app in Android Studio that opens multiple music files and stores their paths. At the moment all I'm doing is loading one file at a time which works without issue. For example - the code below shows my onclicklister for the load button and associated code. Some of the code has been simplified for this example. A user clicks the load button in the app and then uses whatever file manager they have installed to select a file which then passes the Uri back to my app. All well and good. However, is it possible to select multiple files and have them passed back to my app as an array of files? So instead of selecting a single audio file maybe the user selects 5 or 6. If so how do you do this? Many thanks. Anyway - what I final View.OnClickListener mGlobal_OnClickListener = new View.OnClickListener() { public void onClick(final View v) { int resID2 = v.getId(); Intent intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("audio/*"); try { startActivityForResult(intent,resID2); } catch (Exception e) { Toast.makeText(getApplicationContext(), "Please install a file manager",Toast.LENGTH_LONG).show(); } } }; public void onActivityResult(int requestCode, int resultCode, Intent result) { if (resultCode == RESULT_OK) { Uri data = result.getData(); String thePath = data.getPath(); // Do something with the file path } }
accepted answer: http://stackoverflow.com/a/25722100
score: 5
has comment: http://stackoverflow.com/comment/40211902
has comment: http://stackoverflow.com/comment/40210192
has comment: http://stackoverflow.com/comment/40210418
has title: Can you open multiple files with intent in Android?
answer count: 1
has comment: http://stackoverflow.com/comment/40210448
favorite count: 0
has comment: http://stackoverflow.com/comment/40208869
tagged with: android-studio
linked to: http://stackoverflow.com/q/16588064
upvote count: 5
has comment: http://stackoverflow.com/comment/40209647
tagged with: android
has comment: http://stackoverflow.com/comment/40210971
has comment: http://stackoverflow.com/comment/40209702
has comment: http://stackoverflow.com/comment/40216146
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40210519
has comment: http://stackoverflow.com/comment/40210700
downvote count: 0
has comment: http://stackoverflow.com/comment/40208762
has comment: http://stackoverflow.com/comment/40208822
tagged with: java
has comment: http://stackoverflow.com/comment/40211154

http://stackoverflow.com/comment/40456170
type: Comment
has text: System.getProperty does permission check, however Class.forName is straight native method invocation. Can you prove with explanation of mechanics for both methods?
type: AnswerComment
comment on: http://stackoverflow.com/a/25855261
score: 0

http://stackoverflow.com/q/25789729
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40335842
has answer: http://stackoverflow.com/a/25790229
score: 3
has comment: http://stackoverflow.com/comment/40335829
has comment: http://stackoverflow.com/comment/40335783
has comment: http://stackoverflow.com/comment/40336577
has comment: http://stackoverflow.com/comment/40335911
upvote count: 4
has comment: http://stackoverflow.com/comment/40335888
answer count: 3
has title: Writing to a Running Jar
tagged with: jar
has answer: http://stackoverflow.com/a/25789890
has comment: http://stackoverflow.com/comment/40335700
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25789834
has comment: http://stackoverflow.com/comment/40335796
has comment: http://stackoverflow.com/comment/40335740
has comment: http://stackoverflow.com/comment/40335964
has body: I'm trying to create a Jar file that contains data inside the Jar that persists between executions of the program. I know there are other ways to save data, but I'm going for a fully self-contained Jar file. I have something that seems to work, and I'd like feedback on any holes you see in my approach, as something feels hackish about it. What I'm doing is this: The Jar contains a file, saves.txt. This file contains a single digit: at the beginning, it's 1. When the Jar is run, it reads this file (using getResourceAsStream) and displays that number to the user. I then extract the whole jar to a temporary directory using the ZipFile API. Now that saves.txt is a File (not a resource), I increment the number and overwrite the file in the temp directory. Then I use the JarOutputStream to rezip the contents of the temporary directory (including the updated saves.txt file) back into the same jar. Finally, I delete the temporary directory and the program exits. When the user runs the jar again, the saves.txt file has been updated. I'm doing all this rigmarole to get around this bug, where you can't just update a single file inside a jar: http://bugs.java.com/bugdatabase/view_bug.do?bug_id=4129445 And I'm not using the jar -u command because I don't want to require end users have the JDK. I can see a few problems with this, but none of them are deal-breakers for me: This won't work with signed jars. That's not a problem for me, since these jars won't be signed anyway. This won't work if the jar is in a directory without write privileges. I can warn the user about that. This won't work if the jar is open in an archive explorer (like 7zip) while the program is run. I can get around this by simply showing the user a message asking them to close it. This makes deploying a new version of the jar annoying, as the saves are inside the jar. The user will either have to somehow load the data from the old jar, or start clean. I'm okay with that too. So, my question is: does any of th…
tagged with: java

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/25716847
tags question: http://stackoverflow.com/q/25820449
tags question: http://stackoverflow.com/q/25838023
type: Tag
tags question: http://stackoverflow.com/q/25850862

http://stackoverflow.com/q/25829866
has title: finding the shortest word in an array of strings java
has answer: http://stackoverflow.com/a/25829985
favorite count: 0
has body: im trying to write a code to take in a group of words, and return the smallest word in character length. pretty simple, for some reason its returning 'bye' when there is a shorter word in there such as 'no'. public class function2 { public static void main(String [] args) { String [] SA = {"hello", "goodbye", "jack", "bye", "yes", "no", "yoo"}; smallest(SA); System.out.println("The shortest word is " + smallest(SA)); } public static String smallest(String SA[]) { String first = SA[0]; for (int i = 1 ; i &lt; SA.length ; i++) { if ((SA[i].compareTo(first)) &lt; 0) { first = SA[i]; } // if } // for return first; }// smallest }// lab1b
has comment: http://stackoverflow.com/comment/40409706
has answer: http://stackoverflow.com/a/25829910
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/71585397
has answer: http://stackoverflow.com/a/25830003
has answer: http://stackoverflow.com/a/25829913
has comment: http://stackoverflow.com/comment/40409729
upvote count: 6
linked to: http://stackoverflow.com/q/12326899
tagged with: java
type: Question
tagged with: debugging
has comment: http://stackoverflow.com/comment/40409802
has comment: http://stackoverflow.com/comment/40409694
has comment: http://stackoverflow.com/comment/40409697
answer count: 6
has comment: http://stackoverflow.com/comment/40409746
score: 6
has answer: http://stackoverflow.com/a/28308509
downvote count: 0

http://stackoverflow.com/q/25733718
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question
has title: IllegalMonitorStateException on notify() when synchronized on an Integer
tagged with: wait
tagged with: notify
has body: I'm new to using wait() and notify() in Java and I'm getting an IllegalMonitorStateException. Main Code public class ThreadTest { private static Integer state = 0; public static void main(String[] args) { synchronized(state) { System.out.println("Starting thread"); Thread t = new Thread(new AnotherTest()); t.start(); synchronized(state) { state = 0; while(state == 0) { try { state.wait(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } System.out.println("State is: " + state); } } } public static class AnotherTest implements Runnable { @Override public void run() { synchronized(state) { state = 1; state.notify(); } } } } I'm getting an IllegalMonitorStateException what state.notify() is called. Any ideas? Edit: Based on answer below here is code that works. As a side note, I was first trying this with an enum which has the same problem of using Integer. public class ThreadTest { private static int state = 0; private static Object monitor = new Object(); public static void main(String[] args) { synchronized(monitor) { System.out.println("Starting thread"); Thread t = new Thread(new AnotherTest()); t.start(); state = 0; while(state == 0) { try { for(int i = 0; i &lt; 5; i++) { System.out.println("Waiting " + (5 - i) + " Seconds"); Thread.sleep(1000); } monitor.wait(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } System.out.println("State is: " + state); } } public static class AnotherTest implements Runnable { @Override public void run() { synchronized(monitor) { state = 1; monitor.notify(); } } } }
has answer: http://stackoverflow.com/a/25733836
accepted answer: http://stackoverflow.com/a/25733836
tagged with: illegalmonitorstateexcep
upvote count: 1
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25823511
has body: I'm developing an app in which I need to add a jpanel to the jframe whenever there is a line on a certain table on my database. The problem is that I made the interface I want with netbeans, but it looks like it's static, I don't find where to use the while loop on my code. This is the code: the jpanel that I want to add dynamically called list_ligne.get(i) javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(idPapier_lb) .addGap(53, 53, 53) .addComponent(titre_lb) .addGap(30, 30, 30) .addComponent(proprietaire_lb) .addGap(94, 94, 94) .addComponent(lien_lb) .addGap(94, 94, 94) .addComponent(confidentialite_lb)) .addGroup(layout.createSequentialGroup() .addContainerGap() .addComponent(list_lignes.get(2), javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addGap(304, 304, 304) .addComponent(ajouter) .addGap(85, 85, 85) .addComponent(deconnexion) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(44, 44, 44) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(idPapier_lb) .addComponent(titre_lb) .addComponent(proprietaire_lb) .addComponent(lien_lb) .addComponent(confidentialite_lb)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(list_lignes.get(2), javax.swing.GroupLayou…
tagged with: netbeans
type: UnansweredQuestion
tagged with: swing
has title: add dynamic of jpanel depending on database using netbeans
tagged with: java
tagged with: jpanel
type: Question
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25823526

http://stackoverflow.com/a/25724547
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25714573
has body: Like @galovics says you can determine the mouse position before displaying the stage, check this out: http://docs.oracle.com/javafx/2/api/javafx/stage/Screen.html https://community.oracle.com/thread/2390272?tstart=0 Hope it helps
upvote count: 1
type: Answer

http://stackoverflow.com/q/25789519
has answer: http://stackoverflow.com/a/25791398
favorite count: 0
type: UnansweredQuestion
has body: import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.FileOutputStream; import java.io.InputStream; public class RunInput { public static void main(String[] args) { try { Process p = Runtime.getRuntime().exec("java Island &lt; island1.in"); p.waitFor(); InputStream in = p.getInputStream(); int b; while ((b = in.read()) != -1) { outputStream.write(b); } } catch (Exception e) { e.printStackTrace(); } } } I could not figure out why my program doesn't seem to run the command line and save it to output1.txt. Can someone tell me what is the proper way to do it?
has comment: http://stackoverflow.com/comment/40335384
upvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25791392
has comment: http://stackoverflow.com/comment/40335816
type: Question
score: -1
has answer: http://stackoverflow.com/a/25790273
answer count: 3
has title: Running a terminal program from java and saves it to a file called output1.txt
has comment: http://stackoverflow.com/comment/40335579
downvote count: 1

http://stackoverflow.com/a/25795483
has body: You have at least two options: Change your html pages into JSP pages. Check the session, return any content you need or redirect to a login page based on session variables. Move these pages inside your app using GWT ExternalTextResource. This way you can keep your html files as is and load these pages only when requested from an authorized user from within your app.
answers question: http://stackoverflow.com/q/25794598
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40347681
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40466451
has text: If the same code works in test but not production, then the problem is likely to be a configuration issue. Looking at the URL you've pasted, userip is a private address and will be meaningless outside of your network, could that be part of the problem?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25860882

http://stackoverflow.com/a/25832477
downvote count: 0
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25832432
type: AcceptedAnswer
has body: Try the following (I'm assuming the third iteration should only include blockHeights[2], following the pattern): for (int i = 1; i &lt;= blockHeights.length; i++) { int totalBlockHeights; for (int j = i - 1; j &lt; blockHeights.length; j++) { // all block heights from here onwards totalBlockHeights += blockHeights[j]; } // do whatever }
accepted answer of: http://stackoverflow.com/q/25832432
has comment: http://stackoverflow.com/comment/40414349
type: Answer

http://stackoverflow.com/q/25741715
has title: Get the first 5 items from RSS feed - Android
tagged with: rss
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 1
downvote count: 0
has body: I am currently developing an RSS feed reading app, where the app goes to multiple rss feeds and brings back the xml, which is then parsed. What I want to know, is if there is a way to only bring back the first 5 items in the RSS feed; so that the time it takes to bring back to data is reduced. Any guidance will be appreciated, thanks! This is the code I am using: How I call XMLParser: XMLParser parser = new XMLParser(); String xml = parser.getXmlFromUrl(URL[f]); // getting XML Document doc = parser.getDomElement(xml); // getting DOM element XMLParser: package com.example.directrssread; import java.io.IOException; import java.io.StringReader; import java.io.UnsupportedEncodingException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; import org.apache.http.client.methods.HttpGet; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.util.EntityUtils; 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.util.Log; public class XMLParser { // constructor public XMLParser() { } /** * Getting XML from URL making HTTP request * @param url string * */ public String getXmlFromUrl(String url) { String xml = null; try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); //HttpPost httpPost = new HttpPost(url); HttpGet httpPost = new HttpGet(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); xml = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOEx…
favorite count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40259588
has answer: http://stackoverflow.com/a/25953438

http://stackoverflow.com/a/25838552
type: Answer
accepted answer of: http://stackoverflow.com/q/25838513
answers question: http://stackoverflow.com/q/25838513
score: 5
upvote count: 5
type: AcceptedAnswer
downvote count: 0
has body: The Double class has a floatValue() property. http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html function(fakePi.floatValue());

http://stackoverflow.com/q/25740431
type: Question
score: 3
has answer: http://stackoverflow.com/a/25741217
tagged with: java
has comment: http://stackoverflow.com/comment/40246414
tagged with: date
has comment: http://stackoverflow.com/comment/40285117
has answer: http://stackoverflow.com/a/69999976
upvote count: 4
has answer: http://stackoverflow.com/a/25761613
has comment: http://stackoverflow.com/comment/40246453
linked to: http://stackoverflow.com/q/344380
accepted answer: http://stackoverflow.com/a/25741408
possible better answer: http://stackoverflow.com/a/25740686
favorite count: 0
has answer: http://stackoverflow.com/a/25740686
answer count: 5
has title: Finding date of birth from age in java
has body: Hello all I am creating a program for finding the date of birth when the exact age is given. For example if age of a man is 21 years 10 months and 22 days(up to current date) how can i find the exact date of birth. I will be thankful if anyone help me with isuue. What i tried is here. here d,m and y are text field for days months and years. private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int da = Integer.parseInt(d.getText()); da = -da; int mo = Integer.parseInt(m.getText()); mo = -mo; int ye = Integer.parseInt(y.getText()); ye = -ye; SimpleDateFormat ddd = new SimpleDateFormat("dd"); SimpleDateFormat mmm = new SimpleDateFormat("MM"); SimpleDateFormat yyy = new SimpleDateFormat("yyyy"); Calendar cal = Calendar.getInstance(); cal.getTime(); cal.add(Calendar.DATE, da); cal.set(Integer.parseInt(yyy.format(cal.getTime())), Integer.parseInt(mmm.format(cal.getTime())), Integer.parseInt(ddd.format(cal.getTime()))); cal.add(cal.MONTH, mo);cal.set(Integer.parseInt(yyy.format(cal.getTime())), Integer.parseInt(mmm.format(cal.getTime())), Integer.parseInt(ddd.format(cal.getTime()))); cal.add(cal.YEAR, ye); System.out.println(getDate(cal)); } My problem is if I enter 21 year 10 months and 22 days as the age of a person the date given by compiler is 18/12/1992 but actual date should be 17/10/1992. Please help me with this issue.
type: AnsweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/25741408

http://stackoverflow.com/comment/40198826
comment on: http://stackoverflow.com/a/25715110
has text: @Dici I mean a reference that is your standard fare, no frills reference. A weak reference is one that does _not_ stop the GC from doing it's business. See http://docs.oracle.com/javase/8/docs/api/java/lang/ref/WeakReference.html
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40273446
score: 0
has text: @CChi, nope, I do not.
comment on: http://stackoverflow.com/q/25754746
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25788721
has body: I'm using hibernate/JPA with the following entities Class User { @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE) @OneToMany(cascade = CascadeType.REMOVE) @JoinColumn(name = "user_id", insertable = false, updatable = false) @LazyCollection(LazyCollectionOption.EXTRA) private List&lt;UserAcl&gt; acl; ... } and Class UserAcl { @ManyToOne(optional = false) @JoinColumn(name = "user_id") private User user; public void setUser(User user) { this.user = user; } ... } When I trying to add a new UserAcl by execution the following code: UserAcl userAcl = new UserAcl(); userAcl.setUser(user); em.persist(userAcl); And a second later (in other transaction) I try to retrieve the previous User and when I read UserAcl I didn't see the new entry. But if I: Wait a minute Disable cache or refresh User just after persist UserAcl: em.persist(userAcl); em.refresh(user); It works. But refreshing User is a bit tricky. The other solution I found, except disable caching, it's to tune setUser method to public void setUser(User user) { user.getAcl().add(this); this.user = user; } But it's the best solution? There is no other way to Hibernate to manage this without changing my setter? PS: I tried without @LazyCollection(LazyCollectionOption.EXTRA) or other cascade strategy without success.
score: 1
tagged with: java
tagged with: hibernate
tagged with: caching
type: Question
tagged with: jpa
downvote count: 0
favorite count: 0
has title: Hibernate cache issue with one-to-many/many-to-one
answer count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/q/25825028
answer count: 3
linked to: http://stackoverflow.com/q/504904
possible better answer: http://stackoverflow.com/a/25825064
has comment: http://stackoverflow.com/comment/40400726
has body: In C# or Java, how can I make a class that can only be instantiate with the Interfaces it implemented on? Sorry if this question is asked before. Edit: Sorry for confusing you, and this question is just asked out of curious: For example I have: interface iA { int addNum(); } interface iB { int minusNum(); } class A implements iA, iB { private int A; public int addNum() { A += 10; return A; } public int minusNum() { A -= 10; return A; } } class TestIface { public static void main(String args[]) { A testA = new A(); iA testiA = new A(); iB testiB = new A(); testA.minusNum(); // No error, it has access to both methods testA.addNum(); testiA.minusNum();//ERROR testiA.addNum(); testiB.minusNum(); testiB.addNum();//ERROR } } I wonder if there is a way to prevent dev from just make testA and access both methods.
has comment: http://stackoverflow.com/comment/40400946
has comment: http://stackoverflow.com/comment/40400790
tagged with: interface
has comment: http://stackoverflow.com/comment/40400714
has comment: http://stackoverflow.com/comment/40402623
has comment: http://stackoverflow.com/comment/40401977
has comment: http://stackoverflow.com/comment/40400705
has answer: http://stackoverflow.com/a/25827685
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40400755
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/25825064
has answer: http://stackoverflow.com/a/25825094
accepted answer: http://stackoverflow.com/a/25825094
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/40403049
has comment: http://stackoverflow.com/comment/40400829
has comment: http://stackoverflow.com/comment/40402857
has comment: http://stackoverflow.com/comment/40403436
has title: How to make class that can only be accessed through interface?
score: 0

http://stackoverflow.com/q/25738061
has body: when running a jenkins job, the console reports this error: java.nio.file.DirectoryNotEmptyException: C:\jenkins\jobs\My Job\lastSuccessful at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source) at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source) at java.nio.file.Files.deleteIfExists(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at hudson.Util.createSymlinkJava7(Util.java:1194) at hudson.Util.createSymlink(Util.java:1112) at hudson.model.Run.createSymlink(Run.java:1846) at hudson.model.Run.updateSymlinks(Run.java:1827) at hudson.model.Run.execute(Run.java:1738) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) ln builds\lastStableBuild C:\jenkins\jobs\My Job\lastStable failed java.nio.file.DirectoryNotEmptyException: C:\jenkins\jobs\My Job\lastStable at sun.nio.fs.WindowsFileSystemProvider.implDelete(Unknown Source) at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(Unknown Source) at java.nio.file.Files.deleteIfExists(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at hudson.Util.createSymlinkJava7(Util.java:1194) at hudson.Util.createSymlink(Util.java:1112) at hudson.model.Run.createSymlink(Run.java:1846) at hudson.model.Run.updateSymlinks(Run.java:1828) at hudson.model.Run.execute(Run.java:1738) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:89) at hudson.model.Executor.run(Executor.java:240) Is this a bug…
answer count: 2
favorite count: 0
score: 8
tagged with: jenkins
possible better answer: http://stackoverflow.com/a/35863569
has answer: http://stackoverflow.com/a/35863569
has comment: http://stackoverflow.com/comment/40242757
has title: java.nio.file.DirectoryNotEmptyException when deleting lastSuccessful/lastStable jenkins
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25739336
upvote count: 8
type: Question
accepted answer: http://stackoverflow.com/a/25739336

http://stackoverflow.com/a/25723745
answers question: http://stackoverflow.com/q/25723669
score: 0
has body: Set b = new LinkedHashSet(); b= webDriver.getWindowHandles(); In the above code,you are creating a LinkedHashset object first ,than second statement on the same is returning a new LinkedHashSet,So in this case first LinkedHashset object is not useful and unnecessary created. Set b = webDriver.getWindowHandles() While in this statement only one linked hashset is created. So second one is more appropriate to use.
type: Answer

http://stackoverflow.com/q/25840267
has title: How to loop this if the password or username entered is not correct
has body: How can I loop this if the password or username entered is not correct and for only 3 attempts? public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_ENTER) { if (userTf.getText().equals(dat.getUserName()) &amp; passTf.getText().equals(dat.getPassWord())) { JOptionPane.showMessageDialog(null,"Hello You are an Authorized User!!!",null,JOptionPane.INFORMATION_MESSAGE); System.exit(1); } else { JOptionPane.showMessageDialog(null,"Incorrect Password or Username!!!",null,JOptionPane.WARNING_MESSAGE); } } }
upvote count: 3
has answer: http://stackoverflow.com/a/25840378
tagged with: authentication
tagged with: loops
type: AnsweredQuestion
score: 3
tagged with: if-statement
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25840378
answer count: 1
tagged with: user-interface
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/40440611
score: 0
type: QuestionComment
type: Comment
has text: @user3373261: you need to think about what the program should do. Simply fixing compilation errors won't make the program work. If some method is designed to add two numbers and give you back the result, you can't just pass null to this method and expect anything meaningful as a result. You need to pass the numbers that you want to add. Only you know what the code should do, and what the xmlWriter.updateFile() method does with its arguments.
comment on: http://stackoverflow.com/q/25845496

http://stackoverflow.com/a/25728934
has body: Your EntityManagerFactory emf should not be created every time. EntityManagerFactory are thread safe and you should use it as static. If create it every time your performance will drop. Entity should not handle transactions, they are used only to reflect the database data. The correct way of using an Entity would be in a repository/DAO classes. Why are you doing id = 0; in your constructor? The default is already 0. Do not open a transaction in a Controller. Controller should handle only what gets in and what gets out of the project. If you add transaction in it you will be adding unnecessary complexity and increasing the coupling of your code. You could use the pattern OpenSessionInView, EJBs Components or Injection/AOP transaction controller. To delete an entity you will need to attach it first. You could use the getReference method: Entity justId = entityManager.getReference(Entity.class, ID). Take a look at this material that will help you understand about the JPA basics: http://uaihebert.com/jpa-mini-book-first-steps-and-detailed-concepts/
answers question: http://stackoverflow.com/q/25724953
has comment: http://stackoverflow.com/comment/40240167
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40236505
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/40237076
has comment: http://stackoverflow.com/comment/40240694
accepted answer of: http://stackoverflow.com/q/25724953

linechart
tag name: linechart
type: Tag
tags question: http://stackoverflow.com/q/25825198

http://stackoverflow.com/q/25852961
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/62992650
has comment: http://stackoverflow.com/comment/77426927
has answer: http://stackoverflow.com/a/25852983
has title: how to remove brackets character in string (java)
has answer: http://stackoverflow.com/a/25852984
has answer: http://stackoverflow.com/a/25853119
tagged with: regex
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/69312931
type: Question
accepted answer: http://stackoverflow.com/a/25852984
answer count: 8
has answer: http://stackoverflow.com/a/34151205
score: 18
upvote count: 18
has body: I want to remove all type of brackets character (example: [],(),{}) in string by using java. I tried using this code: String test = "watching tv (at home)"; test = test.replaceAll("(",""); test = test.replaceAll(")",""); But it's not working, help me please.
has answer: http://stackoverflow.com/a/25853043
tagged with: brackets
possible better answer: http://stackoverflow.com/a/25853022
downvote count: 0
has answer: http://stackoverflow.com/a/25853022

scheme
tag name: scheme
tags question: http://stackoverflow.com/q/25836072
type: Tag

http://stackoverflow.com/comment/40204044
has text: i know and i do all points, my build file and tomcat works yesterday , but when i change tomcat 6 to 7 , i get this error! tnx
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25717783
type: Comment

http://stackoverflow.com/comment/40263581
has text: I'm assuming it crashes on `sizes[pointList.size()] = SIZE;` but could you post the stacktrace?
score: 2
comment on: http://stackoverflow.com/q/25749881
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40202443
has text: I tried result=result+(1/(i+1)); adding the extra parenthesis around it, but i'm still getting 0.0 as the the sum. Also I changed int result=0; to double result=0.0.
comment on: http://stackoverflow.com/a/25717055
type: AnswerComment
score: 0
type: Comment

math
tags question: http://stackoverflow.com/q/25866309
type: Tag
tags question: http://stackoverflow.com/q/25757186
tags question: http://stackoverflow.com/q/25813564
tags question: http://stackoverflow.com/q/25764735
tags question: http://stackoverflow.com/q/25829061
tags question: http://stackoverflow.com/q/25854096
tags question: http://stackoverflow.com/q/25851786
tags question: http://stackoverflow.com/q/25791843
tags question: http://stackoverflow.com/q/25802459
tags question: http://stackoverflow.com/q/25844942
tags question: http://stackoverflow.com/q/25824935
tags question: http://stackoverflow.com/q/25769176
tags question: http://stackoverflow.com/q/25831776
tag name: math
tags question: http://stackoverflow.com/q/25829245

http://stackoverflow.com/comment/40253422
comment on: http://stackoverflow.com/q/25729686
type: QuestionComment
type: Comment
has text: JDBC is a minefield if you make any assumptions. It could throw an exception, it could hang indefinably, or it could fail silently.
score: 0

http://stackoverflow.com/a/53290058
type: Answer
answers question: http://stackoverflow.com/q/25763533
upvote count: 2
has body: /** * Extract the MIME type from a base64 string * @param encoded Base64 string * @return MIME type string */ private static String extractMimeType(final String encoded) { final Pattern mime = Pattern.compile("^data:([a-zA-Z0-9]+/[a-zA-Z0-9]+).*,.*"); final Matcher matcher = mime.matcher(encoded); if (!matcher.find()) return ""; return matcher.group(1).toLowerCase(); } Usage: final String encoded = "data:image/png;base64,iVBORw0KGgoAA...5CYII="; extractMimeType(encoded); // "image/png" extractMimeType("garbage"); // ""
score: 2
downvote count: 0

http://stackoverflow.com/q/25825911
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40404198
upvote count: 1
has comment: http://stackoverflow.com/comment/40403307
has title: java.lang.NoClassDefFoundError -- Not understanding issue
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40403250
has comment: http://stackoverflow.com/comment/40402536
type: Question
has comment: http://stackoverflow.com/comment/40403316
downvote count: 0
has body: I wanted to do some testing on a .jar I have (do not have the source). In previous versions of this .jar, I have decompiled it into .class files, and ran it by typing java -Xmx512m Client in terminal. I know Client.class is the main file, In manifest.mf, there is this line. Manifest-Version: 1.0 Permissions: all-permissions Trusted-Library: true Main-Class: Client However when I run my java -Xmx512m Client, for some reason it gives me the error message. Exception in thread "main" java.lang.NoClassDefFoundError: e (wrong name: E) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:247) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) at java.net.URLClassLoader.defineClass(URLClassLoader.java:283) at java.net.URLClassLoader.access$000(URLClassLoader.java:58) at java.net.URLClassLoader$1.run(URLClassLoader.java:197) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.j…
has comment: http://stackoverflow.com/comment/40403869
has comment: http://stackoverflow.com/comment/40403910
has comment: http://stackoverflow.com/comment/40402427
has comment: http://stackoverflow.com/comment/40403847
favorite count: 0
answer count: 0

http://stackoverflow.com/a/25953438
answers question: http://stackoverflow.com/q/25741715
score: 0
has body: Use a sequential parser (sax), then it's up to your implementation to count the read items, stop the reading process and close the input stream. Dom is perhaps a bit clumsy for mobiles.
type: Answer

http://stackoverflow.com/q/25872204
tagged with: tomcat-valve
accepted answer: http://stackoverflow.com/a/25875490
has body: Is it possible to have multiple authenticator Valves within the same Tomcat context configuration? I know you can have multiple Realms through the CombinedRealm, but what about different authentication methods? I have to update a web application so that it can use a new authentication source, while still using the legacy authentication source to fall back on. Here's what I currently have in the application's context.xml: &lt;Context path="/myApp"&gt; &lt;Valve className="com.company.NewAuthenticator"/&gt; &lt;Valve className="com.company.LegacyAuthenticator"/&gt; &lt;!-- Dummy realm to prevent pop-up window --&gt; &lt;Realm className="com.company.DummyRealm"/&gt; &lt;/Context&gt; It appears that NewAuthenticator rejects the user's request, the LegacyAuthenticator is never called. I guess this is expected behavior, but is there another way to make this work? Details: Tomcat 6.0 I have to use Authtenticators, as both custom systems set values in the HTTP Request that determine authentication success/failure and I need to create the custom Tomcat security principals to store the roles. Both authentication sources are custom and non-standard. I have to write my own authenticators.
has title: Multiple Tomcat Authenticator Valves
tagged with: authentication
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25875490
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0

http://stackoverflow.com/comment/40268735
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25732044
type: AnswerComment
has text: in your other solution `BackgroundThread1 extends HandlerThread` you did start() in the constructor. I found it is not necessary to do it here - one must do it outside. Also, I put `b1Handler = new MessageHandler(getLooper()); ` in overridden method, `onLooperPrepared()`

http://stackoverflow.com/a/25730768
score: 5
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25730557
type: Answer
has body: Read in the text file line by line and then do an action based on that line. BufferedReader br = new BufferedReader(new FileReader(file)); String line; while ((line = br.readLine()) != null) { // process the line. if (line.equals(". ")) { // Do something with first line line = br.readLine() // Do something with second line line = br.readLine() // Split up the third line by space String split[]= StringUtils.split(line); // split[1] = "Mozart," so you may need to do a little more work there } } br.close();
upvote count: 5
answers question: http://stackoverflow.com/q/25730557

http://stackoverflow.com/q/25799913
tagged with: jvm
has answer: http://stackoverflow.com/a/25806031
accepted answer: http://stackoverflow.com/a/25806031
downvote count: 0
has title: Why is the JDK's BREAKPOINT define given special values on ARM?
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 2
answer count: 1
favorite count: 0
tagged with: breakpoints
has body: Here is the breakpoint code in jdk. #ifdef ARM #ifdef SOLARIS #define BREAKPOINT __asm__ volatile (".long 0xe1200070") #else #define BREAKPOINT __asm__ volatile (".long 0xe7f001f0") #endif #else extern "C" void breakpoint(); #define BREAKPOINT ::breakpoint() #endif I want to know whether '.long 0xe1200070' and '.long 0xe7f001f0' have special meanings?

http://stackoverflow.com/comment/40258410
comment on: http://stackoverflow.com/q/25747013
has text: you have to add addOnGlobalLayoutListener with your view . because in oncreate view is not rendered yet so its giving width and height as 0
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25808003
tagged with: cryptography
tagged with: aes
tagged with: java
tagged with: encryption
accepted answer: http://stackoverflow.com/a/25808385
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: c#
has body: I have a Java code that encrypts data using AES. Here is a snippet encoding a simple string String key="MySecretKeyABCDE"; SecretKeySpec skey = new SecretKeySpec(key.getBytes(), "AES"); byte[] ivbytes = new byte[]{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; IvParameterSpec iv = new IvParameterSpec(ivbytes);//need IV in CBC mode Cipher m_enc_cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); m_enc_cipher.init(Cipher.ENCRYPT_MODE, skey, iv); String content ="Hello"; byte[] contentBArr = content.getBytes(); byte[] block = new byte[4080]; System.arraycopy(contentBArr,0,block,0,contentBArr.length); byte[] res = m_enc_cipher.doFinal(block,0,block.length); I need to create an equivalent .NET code. I have written this var csp = new RijndaelManaged { Mode = CipherMode.CBC, Padding = PaddingMode.PKCS7, Key = Encoding.UTF8.GetBytes("MySecretKeyABCDE"), IV = new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15} }; var e = csp.CreateEncryptor(); var content = Encoding.UTF8.GetBytes("Hello"); var block = new byte[4080]; Array.Copy(content,block,content.Length); var res = e.TransformFinalBlock(block,0,block.Length); When I compare the res variable they are different in the Java version and in the .NET version. I know Java uses unsigned bytes, but the results are really different, not only "shifted".
score: -1
upvote count: 0
has title: AES encrypting in Java vs .NET
answer count: 1
has answer: http://stackoverflow.com/a/25808385
favorite count: 0

http://stackoverflow.com/comment/40443168
type: Comment
type: AnswerComment
score: 0
has text: Hm, are you stuck with 3.0.5? You should try upgrading to the latest spring 3 release and see results. May be you've missed something obvious, but both solutions do work with the latest spring on my PC. And ofc. I wouldn't exclude some bug / specifics of the 3.0.5 version.
comment on: http://stackoverflow.com/a/25844301

http://stackoverflow.com/q/25773103
has comment: http://stackoverflow.com/comment/40306190
favorite count: 0
has answer: http://stackoverflow.com/a/25773291
has comment: http://stackoverflow.com/comment/40306076
accepted answer: http://stackoverflow.com/a/25773380
possible better answer: http://stackoverflow.com/a/25773291
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40306327
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40306127
tagged with: algorithm
has answer: http://stackoverflow.com/a/25773476
upvote count: 5
has answer: http://stackoverflow.com/a/25773380
has body: As I found in here, Coin Change is the problem of finding the number of ways of making changes for a particular amount of cents, n, using a given set of denominations d_1....d_m. It is a general case of Integer Partition, and can be solved with dynamic programming. The problem is typically asked as: If we want to make change for N cents, and we have infinite supply of each of S = { S_1, S_2,....., S_m } valued coins, how many ways can we make the change? (For simplicity's sake, the order does not matter.) I tried this and this works fine. So How I can modify this to find all possible coin combinations when the order of different coins actually does matter. i.e. : before For example, for N = 4,S = {1,2,3}, there are four solutions: {1,1,1,1},{1,1,2},{2,2},{1,3}. now : for N = 4,S = {1,2,3}, there are 7 solutions: {1,1,1,1},{1,1,2},{1,2,1},{2,1,1},{2,2},{1,3},{3,1} here {1,1,1,1} even though one can pick the four '1's in different order it has to be considered as one final combination. rather than considering that four coins are different. so actually the order of different coins has to be different to count it as a separate combination. ex: {1,1,3} won't assume {1_a,1_b,3_a} is a combination and {1_b,1_a,3_a} is another combination with different ordering.
score: 4
has title: How to solve coin change task when order does matters?
answer count: 3

http://stackoverflow.com/a/25777475
type: Answer
has comment: http://stackoverflow.com/comment/40314606
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25777452
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40314597
has body: You are not using the lyric variable anywhere in your code after assigning its value. You do use it before it is initialized to a non empty value. String OneThree = "I'm " +lyric+ "my baby " +userString; will become "I'm my baby " +userString;, since at the point that it's assigned, lyric is empty. The fact that you change lyric later to be non empty doesn't make a difference, since you never access it again after the assignment. You could initialize OneThree to : String OneThree = "I'm {0} my baby " +userString; And then, instead of System.out.println(OneThree); do System.out.println(String.format(OneThree,lyric));. That would put the current value of lyric in the String.
answers question: http://stackoverflow.com/q/25777452

http://stackoverflow.com/comment/40362530
comment on: http://stackoverflow.com/q/25803095
type: Comment
type: QuestionComment
has text: @krems `sort(Collection<? extends Comparable>)` is patently wrong, it allows classes to be passed that don't `extends Comparable` of _themselves_. Please check your facts before posting.
score: 0

http://stackoverflow.com/comment/40407164
has text: @Raziel If you use the method above you can't edit any cell - there is no edit mode. What I wrote above *is* overriding `isCellEditable`.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25826577

http://stackoverflow.com/q/25809412
upvote count: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/25809904
has answer: http://stackoverflow.com/a/25809904
tagged with: javafx-2
type: AnsweredQuestion
downvote count: 0
has title: Fade between images in JavaFX
score: 1
tagged with: java
tagged with: javafx
type: Question
has body: I have an ImageView in which I want to display two images, one after another. I want the transition between these two images to have a fade effect. This is what I tried: KeyFrame keyFrame1On = new KeyFrame(Duration.seconds(.2), new KeyValue(imageView.imageProperty(), image1, Interpolator.EASE_OUT)); KeyFrame keyFrame2On = new KeyFrame(Duration.seconds(.5), new KeyValue(imageView.imageProperty(), image2, Interpolator.EASE_OUT)); Timeline timelineOn = new Timeline(keyFrame1On, keyFrame2On); timelineOn.setAutoReverse(false); timelineOn.play(); But the transition between the images is solid, without fade. What am I doing wrong?
has answer: http://stackoverflow.com/a/25815733
tagged with: javafx-8
answer count: 2
accepted answer: http://stackoverflow.com/a/25815733

http://stackoverflow.com/a/25736438
has body: You cannot reference values in an object before creating it. However, you can create static class variables and reference them without creating any objects as shown: class Course{ static int n = 1; static int days = 180; //..other definitions //.. } class Main{ public static void main(){ Course myCourse = new Course(Course.n, Course.days); } } However, static variables introduce dependency between instance variables. A better design would be the factory design pattern with a sample implementation as follows: class Course{ int n; int days; // other instance definitions public course(int n, int days){ this.n = n; this.days = days; } } class History extends Course{ public History(){ super(10,200);//the values that you want this course to have } } class Geography extends Course{ public Geography(){ super(20,100);//the values that you want this course to have } } class Main{ public static void main(String args[]){ Course history = new History(); Course geography = new Geography(); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25735510

apache
tag name: apache
tags question: http://stackoverflow.com/q/25789709
tags question: http://stackoverflow.com/q/25865363
tags question: http://stackoverflow.com/q/25873358
tags question: http://stackoverflow.com/q/25731451
tags question: http://stackoverflow.com/q/25730874
tags question: http://stackoverflow.com/q/25827950
tags question: http://stackoverflow.com/q/25842362
tags question: http://stackoverflow.com/q/25732053
tags question: http://stackoverflow.com/q/25844868
tags question: http://stackoverflow.com/q/25758161
tags question: http://stackoverflow.com/q/25772747
tags question: http://stackoverflow.com/q/25773777
tags question: http://stackoverflow.com/q/25718508
tags question: http://stackoverflow.com/q/25855535
tags question: http://stackoverflow.com/q/25750089
type: Tag
tags question: http://stackoverflow.com/q/25783038
tags question: http://stackoverflow.com/q/25750509
tags question: http://stackoverflow.com/q/25769654
tags question: http://stackoverflow.com/q/25747519
tags question: http://stackoverflow.com/q/25729396
tags question: http://stackoverflow.com/q/25723944
tags question: http://stackoverflow.com/q/25826778
tags question: http://stackoverflow.com/q/25858334

http://stackoverflow.com/comment/40211673
score: 0
comment on: http://stackoverflow.com/q/25721190
type: QuestionComment
type: Comment
has text: yes i have given it. In the File Explorer of my AVD it shows storage/sdcard/ with permissions like dr-xr-xr-x . It doesn't have permission to write but i can't understand why is it so.

http://stackoverflow.com/comment/40323544
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25782364
type: Comment
has text: Yes, your suggested rule is correct. But my problem starts after formatting the ImportElements. If you see the formatted code above, it shows, line wraps are behaving improperly for Group and Variable elements, all those are on the same line, even after inserting line wraps after them

http://stackoverflow.com/a/25793202
has comment: http://stackoverflow.com/comment/40344566
upvote count: 1
has body: OFF can be used to turn off logging and ALL can be used to enable logging of all messages. e.g.: &lt;category name="org.apache.commons"&gt; &lt;priority value="OFF" /&gt; &lt;/category&gt; They are used as shortcuts. log4j uses internally to limit the level (threshold).
score: 1
has comment: http://stackoverflow.com/comment/40348607
has comment: http://stackoverflow.com/comment/40343599
downvote count: 0
has comment: http://stackoverflow.com/comment/40344736
has comment: http://stackoverflow.com/comment/40350565
has comment: http://stackoverflow.com/comment/40349605
type: Answer
answers question: http://stackoverflow.com/q/25792836
has comment: http://stackoverflow.com/comment/40351618

http://stackoverflow.com/comment/40225925
score: 0
has text: yeah sure! I will add an example! and yeah I corrected the "It's the variable a that can h....." Thanks for pointing!
comment on: http://stackoverflow.com/a/25729639
type: Comment
type: AnswerComment

http://stackoverflow.com/q/25713956
score: 1
tagged with: java
upvote count: 1
type: Question
has body: In an Android app, I need to convert this... "Hello,\nWorld!" ...into this... "Hello,\u000dWorld!" ...in order to spit this "converted" string to a remote server through JSON. How do I accomplish that, preferably WITHOUT the use of anything but the "standard" Java/Android API?
has answer: http://stackoverflow.com/a/25715075
has title: Android/Java - convert escaped control characters to escaped Unicode character
answer count: 1
downvote count: 0
tagged with: unicode
favorite count: 0
tagged with: unicode-escapes
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/comment/40233656
score: 0
has text: @KodeSeeker I have added this as an answer, so the next person that has your symptoms can find it. It sounds like you are on to your next problem (what is wrong with your spring configuration). You should ask about this as a separate question (if you cannot solve it on your own).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25732993

http://stackoverflow.com/q/25782760
tagged with: jena
has body: I am trying this tutorial and want to run the following code: public class test extends Object { // some definitions static String personURI = "http://somewhere/JohnSmith"; static String fullName = "John Smith"; public static void main (String args[]) { // create an empty model Model model = ModelFactory.createDefaultModel(); // create the resource Resource johnSmith = model.createResource(personURI); // add the property johnSmith.addProperty(VCARD.FN, fullName); } } These are my project settings: However, I am getting an: Exception in thread "main" java.lang.UnsupportedClassVersionError: com/hp/hpl/jena/rdf/model/ModelFactory : Unsupported major.minor version 51.0 at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(Unknown Source) at java.lang.ClassLoader.defineClass(Unknown Source) at java.security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$000(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 com.dataGenerator.test.test.main(test.java:15) Any recommendations what I am doing wrong? I appreciate your answer!
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25782820
tagged with: stream
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: Apache Jena - java.lang.UnsupportedClassVersionError: com/hp/hpl/jena/rdf/model/ModelFactory
accepted answer: http://stackoverflow.com/a/25782820

http://stackoverflow.com/a/25717044
has comment: http://stackoverflow.com/comment/40203202
has body: I believe there is a easier way to solve your issue, and you can find your answer in ASCII table As you see, words have some number related to them like capital A is 65 and small c is 99, as a result, you can go through the number and use casting processes to get char you want. read more casting from string to int I think you should try this Code: String s = "eh az"; for (int i = 0; i &lt; s.length(); i++) { int a = s.charAt(i); if (a &gt;= 97 &amp;&amp; a &lt;= 119) { System.out.print((char) (s.charAt(i) + 3)); } else if (a &gt;= 120 &amp;&amp; a &lt;= 122) { a -= 23; System.out.print((char) a); } else if (a == 32) { System.out.print(" "); } } output: hk dc
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40202851
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25715535
has comment: http://stackoverflow.com/comment/40215897
accepted answer of: http://stackoverflow.com/q/25715535

http://stackoverflow.com/comment/40257666
comment on: http://stackoverflow.com/q/25746280
has text: Why not creating `new TreeSet<String>(dict);` ?
type: Comment
type: QuestionComment
score: 0

restful-architecture
type: Tag
tags question: http://stackoverflow.com/q/25828614
tag name: restful-architecture

http://stackoverflow.com/comment/40264414
type: AnswerComment
comment on: http://stackoverflow.com/a/25729129
score: 0
type: Comment
has text: Thanks for the suggestion of Xuggler. However I found out that OpenCV has built-in webcam input options. So I guess I won't be needing Xuggler! I'll keep it in mind for later though; I'm sure it'll come in handy for some future project.

http://stackoverflow.com/comment/40366825
score: 0
type: Comment
has text: ya sorry ..Its my mistake.. i am hitting like this http:\localhost:8080\FIRST\MyServlet
type: AnswerComment
comment on: http://stackoverflow.com/a/25806286

http://stackoverflow.com/q/25788937
has body: I'm studying the concepts of pointers. The following list has hypothetical pointers, one pointing to the previous number, and another one, to the next number. And, there's also an element pointing to the current number. When I run the code, the console returns "NullPointerException". The logic behind the code seems okay to me. I'm a beginner and I'd really appreciate some help. I tried to comment the code as much as I could so it can be clearer to understand. Thank you. aux = start; //aux points to the start of the list. both of them are of the type 'List' int prev = start.num; //prev points to the number on the start position. both of them are of the type 'int' while (aux.next != null) { //aux.next means the pointer to the next element in the list if (aux.num &gt;= aux.next.num) { //if the current number is greater than the next number, or equal prev = aux.next.num; //prev recieves the lower number aux.next.num = aux.num; //the greater number is put after the lower number aux.num = prev; //the lower number is put before the greater number } aux = aux.next; //the current element takes a step to the next element so I can progress through the list aux.num = aux.next.num; } Edit: I forgot to say that this list has to be ordered ascending. It also has to be ordered descending on another method.
tagged with: list
tagged with: java
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25789480
has comment: http://stackoverflow.com/comment/40334305
has comment: http://stackoverflow.com/comment/40334492
has answer: http://stackoverflow.com/a/25789078
has title: "NullPointerException" while sorting a double linked List
has comment: http://stackoverflow.com/comment/40334299
tagged with: nullpointerexception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40334914

http://stackoverflow.com/comment/40305338
score: 1
comment on: http://stackoverflow.com/q/25772754
type: QuestionComment
has text: thread which u sleep for ure period of time?
type: Comment

http://stackoverflow.com/comment/40483640
comment on: http://stackoverflow.com/q/25870635
has text: Are u asking how to pass data into the main method??While executing the java code you pass the value which would be accepted by String args using command line . eg java MyProg arg0 arg1
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/25843017
has body: For the lyrics part, while there are many ways to implement it, one way is to store phrases from your lyrics in an arraylist of strings and display each phrase at its specific time while the song is playing. Use Media Player getCurrentPosition() to get the current playback time and display lyrics from your arraylist at the time it should appear on the screen. Further develop your algorithms to make it more efficient but you get the idea.. For the music playing and recording part you should use Media Player and Media Recorder. There are other ways to play and record audio but they are more complicated. So, Media Player example: Uri myUri = ....; // initialize Uri here MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC); mediaPlayer.setDataSource(getApplicationContext(), myUri); mediaPlayer.prepare(); mediaPlayer.start(); more details here Media Player Media Recorder example: MediaRecorder recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); recorder.setOutputFile(PATH_NAME); recorder.prepare(); recorder.start(); // Recording is now started ... recorder.stop(); recorder.reset(); // You can reuse the object by going back to setAudioSource() step recorder.release(); // Now the object cannot be reused more details here: Media Recorder Good luck!!
score: 3
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/25842690
downvote count: 0

http://stackoverflow.com/comment/40225052
comment on: http://stackoverflow.com/q/25728948
has text: Yes, this is a book I am talking about. There is no such a class. This looks like abstraction or something I dont get.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25736487
has body: User directory is tricky unless you are in control of the main program (as when it works for you). I would suggest that you put the config file with the code itself (that's to say in src/main/resources. If you put it directly in that directory, you should be able to find it using getClass().getResource("/ini.yaml"); Alternatively, you can put it in the parallel package (of the class where you need to find it) under resources and then you would use getClass().getResource("ini.yaml");
score: 1
has comment: http://stackoverflow.com/comment/40355273
upvote count: 1
has comment: http://stackoverflow.com/comment/40382443
has comment: http://stackoverflow.com/comment/40293116
accepted answer of: http://stackoverflow.com/q/25736392
has comment: http://stackoverflow.com/comment/40355291
answers question: http://stackoverflow.com/q/25736392
has comment: http://stackoverflow.com/comment/40244082
has comment: http://stackoverflow.com/comment/40292836
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/25834070
has comment: http://stackoverflow.com/comment/40420225
has title: Spring exception Handling : the @exception handler is not invoked
answer count: 2
has answer: http://stackoverflow.com/a/36750298
has comment: http://stackoverflow.com/comment/42089466
possible better answer: http://stackoverflow.com/a/26729123
favorite count: 0
has comment: http://stackoverflow.com/comment/40420530
has body: Im' working on a spring application lately using hibernate, thymeleaf and spring security. I stumbled upon a situation : i made a custom Exception : @ResponseStatus(HttpStatus.BAD_REQUEST) public class GlobalUrlParametersErrorsException extends RuntimeException { private String errorMsgSignature; private String errorMsgContent; private String redirectionUrl; public String getErrorMsgSignature() { return errorMsgSignature; } public void setErrorMsgSignature(String errorMsgSignature) { this.errorMsgSignature = errorMsgSignature; } public String getErrorMsgContent() { return errorMsgContent; } public void setErrorMsgContent(String errorMsgContent) { this.errorMsgContent = errorMsgContent; } public String getRedirectionUrl() { return redirectionUrl; } public void setRedirectionUrl(String redirectionUrl) { this.redirectionUrl = redirectionUrl; } public GlobalUrlParametersErrorsException(String errorMsgSignature, String errorMsgContent, String redirectionUrl){ this.errorMsgSignature = errorMsgSignature; this.errorMsgContent = errorMsgContent; this.redirectionUrl = redirectionUrl; } } This exception is extended by some other custom exceptions i wrote. To handle these exceptions i added a @ControllerAdvice : @ControllerAdvice public class GlobalDefaultExceptionHandler { //some other exception like hibernate exception ... @ExceptionHandler( value = GlobalUrlParametersErrorsException.class)//{InvalidDateException.class, InvalidRole.class, NoSuchUser.class, NoSuchNotification.class,NoSuchConsultation.class,NoSuchRdv.class}) public ModelAndView whenUrlDateParametersSuckMethod(RedirectAttributes redirectAttributes,GlobalUrlParametersErrorsException e){ redirectAttributes.addFlashAttribute(e.getErrorMsgSignature(),e.getErrorMsgContent()); return new ModelAndView("redirect:"+e.getRedirectionUrl()); } @ExceptionHandler(value = Exception.class) public ModelAndView defaultErrorHandler(HttpServletRequest req, Exception e) throws Exception { ModelAndView m = new ModelAndView("errors/de…
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/96614678
has answer: http://stackoverflow.com/a/26729123
type: Question
linked to: http://stackoverflow.com/q/52392820
accepted answer: http://stackoverflow.com/a/36750298
downvote count: 0
has comment: http://stackoverflow.com/comment/42047577

http://stackoverflow.com/comment/40322973
type: Comment
type: QuestionComment
has text: you need to debug to determine whether `name` is null or `drug.get(position)` is null
comment on: http://stackoverflow.com/q/25782407
score: 0

http://stackoverflow.com/q/25799975
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25800055
type: Question
answer count: 2
upvote count: 0
has title: Why is my else statement not working correctly?
has body: so basically I have a random number generator and if the number is 3, (which is common for the purpose of testing), it will "spawn" a monster and it comes up with a while loop saying that while the monsters health is > 0 keep repeating the while loop, and it says else, say You defeated the monster. But for some reason, it keeps saying You Defeated the Monster when the monsters health is any number, yet still asks me to do another attack. any suggestions? Random dice = new Random(); for(int counter=1; counter&lt;=3; counter++) { number = 1+dice.nextInt(3); if(number==(3)) { monster_base_health = 600; monster_base_dmg = 60; System.out.println("A monster appeared!!"); while(monster_base_health&gt;0) { System.out.println("Would you like to use 1. Fire Blast, 2. Ice Blast, 3. Void Ray? (Just type 1, 2, or 3)"); System.out.println(); int attack; attack = input.nextInt(); if(attack==1) { monster_base_health = monster_base_health - mage_fire; System.out.println("You used Fire Blast. The Monster now has " + monster_base_health + " health!"); System.out.println(); } if(attack==2) { monster_base_health = monster_base_health - mage_iceblast; System.out.println("You used Ice Blast. The monster has " + monster_base_health + " health!"); System.out.println(); } if(attack==3) { monster_base_health = monster_base_health - mage_voidray; System.out.println("You used Void Ray. The monster has " + monster_base_health + " health!"); System.out.println(); } else { System.out.println("You defeated the monster!!!"); } } } } }
tagged with: while-loop
has answer: http://stackoverflow.com/a/25800466
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40355718
downvote count: 1
has comment: http://stackoverflow.com/comment/40356447

http://stackoverflow.com/comment/102883610
type: AnswerComment
has text: Yes but this is always int, it won't be long Like SystemClock.uptimeMillis().
type: Comment
comment on: http://stackoverflow.com/a/51949277
score: 0

http://stackoverflow.com/comment/40224897
type: Comment
has text: Homography is a matrix that describe the relationship between two planes.In this case one is distorted by perspective projection and another is where it is corrected. `findHomography` computes this matrix(`H`) based on 4 points(minimum required), if there are more than 4 points, it will calculate a least square fitting that minimizes the reprojection error. `warpPerspective` perform mapping of original image pixels into the new plane described by this matrix. Please consult online sources for more detailed explanation(http://www.cs.toronto.edu/~jepson/csc2503/tutorials/homography.pdf)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25726164

http://stackoverflow.com/a/25827547
accepted answer of: http://stackoverflow.com/q/25827511
type: Answer
has body: Use win2 = new Shell(win1, SWT.APPLICATION_MODAL) plus any other flags you are already using for the subordinate window.
downvote count: 0
score: 3
upvote count: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25827511

http://stackoverflow.com/q/25855735
score: -1
has title: Threads/Sockets in a client server mini application
has body: I basically try to make a simple domain resolver using sockets. I am pretty far and I its working how it is now. Except my main function where I try to make a thread which keeps listening and waiting for another call. After I type www.google.com it gives me the address but when I try it again, it does nothing. I think the socket closes or something. I wanted to use threads and while loops but I'm struggling with this problem for hours. Client side ( EchoClient.java ) package tetst222; import java.io.*; import java.net.*; public class EchoClient { public static void main(String[] args) throws IOException { try { Socket sock = new Socket("localhost", 1350); PrintWriter printout = new PrintWriter(sock.getOutputStream(),true); InputStream in = sock.getInputStream(); BufferedReader bin = new BufferedReader(new InputStreamReader(in)); String line; while((line = bin.readLine()) != null) { System.out.println(line); } //sock.close(); } catch(IOException ioe) { System.err.println(ioe); } } } And this code: Server side ( EchoServer.java ) package tetst222; import java.net.*; import java.io.*; import java.lang.*; import java.util.*; public class EchoServer //implements Runnable { public static void main(String[] args) throws IOException { try { ServerSocket sock = new ServerSocket(1350); while(true) { // open socket Socket client = sock.accept(); PrintWriter printout = new PrintWriter(client.getOutputStream(),true); printout.println("Je bent succesvol verbonden met de host"); printout.println("Geef een hostnaam op waarvan je het IP-adres wilt achterhalen:"); //get input from client InputStream in = client.getInputStream(); BufferedReader bufin = new BufferedReader(new InputStreamReader(System.in)); /* Thread t = new Thread(); t.start(); */ String host = ""; Scanner sc = new Scanner(System.in); System.out.println("Typ de host die u wilt resolven: "); host = sc.nextLine(); try { InetAddress ia = InetAddress.getByName(host); System.out.println(ia); } catch(UnknownHostException uhe…
favorite count: 0
upvote count: 0
type: UnansweredQuestion
tagged with: sockets
tagged with: multithreading
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/25856339
type: Question
tagged with: client-server
answer count: 1

http://stackoverflow.com/q/25747736
accepted answer: http://stackoverflow.com/a/25757074
answer count: 1
has comment: http://stackoverflow.com/comment/40262545
favorite count: 0
has comment: http://stackoverflow.com/comment/40261320
has title: How to populate the output of method in text file
upvote count: 2
has answer: http://stackoverflow.com/a/25757074
type: AnsweredQuestion
has body: I have a method Report Dose stat in Java: public String getReportDoseStat(){ double maxdose=getMaxDose(); String s=("Average dose:\t"+getAvDose()+"\n"); s+=("Max dose:\t"+maxdose+"\n"); s+=("Pixels 90% of max dose or more:\t"+getNmbrPixDose(maxdose*0.9)+"/"+getNmbrPixDose(0.0)+"\n"); s+=("Pixels 50% of max dose or more:\t"+getNmbrPixDose(maxdose*0.5)+"/"+getNmbrPixDose(0.0)+"\n"); s+=("Pixels 10% of max dose or more:\t"+getNmbrPixDose(maxdose*0.1)+"/"+getNmbrPixDose(0.0)+"\n"); return s; } I would like to write the values generated from the this code to a table written in the method: public void writeDosesTable(String p)// writing the dose table { { PrintStream fos; try{ fos=new PrintStream(new File(p)); String s; for(int j=0;j&lt;nz;j++){ s=""; for(int i=0;i&lt;nx;i++){ s+=det_els.get(j+i*nz).getDose()+";";// comma separated or Semicolon separated mentioned here } fos.println(s); // prints out the stream of values in Doses table separated by Semicolon } fos.flush(); fos.close(); } catch (IOException e){ e.printStackTrace(); } //finally //{fos.close();} } } How could I possibly generate such a thing?
score: 1
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40262482
has comment: http://stackoverflow.com/comment/40262635
has comment: http://stackoverflow.com/comment/40261050
has comment: http://stackoverflow.com/comment/40262984
has comment: http://stackoverflow.com/comment/40260626
tagged with: file-io
has comment: http://stackoverflow.com/comment/40262297

http://stackoverflow.com/a/25786672
has body: Without the stack trace I don't know if this is the specific issue you've hit as I saw several things that looked a bit off. This is definitely wrong though: while(intList.elementAt(i) &lt; intList.elementAt(j)) { if (j &lt; 0) { break; } j--; } You decrement j, then you fetch the element at j, then you check for &lt; 0 having already used it.
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25786542
downvote count: 0

http://stackoverflow.com/a/25780466
score: 0
type: AcceptedAnswer
has body: you can simply store your data in a List... String moduleId = request.getParameter("moduleId").trim(); String temp[] = moduleId.split("/"); for(String s:temp){ String modId[]=s.split("/"); PreparedStatement ps = null; Connection connection=DatabaseConnection.getConnection(); ps=connection.prepareStatement("select * from testcase_sahi where module_id=?"); ps.setString(1,modId[0]); ResultSet rs=ps.executeQuery(); List temporaryList = new ArrayList(); //HERE while(rs.next()){ System.out.println(".............TC ID...."+rs.getString("testcase_id")); System.out.println(".............TC Name...."+rs.getString("testcase_name")); testCase=rs.getString("testcase_name"); temporaryList.add(testCase); //HERE } serializeData(temporaryList) //and HERE }
type: Answer
answers question: http://stackoverflow.com/q/25780037
accepted answer of: http://stackoverflow.com/q/25780037

http://stackoverflow.com/comment/40485145
comment on: http://stackoverflow.com/q/25871228
has text: Hlo, user separate index-variable for -ve and +ve arrays
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40443085
comment on: http://stackoverflow.com/q/25847798
has text: @CocoNess even i tried that but result is,"different is :05:30:00"
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40318883
type: QuestionComment
comment on: http://stackoverflow.com/q/25779961
has text: If the medium parameter is null, simply don't include the `AND (art.medium is NULL OR art.medium = :medium)` clause in the query.
score: 0
type: Comment

http://stackoverflow.com/comment/40354574
type: AnswerComment
has text: @MichaelAnderson: I guess it depends on what you mean by rare. The chances of there being *at least one collision* may be pretty high, but the chances of any specific pair colliding are fairly small. Regardless, I'm saying that you've got to account for it anyway, so it doesn't matter too much ;)
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25799225

http://stackoverflow.com/a/39383191
downvote count: 0
has body: Do change the Orientation from Inherit to RIGHT_TO_LEFT
type: Answer
answers question: http://stackoverflow.com/q/25818933
score: 2
upvote count: 2

http://stackoverflow.com/comment/40434687
comment on: http://stackoverflow.com/q/25843241
score: 2
has text: can you give more suitable example input?
type: QuestionComment
type: Comment

android-vibration
tags question: http://stackoverflow.com/q/25748230
type: Tag
tag name: android-vibration
tags question: http://stackoverflow.com/q/25835675

http://stackoverflow.com/q/25785310
linked to: http://stackoverflow.com/q/13347222
downvote count: 0
favorite count: 0
has body: I´ve searching a lot and found like nothing that helps me for my problem. My Project is a homepage (using Java, Wicket, Tomecat and Maven) and I want to have two modules because I want to turn Module B off and on if want to. The Problem is I want to link from Module A to B and back. If I try to build my project it doesnt work. I guess its getting into a never ending cycle while building because he is searching for the dependecys... but how do I solve that problem? Module A -> Module B Module B <- Module A The dependencies of Module A looks like this: package.webapp module_b 1.0-SNAPSHOT compile The dependencies of Module B looks like this: package.webapp module_a 1.0.0-SNAPSHOT compile
accepted answer: http://stackoverflow.com/a/25785438
linked to: http://stackoverflow.com/q/16468525
tagged with: wicket
tagged with: maven
possible better answer: http://stackoverflow.com/a/25785436
has answer: http://stackoverflow.com/a/25785436
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25785438
has title: maven comunication between two modules (web)
answer count: 2

p6spy
type: Tag
tags question: http://stackoverflow.com/q/25727605
tag name: p6spy

http://stackoverflow.com/q/25802920
has comment: http://stackoverflow.com/comment/40364251
has title: Jersey web service gives javax.servlet.ServletException:
has comment: http://stackoverflow.com/comment/40364336
tagged with: rest
has comment: http://stackoverflow.com/comment/40364284
has comment: http://stackoverflow.com/comment/40364402
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25808242
has body: OK I have a problem with my web service. I am trying to make an API for a user but after I have deployed the app and try to GET all users it gives me an exception. Here is my api class: package api; import java.util.ArrayList; import javax.ws.rs.Consumes; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import model.UserManager; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import dto.User; @Path("/user") public class UserAPI { @POST @Path("create-user/{user}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response saveUser(@PathParam("user") User user) throws JSONException { UserManager userManager = new UserManager(); userManager.createUser(user); return Response.status(200).build(); } @GET @Produces(MediaType.APPLICATION_JSON) public JSONObject getAllUsers() throws JSONException { JSONObject users = null; try { ArrayList&lt;User&gt; usersList = null; UserManager userManager = new UserManager(); usersList = userManager.getUsers(); JSONObject usersObject = new JSONObject(); for(int i = 0; i &lt; usersList.size(); i++) { usersObject.put("users", usersList); } users = usersObject; } catch(Exception e) { e.printStackTrace(); } return users; } @POST @Path("edit-user/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response editUser(@PathParam("id") int id) throws JSONException { UserManager userManager = new UserManager(); userManager.editUser(id); return Response.status(200).build(); } @POST @Path("delete-user/{id}") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response deleteUser(@PathParam("id") int id) throws JSONException { UserManager userManager = new UserManager(); userManager.deleteUser(id); return Response.status(200).build(); } @POST @Path("user-login/{us…
has comment: http://stackoverflow.com/comment/40364088
tagged with: tomcat7
has answer: http://stackoverflow.com/a/25809925
tagged with: web-services
has comment: http://stackoverflow.com/comment/40364216
type: Question
tagged with: java
score: 0
answer count: 2
tagged with: jersey
has comment: http://stackoverflow.com/comment/40364193

http://stackoverflow.com/comment/40355652
comment on: http://stackoverflow.com/q/25800012
has text: Hi Kenwoodjen, when asking a question it pays to to state what the program is doing and what it should be doing, rather than just say here's my code(please read my mind).
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/47953856
score: 3
answers question: http://stackoverflow.com/q/25825864
downvote count: 0
type: Answer
has body: I like to pass the full Program.java filename as the input parameter, allowing easy autocompletion. Here's an edited version of notcompletelyrational's script, which expects commands like jcar Program.java rather than jcar Program: jcar() { f=$1 f2=${f%.*} trap "rm $f2.class" SIGINT SIGTERM javac $1 java $f2 rm $f2.class }
upvote count: 3

http://stackoverflow.com/comment/40280156
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25744779
has text: I'm just guessing but it seems you are sending the file to every channel BUT the freshly connected one `if(c != ctx.channel())`.

http://stackoverflow.com/q/25714245
has body: public void paint(Graphics g) { myWidth = getSize().width; // get this Applet size myHeight = getSize().height; double xCoord, yCoord; int yPixel; String str = JOptionPane.showInputDialog("Enter your name."); g.drawString(str, 100, 100); for (int xPixel = 0; xPixel &lt; myWidth; xPixel++) { xCoord = (double) (xPixel - myYAxisHPos) / myXUnitPixels; yCoord = f(xCoord); yPixel = (int) (myXAxisVPos - yCoord * myYUnitPixels); g.drawLine(xPixel, yPixel, xPixel, yPixel); } } I'm wondering why it opens twice when I start my applet. Any help would be appreciated.
tagged with: java-2d
type: UnansweredQuestion
has title: JOptionPane.showinputdialog opening twice in applet
tagged with: java
has answer: http://stackoverflow.com/a/25728943
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/40224673
tagged with: awt
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25729031
tagged with: applet

http://stackoverflow.com/a/25799073
type: Answer
has body: Just invert the indexes' order like this: for (int j = 0; j&lt;array[0].length; j++){ for (int i = 0; i&lt;array.length; i++){ because all rows has same amount of columns you can use this condition j &lt; array[0].lengt in first for condition due to the fact you are iterating over a matrix
downvote count: 0
score: 12
has comment: http://stackoverflow.com/comment/40354035
answers question: http://stackoverflow.com/q/25798958
upvote count: 12

http://stackoverflow.com/q/25753723
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40271307
tagged with: java
type: Question
has body: With Java 8 removing PermGen, we can no longer use the JVM arguments to change it or limit it. But if I have a memory leak in my app, I want to know about it. I do not want the JVM to allocate gigabytes of memory. So my question is: how far will it go, when will it stop, and can I limit it from the OS (using ulimit)?
downvote count: 0
has answer: http://stackoverflow.com/a/25753750
answer count: 1
accepted answer: http://stackoverflow.com/a/25753750
score: 8
favorite count: 0
upvote count: 8
has title: How far does the new metaspace go and when will it stop
tagged with: java-8

http://stackoverflow.com/q/25790438
tagged with: junit4
tagged with: ant
upvote count: 5
tagged with: java
score: 5
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30246746
has body: I am using JUnit4 and want to put some extra information to be displayed in JUnit reports. For this, I shall be dumping the extra information to the report xml and then modify the xslt to read that extra information to generate the HTML report. Steps so far that are working are: Copied all the code from XMLJUnitResultFormatter to MyFormatter.java and modified the endTest() method to add that extra information in the form of an extra attribute to testcase XML tag. This is really bad :( but I could not simply override it as there usages of the private instance variables directly without getters/setters in endTest() method. My junit ant task: &lt;junit fork="yes" printsummary="withOutAndErr"&gt; &lt;!--&lt;formatter type="xml"/&gt;--&gt; &lt;formatter classname="com.some.junit.MyFormatter" extension=".xml"/&gt; &lt;test name="com.some.source.MyTestClassTest" todir="${junit.output.dir}"/&gt; &lt;classpath refid="JUnitProject.classpath"/&gt; &lt;/junit&gt; Modified the xslt to read the extra attribute of TESTCASE xml tag and display in report. My modified ant task for report: &lt;target name="junitreport" depends="MyTestClassTest"&gt; &lt;junitreport todir="${junit.output.dir}"&gt; &lt;fileset dir="${junit.output.dir}"&gt; &lt;include name="TEST-*.xml"/&gt; &lt;/fileset&gt; &lt;report styledir="reportstyle" format="frames" todir="${junit.output.dir}"/&gt; &lt;/junitreport&gt; &lt;/target&gt; I came across using TestNG nor SureFire Maven plugins as solutions, but I can't use them in my project. Is there any better way than this in JUnit4?
type: Question
has title: Adding extra information in JUnit reports

http://stackoverflow.com/q/25795568
has answer: http://stackoverflow.com/a/25795916
has answer: http://stackoverflow.com/a/25795749
has comment: http://stackoverflow.com/comment/40347226
score: 2
has title: How to redirect a file as an input to Java program with bash?
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40347380
has comment: http://stackoverflow.com/comment/40347457
type: Question
answer count: 2
downvote count: 0
has body: My code roughly looks like this: InputStreamReader isReader = new InputStreamReader(System.in); BufferedReader bufReader = new BufferedReader(isReader); while (true) { try { String inputStr = null; if ((inputStr=bufReader.readLine()) != null) { //DO SOMETHING } else { System.out.println("input is null"); } } catch (Exception e) { //DO SOMETHING } } When I run java -classpath ../src test.TestProgram &lt; filename it process the first line in the file well, but it keeps printing input is null and never goes to the second line. How can I modify my program to to tell it let the error input go and go to the next line? PS: the file I need to precess is like below: 111111111 111111112 111111113 ... I tried java -classpath ../src test.TestProgram &lt; filename echo `cat filename` | java -classpath ../src test.TestProgram java -classpath ../src test.TestProgram &lt;&lt;&lt; `cat filename` and they all failed My fault... I put "BufferedReader bufReader = new BufferedReader(new InputStreamReader(System.in))" inside the loop... Thanks everybody!
has comment: http://stackoverflow.com/comment/40347206
possible better answer: http://stackoverflow.com/a/25795749
tagged with: bash
accepted answer: http://stackoverflow.com/a/25795916
favorite count: 0
has comment: http://stackoverflow.com/comment/40347150
upvote count: 2
has comment: http://stackoverflow.com/comment/40347185
has comment: http://stackoverflow.com/comment/40347317

http://stackoverflow.com/comment/40408760
comment on: http://stackoverflow.com/a/25829285
has text: @RyanBrady : I also think it would be an efficient way to do it. If you want to have 4 digits, or any number of digits, this can be done with minor changes in the code. Finally, there are a total of 1000 possible combinations and you have only 48 in your example, so the probability of not having duplicates is quite high.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25847550
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40443149
has title: How to continue webdriver test on pageLoadTimeout exception?
tagged with: selenium-webdriver
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40442694
tagged with: java
has body: I am running my test cases on Selenium Webdriver.I have a scenario where on clicking on a particular button, page starts loading for infinite time. Since the click commands doesn't completes, I am unable to stop the page load using webdriver sendkeys(Keys.Escape) function. I tried using, driver.manage().timeouts().pageLoadTimeout(3L, TimeUnit.SECONDS); to stop the page load, but it also fails the test case. Tried using try catch for the same. What I want is that page load should stop after 3 seconds, and test should continue with the next step. How can I handle pageLoadTimeout so that it does not fails my test and stop page load in 3 seconds. Any help is appreciated.
has answer: http://stackoverflow.com/a/25879993
type: Question

http://stackoverflow.com/comment/40435742
type: Comment
type: QuestionComment
has text: See [How to Use Progress Monitors](http://docs.oracle.com/javase/tutorial/uiswing/components/progress.html#monitors) & get back to us if you have any problems ..with the **code** that is having the problem. Voting to close as 'too broad'.
score: 1
comment on: http://stackoverflow.com/q/25843276

http://stackoverflow.com/comment/40486213
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25871733
has text: I don't want to ask a stupid question, but you've not started an infinite loop have you? Is it being sent a character code 13?
score: 0

http://stackoverflow.com/q/25719984
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25720024
possible better answer: http://stackoverflow.com/a/25720120
has answer: http://stackoverflow.com/a/25720120
type: Question
answer count: 2
has body: I have one Bicycle class that is parent. I want to have two sub classes for front wheel and back wheel. Is there any way I can create only one instance of super class and then create two separate instances of sub classes that share only one instance of the super class. Basically bicycle is one, but wheels are two and hence common variables of bicycle must be instantiated only once. I would like to go for IS-A relationship so that I can re-use many variables and methods. Also I cannot use static here because each bicycle is different instance. Ex: class Bicycle { String name; int year; double price; } class FrontWheel extends bicycle { double wheelSize; } class BackWheel extends bicycle { double wheelSize; } In main program, if I create instances of FrontWheel and BackWheel, obviously two sets of common variables (year, name etc) are getting created right. Is there anyway to avoid duplication of memory allocation for common variables? Any other options available in Java?
score: 0
has comment: http://stackoverflow.com/comment/40207972
has comment: http://stackoverflow.com/comment/40207960
has answer: http://stackoverflow.com/a/25720024
has title: Two subclasses Sharing only one instance of super class variable

http://stackoverflow.com/q/25872510
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
type: Question
accepted answer: http://stackoverflow.com/a/25872996
answer count: 1
downvote count: 0
favorite count: 0
tagged with: sql
has answer: http://stackoverflow.com/a/25872996
has body: im new with Hibernate and i have some issues when trying to persist an object in the database. @Entity @Table(name="order") public class Order implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long number; @Column(name="date") private Timestamp date; @Column(name="obs") private String obss; @OneToMany(fetch=FetchType.LAZY,cascade=CascadeType.ALL) @JoinColumn(name="id", referencedColumnName="number") private List &lt;OrderDetail&gt; orderDetail; (...) and the OrderDetail Class @Entity @Table(name="orderDetail") public class OrderDetail implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long id; @Column(name="orderType") private Long orderType; (...) When i try to save objects into DB i get the following ERROR: Hibernate: insert into order (date, obs, rejectObs, pid, destiny, stateId, userId, version) values (?, ?, ?, ?, ?, ?, ?, ?) Hibernate: insert into OrderDetail (boxId, date, digitalid, documentId, rejectObs, obs, orderId, stateId, orderType) values (?, ?, ?, ?, ?, ?, ?, ?, ?,) Hibernate: update OrderDetail set id=? where id=? 16/09/2014 11:50:03 org.hibernate.util.JDBCExceptionReporter logExceptions WARNING: SQL Error: 8102, SQLState: S1000 16/09/2014 11:50:03 org.hibernate.util.JDBCExceptionReporter logExceptions ERROR: Cannot update identity column 'id'. 16/09/2014 11:50:03 org.hibernate.event.def.AbstractFlushingEventListener performExecutions GRAVE: Could not synchronize database state with session org.hibernate.exception.GenericJDBCException: could not insert collection: [com.sa.ra.entities.Order.orderDetail#4252] I dont know why Hibernate is trying to update the orderDetail table. Does someone kwows whats going on? im using SQL Server 2008 and hibernate 3.5.0
upvote count: 1
has title: Hibernate Insert is trying to update identity column

http://stackoverflow.com/comment/40458081
type: AnswerComment
score: 0
type: Comment
has text: http://developer.android.com/training/implementing-navigation/nav-drawer.html This tutorial on the Android Developer site should get you started properly
comment on: http://stackoverflow.com/a/25854890

http://stackoverflow.com/q/25738062
type: Question
has comment: http://stackoverflow.com/comment/40242537
has comment: http://stackoverflow.com/comment/40242585
tagged with: webserver
score: 0
tagged with: multipart
has comment: http://stackoverflow.com/comment/40243121
has title: How to validate a file extension and discard the http request if the extension is not supported
tagged with: file-upload
type: UnansweredQuestion
has body: I am trying to write a webservice class which actually handles multipart requests. T client will try to upload zip or tar.gz files which may be upto 1GB in size. I dont want to validate the extension i client side. I want to validate the file extension in server side and discard the request before the file is uploaded. How can I do this? Thanks all in advance.
has comment: http://stackoverflow.com/comment/40242806
has comment: http://stackoverflow.com/comment/40242711
has comment: http://stackoverflow.com/comment/40242898
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40242759

http://stackoverflow.com/a/25836775
has comment: http://stackoverflow.com/comment/40422562
has comment: http://stackoverflow.com/comment/40422590
has body: Just use the getter from the testClass: TextView2.setText(Integer.toString(Object.getIntegerValue()));
has comment: http://stackoverflow.com/comment/40452864
has comment: http://stackoverflow.com/comment/40422726
has comment: http://stackoverflow.com/comment/40424264
score: 0
has comment: http://stackoverflow.com/comment/40422855
has comment: http://stackoverflow.com/comment/40423015
answers question: http://stackoverflow.com/q/25836613
type: Answer

http://stackoverflow.com/a/25809500
has body: You must cast to byte. Since a and b are of type byte, Java will convert them to an int, and then the result is an int. byte c = (byte) (a+b);
downvote count: 0
type: Answer
upvote count: 2
score: 2
answers question: http://stackoverflow.com/q/25809186

http://stackoverflow.com/a/25787718
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25786790
answers question: http://stackoverflow.com/q/25786790
type: Answer
has comment: http://stackoverflow.com/comment/40332578
has comment: http://stackoverflow.com/comment/40364039
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/40334266
upvote count: 3
has body: "unconventional structure" - I'm betting that's your problem. It's impossible to tell without seeing your project, but I can assume you that IntelliJ IDEA 12 and 13 both behaved as expected. Your assumptions aren't being met; check your assumptions. Leave Maven out of it and set up IntelliJ without it.

http://stackoverflow.com/comment/40268368
has text: What are the types of `Point` x and y? Are they doubles?
score: 1
comment on: http://stackoverflow.com/q/25752291
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25774353
has body: Short version: Use BigDecimal and it's scale() method. Initialize however you wish. Long version: You specifically mentioned that you prefer the solution you use to be "Math only" (ambiguous but I can guess what you mean) Get the number of digits from a double, presumably the fractional part (based on your expected output) Here is a solution that uses java.math.BigDecimal to do so: List&lt;BigDecimal&gt; list = new ArrayList&lt;BigDecimal&gt;() {{ add(BigDecimal.valueOf(0.0000000018)); add(BigDecimal.valueOf(123)); add(BigDecimal.valueOf(1.12)); add(BigDecimal.valueOf(1.0001)); add(BigDecimal.valueOf(2.340000)); add(BigDecimal.valueOf(0.10)); }}; for (BigDecimal bd : list) { System.out.println(bd + " --&gt; " + bd.scale()); } Outputs: 1.8E-9 --&gt; 10 123 --&gt; 0 1.12 --&gt; 2 1.0001 --&gt; 4 2.34 --&gt; 2 0.1 --&gt; 1 Note that instantiating BigDecimal from double like this will eventually give you surprising results. Consider the scale() of BigDecimal.valueOf(0.1 + 0.1 + 0.1), which is 17. This is because 0.1 (and most other ~ 97% of numbers in range) cannot be represented exactly by double, which introduces rounding errors in calculations. Also note that using scale() functions where solutions involving manipulating the results of toString() would fail. Double.toString() is well defined, and can produce a range of outputs beyond what one may think of as "decimal notation" of a double.
answers question: http://stackoverflow.com/q/25773721
upvote count: 14
downvote count: 1
type: Answer
score: 13

http://stackoverflow.com/a/25787216
score: 1
upvote count: 1
downvote count: 0
type: Answer
has body: Just define them as transient. private String serializedField; // gets serialized private transient String field; // doesn't get serialized
answers question: http://stackoverflow.com/q/25787182

http://stackoverflow.com/q/25771841
answer count: 1
favorite count: 0
type: AnsweredQuestion
score: -5
has comment: http://stackoverflow.com/comment/40303575
has answer: http://stackoverflow.com/a/25771912
tagged with: java
has body: I would like to search in an input file for Students. Here is an overview of my work so far. Class Student, with setters, getters and a display method (print) Class StudentFile import java.io.*; import java.util.ArrayList; public class StudentFile { public void Trouver(int id) { try { File file = new File("C:/Users/Akram/Documents/akram.txt"); BufferedReader read = new BufferedReader(new FileReader(file)); String str; while((str=read.readLine())!=null) { Student s; if(s.getId()==id) System.out.println(s.print()); } read.close(); } catch(IOException e) { System.out.println(e); } } } This method display nothing, and I'm not sure why. Do you have any insight?
type: Question
accepted answer: http://stackoverflow.com/a/25771912
has comment: http://stackoverflow.com/comment/40306175
tagged with: api
upvote count: 0
has comment: http://stackoverflow.com/comment/40303692
downvote count: 5
tagged with: file-io
has title: Search Student in File

http://stackoverflow.com/q/25721112
has title: SpringMVC How to start a thread with start of application
has body: In my springmvc application i want to start a thread for some iterative work which is going to be repeated after every 30 seconds for the life of application. where should I start this thread should I write a separate servlet for it? or should I start it in some controller?
answer count: 2
has answer: http://stackoverflow.com/a/25721230
upvote count: 2
favorite count: 0
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/25721200
has answer: http://stackoverflow.com/a/25721200
tagged with: spring-mvc
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/25721230
downvote count: 0
tagged with: java
type: Question

http://stackoverflow.com/q/25817329
score: 0
linked to: http://stackoverflow.com/q/4820353
type: UnansweredQuestion
tagged with: android
tagged with: bitmap
has title: Image cropping OutOfMemoryError on Galaxy devices
has answer: http://stackoverflow.com/a/25817547
has body: I have an app in production and am getting a lot of crashes on Galaxy devices. Stacktrace: java.lang.OutOfMemoryError at android.graphics.Bitmap.nativeCreate(Native Method) at android.graphics.Bitmap.createBitmap(Bitmap.java:669) at android.graphics.Bitmap.createBitmap(Bitmap.java:604) at android.graphics.Bitmap.createBitmap(Bitmap.java:530) at com.edmodo.cropper.CropImageView.getCroppedImage(CropImageView.java:357) at com.myapp.app.MyPhotoActivity$3.onClick(MyPhotoActivity.java:308) at android.view.View.performClick(View.java:4191) at android.view.View$PerformClick.run(View.java:17229) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4960) 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:1038) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805) at dalvik.system.NativeStart.main(Native Method) Types of devices: Galaxy S2 (GT-I9100T) Galaxy S2 (SGH-T989) Galaxy Note II (t03g) Galaxy Note2 (t0ltetmo) Galaxy Note2 (t0ltespr) Galaxy S3 (d2vmu) Electrify M (solstice) Galaxy S5 (kltespr) Galaxy Exhibit (codinaMetroPCS) Galaxy S3 (d2tmo) Galaxy S3 (d2ltetmo) Galaxy S2 Epic (SPH-D710) Galaxy Win (delos3geur) CropImageView // Crop the subset from the original Bitmap. (line 357 below) final Bitmap croppedBitmap = Bitmap.createBitmap(mBitmap, (int) actualCropX, (int) actualCropY, (int) actualCropWidth, (int) actualCropHeight); return croppedBitmap; } MyPhotoActivity usePhotoButton.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View view) { // line 308 below finalResizedBitmap = getResizedBitmap(mImageView.getCroppedImage(), PHOTO_RESIZE_VALUE, PHOTO_RESIZE_VALUE); topCropView.setVisibility(View.GONE); topFinalView.setVisibility(View.VISIBLE); mF…
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/comment/40491084
type: QuestionComment
comment on: http://stackoverflow.com/q/25868376
type: Comment
score: 1
has text: Call `frame.setVisible` _after_ `frame.pack`.

http://stackoverflow.com/a/25799897
type: Answer
has comment: http://stackoverflow.com/comment/40531568
answers question: http://stackoverflow.com/q/25751327
score: 0
has comment: http://stackoverflow.com/comment/40529925
has comment: http://stackoverflow.com/comment/40510262
has body: We can calculate the answer directly. A recursive formula can determine how much stock is needed to get from 1 to numbers that are powers of ten minus 1: f(n, power, target){ if (power == target) return 10 * n + power; else return f(10 * n + power, power * 10, target); } f(0,1,1) = 1 // a stock of 1 is needed for the numbers from 1 to 9 f(0,1,10) = 20 // a stock of 20 is needed for the numbers from 1 to 99 f(0,1,100) = 300 // a stock of 300 is needed for the numbers from 1 to 999 f(0,1,1000) = 4000 // a stock of 4000 is needed for the numbers from 1 to 9999 Where it gets complicated is accounting for the extra 1's needed when our calculation lands after the first multiple of any of the above coefficients; for example, on the second multiple of 10 (11-19) we need an extra 1 for each number. JavaScript code: function f(stock){ var cs = [0]; var p = 1; function makeCoefficients(n,i){ n = 10*n + p; if (n &gt; stock){ return; } else { cs.push(n); p *= 10; makeCoefficients(n,i*10); } } makeCoefficients(0,1); var result = -1; var numSndMul = 0; var c; while (stock &gt; 0){ if (cs.length == 0){ return result; } c = cs.pop(); var mul = c + p * numSndMul; if (stock &gt;= mul){ stock -= mul; result += p; numSndMul++; if (stock == 0){ return result; } } var sndMul = c + p * numSndMul; if (stock &gt;= sndMul){ stock -= sndMul; result += p; numSndMul--; if (stock == 0){ return result; } var numMul = Math.floor(stock / mul); stock -= numMul * mul; result += numMul * p; } p = Math.floor(p/10); } return result; } Output: console.log(f(600)); 1180 console.log(f(17654321)); 16031415 console.log(f(2147483647)); 1633388154

http://stackoverflow.com/comment/130013297
score: 0
type: Comment
has text: Surprisingly, I am working with rest assured with JAVA and suddenly I see this error. Adding a groovy jar file resolved the issue
type: AnswerComment
comment on: http://stackoverflow.com/a/25793187

http://stackoverflow.com/a/25834576
has body: When I duplicate your dependencies block inside a test project, I don't get your error. I think you have an extra jar file inside your libs directory that's causing the problem. This statement in your build file: compile fileTree(dir: 'libs', include: ['*.jar']) makes it automatically pick up any .jar files you put in that directory, so see if you have something in there you don't need. At any rate, with that wildcard include, this statement is redundant: compile files('libs/gson-2.2.jar') Also, instead of downloading GSON's jar and putting it manually into your libs directory, you can have it automatically download and manage it the same as you do for the com.koushikdutta.ion:ion dependency: compile 'com.google.code.gson:gson:2.2' There are newer versions of this library than 2.2; you might want to consider upgrading. http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.google.code.gson%22%20AND%20a%3A%22gson%22
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40423402
accepted answer of: http://stackoverflow.com/q/25820649
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25820649

http://stackoverflow.com/comment/40276112
comment on: http://stackoverflow.com/a/25751204
score: 0
type: Comment
has text: That's fine, thanks ... do you have release notes / change logs on those version updates? I need something that I can dig around to explain this behaviour
type: AnswerComment

http://stackoverflow.com/q/25790040
has comment: http://stackoverflow.com/comment/40336808
tagged with: java
type: Question
answer count: 2
downvote count: 4
upvote count: 0
has body: I have written this java program for sorting some numbers. But it doesn't stop executing. Can you help me with it? package inplacesort; import java.util.*; public class InplaceSort { static Scanner console = new Scanner(System.in); public static void main(String[] args) { Vector &lt;Integer&gt; intList = new Vector &lt;Integer&gt; (); //getting the numbers from the user char ans = 'y'; while (ans == 'Y' || ans == 'y') { System.out.print("Enter a Number: "); intList.addElement(console.nextInt()); System.out.print("Do You Want to Continue?(Y/N)"); ans = console.next().charAt(0); } System.out.println("Before Sorting the Numbers: " + intList); for (int i = 1; i &lt; intList.size(); i++) { int j = i - 1; while (j &gt; 0 &amp;&amp; intList.elementAt(i) &lt; intList.elementAt(j)) { j--; } for (int k = intList.size() - 1; k &gt;= j; k--) { intList.insertElementAt(intList.elementAt(k),k + 1); } intList.insertElementAt(intList.elementAt(i+1),j); intList.removeElementAt(i+1); } System.out.print(intList); } }
has title: This program in java doesn't stop executing
possible better answer: http://stackoverflow.com/a/25790201
has answer: http://stackoverflow.com/a/25790497
has answer: http://stackoverflow.com/a/25790201
favorite count: 0
accepted answer: http://stackoverflow.com/a/25790497
has comment: http://stackoverflow.com/comment/40336351
score: -4
type: AnsweredQuestion

http://stackoverflow.com/comment/40236317
has text: Java is not C. You can't assign `null` to a scalar variable.
score: 0
comment on: http://stackoverflow.com/q/25734921
type: Comment
type: QuestionComment

mutators
tags question: http://stackoverflow.com/q/25723751
type: Tag
tag name: mutators

http://stackoverflow.com/a/25725220
has body: This is the procedure, what i followed for one of my project. Please, have a look. It may lead you to find the solution as per your requirement. Create a class `RoundedTransform` and paste this code. import android.graphics.Bitmap; import android.graphics.BitmapShader; import android.graphics.Canvas; import android.graphics.Paint; import com.squareup.picasso.Transformation; public class RoundedTransform implements Transformation { @Override public Bitmap transform(Bitmap source) { int size = Math.min(source.getWidth(), source.getHeight()); int x = (source.getWidth() - size) / 2; int y = (source.getHeight() - size) / 2; Bitmap squaredBitmap = Bitmap.createBitmap(source, x, y, size, size); if (squaredBitmap != source) { source.recycle(); } Bitmap bitmap = Bitmap.createBitmap(size, size, source.getConfig()); Canvas canvas = new Canvas(bitmap); Paint paint = new Paint(); BitmapShader shader = new BitmapShader(squaredBitmap, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); paint.setShader(shader); paint.setAntiAlias(true); float r = size / 2f; canvas.drawCircle(r, r, r, paint); squaredBitmap.recycle(); return bitmap; } @Override public String key() { return "circle"; } } Then while calling the image view in your Activity,call as follows iv = (ImageView)rootView.findViewById(R.id.imageView1); String imageUrl = "image"; String url = "Pass your url"; if(url!=null){ imageUrl = url; } Picasso.with(getApplicationContext()).load(imageUrl).fit().centerCrop().transform(new RoundedTransform()).placeholder(R.drawable.ic_launcher).error(R.drawable.ic_launcher).into((ImageView)findViewById(R.id.imageView1));
answers question: http://stackoverflow.com/q/25724672
type: Answer
score: 0

http://stackoverflow.com/q/25848168
upvote count: 2
type: UnansweredQuestion
has body: I'm trying to retrieve the user name and a birthday from Facebook Graph API but I get resultcode as null in onActivityResult My code StatusCallback mCallback = new Session.StatusCallback() { public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { // make request to the /me API Request.newMeRequest(session, new Request.GraphUserCallback() { // callback after Graph API response with user object @Override public void onCompleted(GraphUser user, Response response) { if (user != null) { gu=user; } } }).executeAsync(); } } }; Session.OpenRequest request = new Session.OpenRequest(MainActivity.this); request.setPermissions(Arrays.asList( "basic_info","user_birthday")); request.setCallback(mCallback ); // get active session Session mFacebookSession = Session.getActiveSession(); if (mFacebookSession == null || mFacebookSession.isClosed()) { mFacebookSession = new Session(MainActivity.this); } mFacebookSession.openForRead(request); } And the onActivityResult public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Session.getActiveSession().onActivityResult(this, requestCode, resultCode, data); String fullName = ""; try { fullName = gu.getName(); } catch (NullPointerException e) { e.printStackTrace(); } String birthdate = ""; if (gu.getBirthday() != null &amp;&amp; !gu.getBirthday().isEmpty()) { try { String[] bdate=gu.getBirthday().split("/"); lable.setText(gu.getBirthday()); Month=Integer.parseInt(bdate[0]); Day=Integer.parseInt(bdate[1]); Year=Integer.parseInt(bdate[2]); } catch (NullPointerException e) { e.printStackTrace(); } } name.setText(fullName); String Name=name.getText().toString(); try { URL=URL+Day+"&amp;month="+Month+"&amp;year="+Year+"&amp;name="+URLEncoder.encode(Name, "utf-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } loader l=new loader(MainActivity.this); l.execute(URL); } The logcat 09-15 13:14:22.501: W/dalvikv…
has answer: http://stackoverflow.com/a/25848241
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: facebook-graph-api
favorite count: 0
has comment: http://stackoverflow.com/comment/43669249
tagged with: android
tagged with: facebook
has comment: http://stackoverflow.com/comment/40442760
score: 2
has title: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=-1, data=Intent

http://stackoverflow.com/comment/40354969
type: Comment
comment on: http://stackoverflow.com/a/25799125
type: AnswerComment
has text: `A1` through `A9` are been recreated on each loop, from what you just said, I don't think this is what you want...
score: 0

http://stackoverflow.com/comment/40431506
score: 0
comment on: http://stackoverflow.com/q/25841540
type: Comment
type: QuestionComment
has text: like the occurrance of any char like "a" of a given string. Something like: if str is string object then str.countOf("a");

http://stackoverflow.com/a/25828127
has body: so can't use a single return type for the function. Why not? The key to using JNI is to define your Java model (classes and public members) in a natural way. Some of the public members can be made native and implemented in JNI but it is often easier to create private native methods and helper methods so the JNI coding is cleaner and more natural to C. If it makes sense for com.funTest.testFunc to be a factory method, creating instances of itself, add some instance fields to the class for the results, then, in JNI, create an instance and populate its fields. Or, if you want a separate results class, define one and create it on the JNI side and return it. It all depends on the Java model that works best.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25819907

http://stackoverflow.com/comment/40364193
comment on: http://stackoverflow.com/q/25802920
score: 0
type: Comment
type: QuestionComment
has text: no I haven't. But this is a problem with GET method? because even when I just go to http://webservice-doms.rhcloud.com/rest/ without the "user" part it gives me that error.

http://stackoverflow.com/q/25835820
has comment: http://stackoverflow.com/comment/40434323
has comment: http://stackoverflow.com/comment/40838562
has title: Retrieving another user's information Parse.com
has body: I am trying to retrieve another user's info from parse.com. I need to get the "Location" that is part of the parse object that the user would have put in when they sign up. @Override public void onListItemClick(ListView l, View v, final int position, long id) { super.onListItemClick(l, v, position, id); // String user = mCurrentUser.getObjectId(); Object o = getListView().getItemAtPosition(position); String user = (String) o; final ParseObject newUser = mUser.getParseObject(user); String objId = newUser.getObjectId(); query.getInBackground(objId, new GetCallback&lt;ParseUser&gt;() { @Override public void done(ParseUser user, ParseException e) { if (e == null) { // String str = (String) // ParseUser.getCurrentUser().get("Location"); Object o = getListView().getItemAtPosition(position); String str = (String) o; String loc = (String) newUser.get("Location"); Toast.makeText(Friends.this, "Location of " + str + " is " + loc, Toast.LENGTH_LONG).show(); ParseUser.getCurrentUser().saveInBackground(); } } }); As you can see I am trying to retrieve the users object ID but for some reason it cannot seem to get the users Location. UPDATE: From one of the comments below I debugged and String o is definitely returning a string. I would put a bounty on this, but I do not have enough rep... Line 127 is: final ParseObject newUser = mUser.getParseObject(user); The logcat: 09-14 18:07:56.071: E/AndroidRuntime(24912): FATAL EXCEPTION: main 09-14 18:07:56.071: E/AndroidRuntime(24912): Process: com.kooknluke.wingman, PID: 24912 09-14 18:07:56.071: E/AndroidRuntime(24912): java.lang.NullPointerException 09-14 18:07:56.071: E/AndroidRuntime(24912): at com.kooknluke.wingman.Friends.onListItemClick(Friends.java:127) 09-14 18:07:56.071: E/AndroidRuntime(24912): at android.app.ListActivity$2.onItemClick(ListActivity.java:319) 09-14 18:07:56.071: E/AndroidRuntime(24912): at android.widget.AdapterView.performItemClick(AdapterView.java:308) 09-14 18:07:56.071: E/AndroidRuntime(24912): at android.…
has comment: http://stackoverflow.com/comment/40424510
has comment: http://stackoverflow.com/comment/40816026
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/40456625
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40429178
answer count: 0
has comment: http://stackoverflow.com/comment/40427399
score: 0
tagged with: java
type: Question

http://stackoverflow.com/a/25848471
accepted answer of: http://stackoverflow.com/q/25847309
answers question: http://stackoverflow.com/q/25847309
type: Answer
downvote count: 0
score: 1
has body: After fixing the main method signature change the code to as follows: try { BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); MainClass asg=new MainClass(); System.out.println("How many numbers do you want in the array?"); int l=Integer.parseInt(br.readLine()); System.out.println("Enter the numbers"); int[] a =new int[l]; for(int i=0;i&lt;l;i++) a[i]=Integer.parseInt(br.readLine()); int[] b=asg.array(a); int newSize = 0; if(l% 2 == 0) newSize = l/2; else newSize = (l/2) +1; for(int j=0;j&lt;newSize;j++) System.out.println(b[j]); } catch(Exception ex) { ex.printStackTrace(); } public int[] array(int[] a) { int l=a.length; int x=l-1; int newSize = 0; if(l% 2 == 0) newSize = l/2; else newSize = (l/2) +1; int[] b=new int[newSize]; int i = 0; while(x &gt;= 0) { b[i]=a[x]; i++; x -= 2; } return b; } The length of b should be half of a and not same as a.
has comment: http://stackoverflow.com/comment/40446453
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/25870536
type: Answer
has body: You can use Calendar: Calendar c = new GregorianCalendar(year, month, dayOfMonth);
score: 0
answers question: http://stackoverflow.com/q/25870156

http://stackoverflow.com/a/25839058
type: Answer
has body: Dear friend: You are trying to develop a Rich User Interface over a text console, which is a bad environment choose. I'd recommend that you'd better use Java Swing for that, which requires more programming effort, but it also turns out in a better user experience. BUT, if you ABSOLUTELY need to re-paint your user "screens" in a text-only environment, I doubt that executing system commands (like "cls") would be useful here. The only choice I think you MIGHT have is to output the BACKSPACE character (ascii 8) as many times as characters have been printed to the console last time, and then produce the new "screen". I've never tried that in Eclipse, sou you'll have to give it a try. Good luck!
answers question: http://stackoverflow.com/q/25838934
upvote count: 1
has comment: http://stackoverflow.com/comment/44392956
downvote count: 1
score: 0

http://stackoverflow.com/comment/40258728
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25747298
has text: It then becomes a good practice _not_ to close things IMHO.
score: 6

http://stackoverflow.com/a/25808380
type: Answer
has comment: http://stackoverflow.com/comment/40379900
has body: The reason why your IDE does not find the dependency is that it is not published anymore (not the version you seek apparently). Building the artifact and installing it locally as @Joe suggested is an elegant solution to solve your issue from my perspective. The advantage is twofold: Your IDE can seamlessly find the missing artifact You can keep multiple version of that dependency (one for every new patch) and thus reproduce previous (working) build in case a new patch breaks something. if you have a local repository, it is even better as this would maven the dependency available to all your team. Of course you would still need a tool to download new patch, apply them and deploy the produced artifact to the repository automatically. But doing this as a separate task give you more flexibility concerning the tools you could use.
score: 0
answers question: http://stackoverflow.com/q/25808041

http://stackoverflow.com/comment/40336683
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25750380
has text: OK, you need to combine two ideas together. I posted a tentative answer below, check if it works.
score: 0

http://stackoverflow.com/comment/40332635
comment on: http://stackoverflow.com/q/25783758
type: Comment
type: QuestionComment
has text: "*Should I need to change something in thrift side code ?*" - If you think you found an error in the Thrift code (be it generated or library), please file a JIRA ticket including a test case. If you have a patch proposal or an idea, include that too. Thanks!
score: 0

http://stackoverflow.com/comment/40214790
score: 0
type: AnswerComment
has text: Does one CloudSvrUser have only one CloudSvrPasswordsHistory object? If yes, then change it to: @OneToOne(mappedBy="user",fetch=FetchType.LAZY,cascade=CascadeType.ALL) private CloudSvrPasswordsHistory UserPwdList;
type: Comment
comment on: http://stackoverflow.com/a/25723646

http://stackoverflow.com/a/25759076
score: 3
type: Answer
has body: Yes it is possible. You just need to load its native library in one java class file. and Use that class in as much files you want. see This is Hellojni.c #include "HelloWorld.h" #include "jni.h" #include "stdio.h" JNIEXPORT void JNICALL Java_HelloWorld_print(JNIEnv *env, jobject obj) { printf("Hello world\n"); return; } Now you can make any java class calling that jni method class HelloWorld { public static native void print(); //native method static //static initializer code { System.loadLibrary("CLibHelloWorld"); } } Now use that java class in Multiple java file as you want HelloWorld.print();
has comment: http://stackoverflow.com/comment/67621886
upvote count: 3
answers question: http://stackoverflow.com/q/25758113
accepted answer of: http://stackoverflow.com/q/25758113
has comment: http://stackoverflow.com/comment/40284338
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/25761896
has answer: http://stackoverflow.com/a/25761972
accepted answer: http://stackoverflow.com/a/25761972
type: AnsweredQuestion
has body: Now I have this: String s = "1 3 5"; Pattern pattern = Pattern.compile("<script.* "); Matcher matcher = pattern.matcher(s); while (matcher.find()) { s = s.replace(matcher.group(), ""); } System.out.println(s); The result is 15 But I need 135 In PHP we have /U modificator, but what should I do in Java? I thought about sth like this, but it is incorrect: Pattern pattern = Pattern.compile("<script[^(script)]* ");
downvote count: 0
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25762058
has comment: http://stackoverflow.com/comment/40285630
linked to: http://stackoverflow.com/q/1732348
answer count: 2
has title: How to delete by regexp in Java?
upvote count: 1
has answer: http://stackoverflow.com/a/25762058
has comment: http://stackoverflow.com/comment/40285448
favorite count: 0
tagged with: regex

http://stackoverflow.com/a/25769634
score: 3
type: AcceptedAnswer
has body: Well this is quite the question. First of all i would not implement this myself. there are a number of free libraries out there (Spring, Hibernate) that do this for you, and much better in a form of an ORM (http://en.wikipedia.org/wiki/Object-relational_mapping). If you do want to do this yourself this is how I would do this: I would follow the ADO and create a class for each table I have. For example I would make the class Employee for my employee table. Then I would create a query builder such as this: QueryBuilder .selectFrom(Employee.class) .equalTo(propery, value) .graterThenOrEqualTo(property, value); my properties would look like so: interface Property&lt;From, To&gt;{ To get(From from); } so for example: class EmployeeToId&lt;Employee, Integer&gt;{ public Integer get(Employee emp){ return emp.id; } } So in my previos example: QueryBuilder .selectFrom(Employee.class) .equalTo(new EmployeeToId(), 15) .build().fetch(); // This returns an Optional&lt;Collection&lt;Employee&gt;&gt;; My query builder would have a number methods such as: class QueryBuilder{ public &lt;Entity&gt; SelectBuilder&lt;Entity&gt; selectFrom(Class&lt;Entity&gt; clazz); } This is just the jist of it. You can make it as complex as you like. But to make it good, that will take alot of time, just ask hibernate or jooq.
upvote count: 3
answers question: http://stackoverflow.com/q/25769236
type: Answer
accepted answer of: http://stackoverflow.com/q/25769236
downvote count: 0

http://stackoverflow.com/comment/40315474
has text: @mostruash It does if it is used correctly: http://ideone.com/eMrFP2
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25777981

http://stackoverflow.com/comment/40230337
comment on: http://stackoverflow.com/a/25731531
has text: @BumSkeeter yes, you're correct. Just remember that Java doesn't directly let you work with the pointers or addresses like C/C++.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/40307175
has text: i use 2 textbox (txtstart and txtend) and textarea to write result
type: AnswerComment
comment on: http://stackoverflow.com/a/25750700
score: 0
type: Comment

http://stackoverflow.com/q/25811672
tagged with: intellij-idea
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
has body: Intellij IDE supports cucumber natively. But the problem is I am trying to create and run a cucumber test on an android projects in intellij 13.1.4 IDE. After much research I came across this tutorial. But after following it and running my test I get this results Running tests Test running startedTest running failed: Unable to find instrumentation info for: ComponentInfo{com.test.cucumbertest.apptest/cucumber.api.android.CucumberInstrumentation} Empty test suite. This is the structure of my project CucumberTest | app | libs | | cucumber-android-1.1.8.jar | cucumber-core-1.1.8.jar | cucumber-html-0.2.3.jar | cucumber-java-1.1.8.jar | gherkin-2.11.2.jar | junit-4.11.jar src | androidTest | | java | | com.test.cucumbertest.app | | MyStepsDefs.java | | RunTest.java | | testclass.feature | main | java | com.test.cucumbertest.app | MainActivity.java MyStepDefs.java package com.test.cucumbertest.app; import android.test.ActivityInstrumentationTestCase2; import cucumber.api.PendingException; import cucumber.api.java.en.Given; public class MyStepDefs extends ActivityInstrumentationTestCase2&lt;MainActivity&gt;{ public MyStepDefs() { super(MainActivity.class); } @Given("^I have lunch the app$") public void I_have_lunch_the_app() throws Throwable { // Express the Regexp above with the code you wish you had assertTrue(true); } } RunTest.java: package com.test.cucumbertest.app; import cucumber.api.CucumberOptions; import cucumber.api.junit.Cucumber; import org.junit.runner.RunWith; @RunWith(Cucumber.class) @CucumberOptions(format = {"pretty", "html:report"}) public class RunTest { } testclass.feature: Feature: Test BDD Scenario: Scenario One Given I have lunch the app What am i doing wrong? this is my AndroidManifest &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.test.cucumbertest.app" &gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_n…
upvote count: 2
type: UnansweredQuestion
has title: How to setup and run cucumber bdd test for android project in intellij 13.1.4 using cucumber-java
has answer: http://stackoverflow.com/a/27719255
score: 2
tagged with: java
type: Question

http://stackoverflow.com/q/25829005
favorite count: 0
has answer: http://stackoverflow.com/a/25829025
has title: Printing the first element in LinkedList java
accepted answer: http://stackoverflow.com/a/25829025
has body: Everything is working fine int he given code, except that the display does not print the first most inserted element public void display() { Link pcurrent = pfirst; while(pcurrent.next!= null) { System.out.println(pcurrent); pcurrent = pcurrent.next; } } with elements inserted in order : 100, 200, 300, 400-> It outputs them as: //nothing in first turn 200 300, 200 (in second iteration) 400, 300, 200 in last iteration How do I change this? What I want is this: 100 200, 100 300, 200, 100 400, 300, 200, 100
has comment: http://stackoverflow.com/comment/40408236
possible better answer: http://stackoverflow.com/a/25829018
upvote count: 1
has answer: http://stackoverflow.com/a/25829018
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25829019
has comment: http://stackoverflow.com/comment/40408097
has comment: http://stackoverflow.com/comment/40408082
score: 1
tagged with: java
answer count: 3
downvote count: 0

http://stackoverflow.com/comment/40408513
type: Comment
type: QuestionComment
score: 0
has text: @erad Since the NPE occurs inside the call to `addTab()`, the diagnosis isn't quite that clear cut.
comment on: http://stackoverflow.com/q/25829139

http://stackoverflow.com/q/25777561
favorite count: 0
linked to: http://stackoverflow.com/q/19044638
type: UnansweredQuestion
has title: Compression and Decompression of String using GZIP in java
has body: I would like a simple code to compress and decompress a String in Java. Using GZIP. ex; String input = "Hello world"; and where the output would be a compressed string. ex; String output = "%%#"; The requirement is to take the existing string compress it and write it on to a text file as a string. The decompression would be to read the text file and convert the content to string. Is this possible??
score: 1
tagged with: java
tagged with: compression
upvote count: 1
has comment: http://stackoverflow.com/comment/40314814
type: Question
has comment: http://stackoverflow.com/comment/40314719
tagged with: gzip
has answer: http://stackoverflow.com/a/25777572
answer count: 1
downvote count: 0
tagged with: string

http://stackoverflow.com/comment/40332696
comment on: http://stackoverflow.com/q/25785747
has text: I am able to build the project successfully but running into errors when trying to run tomcat. Please note that we have upgraded from Jdk 1.5 to 1.7 and Tomcat 5.5 to 8. These projects were running fine in previous setups (jdk1.5 & tomcat 5.5). Tomcat runs fine if I remove the resource tags of the projects which have issues. Throws the mentioned errors when adding the resource tags for the projects.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25786790
has title: Intellij single class compilation does not reflect .java file state
answer count: 1
has comment: http://stackoverflow.com/comment/40330409
has body: I am currently working on a maven project with unconventional structure on Intellij Idea 12 versioned on Perforce. Main sources directory is src in module root instead of src/main/java. Same for test sources located in a tests directory in module root instead of src/test/java. Whenever I make a maven clean compile or use Build-&gt;Rebuildproject menu, all my changes are reflected. But if I try to use "single class compilation" (Build-&gt;Compile or Build-&gt;Make Project menu) or "Make" before running a unit test for example, when I decompile the .class product of that compilation, it never reflects the last changes I made but the last maven clean compile or Build-&gt;Rebuildproject compilation product. I even tried to delete compiled classes before launching single class compilation but it was still the same behaviour. Plus when I launch "single class compilation", it copies the .java files being compiled in module's target directory. Compiling the whole project whenever I make a change takes too long to be considered as a viable alternative. How can I get my changed classes compiled? Any help would really be appreciated. EDIT : I decompiled my compiled unit test class, and it has differences with the version in source directory. I also checked the classpath when I launch the unit test and both MODULE_PATH/target/test-classes and MODULE_PATH/target/classes are part of it. So unit tests are launched with compiled classes in target.
has comment: http://stackoverflow.com/comment/40332608
tagged with: maven
has comment: http://stackoverflow.com/comment/40330649
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40330908
type: Question
has answer: http://stackoverflow.com/a/25787718
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/25787718
score: 0

http://stackoverflow.com/a/25742950
answers question: http://stackoverflow.com/q/25736878
score: 0
has body: Solution was too simple: I used derictory "web" for locating web-content in my project instead of WEB-CONTENT directory. It's pretty obvious, isn't it? :)
accepted answer of: http://stackoverflow.com/q/25736878
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/25851999
score: 0
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40450106
tagged with: jsoup
has body: I parse specific Url and trying to save all Inner Links (same domain) in allInnerLinks ArrayList and all external Url's in allExternalLinks ArrayList. public void go() { Document doc; baseUrl = CountLinks.result3; try { // need http protocol doc = Jsoup .connect(url) .userAgent( "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:25.0) Gecko/20100101 Firefox/25.0") .referrer("http://www.google.com").timeout(1000 * 5) .ignoreContentType(true).get(); // get page title String title = doc.title(); // get all links Elements links = doc.select("a[href]"); for (Element link : links) { // !!! // String absUrl = link.absUrl("href"); String absUrl = link.attr("abs:href"); // get the value from href attribute if (absUrl.contains(baseUrl) &amp;&amp; !(absUrl.contains("mailto"))) { allInnerLinks.add(absUrl); allInnerLinksCounter++; } else { allExternalLinks.add(absUrl); allExternalLinksCounter++; } } } catch (NullPointerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (HttpStatusException e) { e.printStackTrace(); System.out.println(e.getUrl()); } catch (IOException e) { e.printStackTrace(); } } But at the end I've got duplicate elements. The same URL but Number sign # appears at the end of the link. I can't understand how I get it: PAGEURL EXTERNAL URLS ---------------------------------------------------------------------------------------- http://hostingmaks.com/category/news/ https://meetings.webex.com/ http://hostingmaks.com/category/news/# https://meetings.webex.com/ Any reason why it happens?
has title: Parsing URL using Jsoup I've got duplicate URL's
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/31929334
has comment: http://stackoverflow.com/comment/40450404

http://stackoverflow.com/a/25794332
answers question: http://stackoverflow.com/q/25794066
score: 0
type: Answer
has body: Yes, I think it is proper in an OO context to call your own public method. It's quite common when there are overloads for a method that all but one call the most specific one, either filling in defaults for missing parameters or transforming the type of the argument(s). I also see the pattern where all the overloads call into a private or protected method of the same name with _internal or _impl added to the end. For example, several overloads of ComputeSpeed might all call ComputerSpeed_internal. This pattern would be appropriate if there is parameter validation in the public methods that you don't want to do twice, or would be inappropriate for internal calls. You can certainly introduce problems by not having a clear separation of concerns. For example, if the caller of collisionPreventionActions also decided it was a good idea to set the brake, you could have a conflict in how much brake is applied. KC

http://stackoverflow.com/q/25719162
has comment: http://stackoverflow.com/comment/40206896
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40207339
has comment: http://stackoverflow.com/comment/40206591
has title: Handling Unknown Host Exception
tagged with: java
has comment: http://stackoverflow.com/comment/40207009
type: Question
has comment: http://stackoverflow.com/comment/40213642
has body: When trying to send data to php server from android application using following code - @Override protected ServerResponseBean doInBackground(LoginBean... params) { String innerResult="-1"; ServerResponseBean objSRBean = null; DefaultHttpClient client=new DefaultHttpClient(); try{ HttpPost request =new HttpPost(UPDATE_LOGIN_LOCATION_URL); List&lt;NameValuePair&gt; param=new ArrayList&lt;NameValuePair&gt;(); param.add(new BasicNameValuePair(TAG_ID, params[0].getLoginID()+"")); UrlEncodedFormEntity entity=new UrlEncodedFormEntity(param); request.setEntity(entity); HttpResponse response = client.execute(request); if(response!=null){ InputSource in = new InputSource(response.getEntity().getContent()); InputStream isr=in.getByteStream(); innerResult= readData(isr); isr.close(); } }catch(UnknownHostException uhe){uhe.printStackTrace();} catch(Exception e){e.printStackTrace();} The above code works fine but sometimes application get crashed due to UnknownHostException where as my server is working fine.Even I have added validation for internet connection availability i.e if connection is available then only execute task in background otherwise ask user to enable internet connection. Provide your suggestions to handle the exception.
score: 0
tagged with: android

http://stackoverflow.com/q/25798109
has comment: http://stackoverflow.com/comment/47014722
has comment: http://stackoverflow.com/comment/47379101
has answer: http://stackoverflow.com/a/33294822
upvote count: 3
type: UnansweredQuestion
tagged with: stun
score: 3
tagged with: ice4j
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/47332033
has body: Does anyone know how to do the TURN portion of Ice4j? I've managed to code it so that it works when the phone is on WiFi, but not when its on the mobile network. I'm sending agent info via TCP and then building the connection manually instead of using a signalling process. The TCP connection already works fine, so I don't think its the TCP issue. Maybe I'm building the agent wrong? I know that you're supposed to use a TURN server if STUN doesn't work, and I provided a large list of public TURN servers, but I might be missing something. Maybe the packets aren't being sent out properly? Error: (Mostly Failed to send ALLOCATE-REQUEST(0X3)) Sep 11, 2014 3:36:09 PM org.ice4j.ice.Agent createMediaStream INFO: Create media stream for data Sep 11, 2014 3:36:09 PM org.ice4j.ice.Agent createComponent INFO: Create component data.1 Sep 11, 2014 3:36:09 PM org.ice4j.ice.Agent gatherCandidates INFO: Gather candidates for component data.1 Sep 11, 2014 3:36:09 PM org.ice4j.ice.harvest.HostCandidateHarvester harvest INFO: End candidate harvest within 160 ms, for org.ice4j.ice.harvest.HostCandidateHarvester, component: 1 Sep 11, 2014 3:36:09 PM org.ice4j.ice.harvest.StunCandidateHarvest sendRequest INFO: Failed to send ALLOCATE-REQUEST(0x3)[attrib.count=3 len=32 tranID=0x9909DC6648016A67FDD4B2D8] through /192.168.0.8:5001/udp to stun2.l.google.com:19302:5001/udp Sep 11, 2014 3:36:12 PM org.ice4j.ice.ConnectivityCheckClient processTimeout INFO: timeout for pair: /fe80:0:0:0:c8ce:5a17:c339:cc40%4:5001/udp -&gt; /fe80:0:0:0:14e8:f3ff:fef3:6a21:6001/udp (data.1), failing. Sep 11, 2014 3:36:12 PM org.ice4j.ice.ConnectivityCheckClient processTimeout INFO: timeout for pair: /fe80:0:0:0:380d:2a4c:b350:eea8%8:5001/udp -&gt; /fe80:0:0:0:14e8:f3ff:fef3:6a21:6001/udp (data.1), failing. Sep 11, 2014 3:36:12 PM org.ice4j.ice.ConnectivityCheckClient processTimeout INFO: timeout for pair: /192.168.0.8:5001/udp -&gt; /100.64.74.58:6001/udp (data.1), failing. Sep 11, 2014 3:36:12 PM org.ice4j.ice.Conn…
has title: Ice4J: Ice State Failed on 4G network
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/48177719
favorite count: 0
has comment: http://stackoverflow.com/comment/47341289
tagged with: sockets
tagged with: android

http://stackoverflow.com/a/34028582
has comment: http://stackoverflow.com/comment/55814089
has comment: http://stackoverflow.com/comment/93864882
has body: Unfortunately it seems not to be possible on Eclipse with a normal build, as mentioned by @A4L, it is a known bug, check Bug 414645 and Bug 376616. Eclipse (m2e) can't properly manage Maven dependencies scope. However, if you place the runtime dependencies on a profile, then Eclipse will not add them to the classpath (the profile shouldn't be active by default, though). I just tested it on Eclipse Mars and it works perfectly. Hence, in your case you could add to your POM: runtime ch.qos.logback logback-classic 1.1.2 runtime As such, it can't be used to compile on Eclipse. However, your build would then need to use it at runtime, running with -Pruntime in this case. Although adapting your POM and build to an issue of an IDE might not be ideal, it could be a good compromise to achieve your goal.
score: 4
has comment: http://stackoverflow.com/comment/115670508
upvote count: 4
answers question: http://stackoverflow.com/q/25865592
downvote count: 0
type: Answer

http://stackoverflow.com/a/25848370
has comment: http://stackoverflow.com/comment/40443557
type: Answer
has comment: http://stackoverflow.com/comment/40445544
has comment: http://stackoverflow.com/comment/40445130
has comment: http://stackoverflow.com/comment/40444997
upvote count: 4
has comment: http://stackoverflow.com/comment/40445016
has comment: http://stackoverflow.com/comment/40443620
accepted answer of: http://stackoverflow.com/q/25847798
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40445223
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/25847798
has comment: http://stackoverflow.com/comment/40445787
has body: You are converting both a and b to milliseconds (since epoch) then getting the difference. Since your subsequent line involves invoking the Time constructor, you don't need to scale the time to days by dividing with 24 * 60 * 60 * 1000 as you have done. Take the c value only as a difference in milliseconds, then convert it into the Time object diff in the next line. Your updated code should look like this. long c = b.getTime() - a.getTime(); Time diff = new Time(c); However, this will give you a Time object with the correct number of hours, minutes and seconds but whose date will be January 1, 1970. As you have added the MySQL tag to your question, I would suggest you consider Paul's suggestion in his comment. I suggest you let MySQL do the math for you as part of your query, something like SELECT Lunch_Out, After_Lunch_In, subtime(After_Lunch_In, Lunch_Out) as Lunch_Duration FROM .... See the MySQL reference manual for details.

http://stackoverflow.com/a/25811245
score: 3
upvote count: 3
has body: In your code there is a compile error, that is because Syteme change it to System Syteme.out.println("Hello World"); should be System.out.println("Hello World"); P.S And in Java when you have a public class in a file, then file name must be that class name. It is a must. Otherwise you will get an error. If you have this class in a package then you must specify the package declaration first e.g package abc;
has comment: http://stackoverflow.com/comment/40376183
answers question: http://stackoverflow.com/q/25811216
has comment: http://stackoverflow.com/comment/40375302
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40375182

size
type: Tag
tags question: http://stackoverflow.com/q/25750376
tags question: http://stackoverflow.com/q/25721899
tag name: size
tags question: http://stackoverflow.com/q/25747013

http://stackoverflow.com/a/25829282
accepted answer of: http://stackoverflow.com/q/25828903
score: 1
has body: Cleaned up xio4's solution: import java.util.Set; import java.util.HashSet; public class Equaller { public static boolean checkEqual(Integer[][] array) { if (array.length &gt; 0) { Set&lt;Integer&gt; firstSet = new HashSet&lt;Integer&gt;(array[0].length); // fill first set for (Integer i : array[0]) { firstSet.add(i); } // compare 2D array with first set for (Integer[] intArray : array) { Set&lt;Integer&gt; secondSet = new HashSet&lt;Integer&gt;(firstSet.size()); for (Integer i : intArray) { if (!firstSet.contains(i)) { return false; } secondSet.add(i); } if (firstSet.size() != secondSet.size()) { return false; } } } return true; } }
answers question: http://stackoverflow.com/q/25828903
upvote count: 1
downvote count: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40478935
comment on: http://stackoverflow.com/q/25868055
score: 0
type: Comment
type: QuestionComment
has text: Post your logcat then.....

http://stackoverflow.com/q/25797175
has comment: http://stackoverflow.com/comment/40350291
has body: I'm trying to do XOR with this Java statement, but it's generating unexpected output. System.out.println(0x15C ^ 0x11B); Output: 71 However, if I go to http://www.jdejong.net/tools/bitwisecalculator.php, the output is 47. If I do this by hand, I get the result 0x47. 0x15C: 000101011100 0x11B: 000100011011 ---------------------- XOR 0x47: 000001000111 How do I generate 47 (what I believe to be the correct answer) using Java? EDIT: Answer: Forgot that it was decimal, not hex. The screenshot's XOR Result confused me since it didn't have 0x notation.
accepted answer: http://stackoverflow.com/a/25797228
has answer: http://stackoverflow.com/a/25797210
has answer: http://stackoverflow.com/a/25797228
has answer: http://stackoverflow.com/a/25797211
answer count: 4
has answer: http://stackoverflow.com/a/25797230
favorite count: 0
has title: XOR "^" in Java is generating unexpected result
has comment: http://stackoverflow.com/comment/40350479
downvote count: 6
possible better answer: http://stackoverflow.com/a/25797210
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40388507
has comment: http://stackoverflow.com/comment/40350268
has comment: http://stackoverflow.com/comment/40387280
upvote count: 5
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40350226
type: Question

http://stackoverflow.com/comment/40314682
type: Comment
type: QuestionComment
has text: Your title is incomprehensible.
score: 0
comment on: http://stackoverflow.com/q/25777511

http://stackoverflow.com/q/25818992
answer count: 1
has body: import java.util.Scanner; public class CodeSnippetm01 { public static void main(final String[] args, int len) { //0. Variable declarations. String greeting = "Welcome to CST242!"; String question1 = "What is your name?:"; //1. Print Statement. System.out.println(greeting); System.out.println(question1); Scanner keyboard = new Scanner(System.in); len = input.length(); //2. Code for prompt and input while (len &gt; 0) { String input = keyboard.nextLine(); System.out.println("String Length is : " + len); //3. Loop code and loop body. } //4. Multiway If block. } } I have to create a loop that displays a single character on each line from the person’s name, input an integer representing the person’s age in 2 using a Scanner method and then use a multiway if-else statement to print the following (shown in Pseudocode): If the person is &gt;= 90, print `({name from 2} +“was born before 1923.”)`. Else if person &gt;=75, print `({name from 2} +“was born born before 1938.”)`. Else if person &gt;=50, print `({name from 2} +“was born born before 1963.”)`. Else if person &gt;=25, print `({name from 2} +“was born born before 1988.”)`. Else print `({name from 2} +“was born born sometime after 1988.”)` So far this is what I have.. any recommendations or help is welcome :-)
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/40390764
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40390599
score: -3
tagged with: java
downvote count: 3
tagged with: loops
type: Question
has comment: http://stackoverflow.com/comment/40390508
has comment: http://stackoverflow.com/comment/40390564
upvote count: 0
has answer: http://stackoverflow.com/a/25819036
has title: Why won't my program compile?
has comment: http://stackoverflow.com/comment/40390359

http://stackoverflow.com/comment/40387306
type: Comment
type: QuestionComment
has text: Why `)` is used in your regexp?
comment on: http://stackoverflow.com/q/25817269
score: 0

http://stackoverflow.com/comment/40270917
score: 0
comment on: http://stackoverflow.com/a/25753301
type: Comment
has text: I didn't get it. Could you explain to me what I need to add to my code, as this is a first time for me to write a cookie code.
type: AnswerComment

http://stackoverflow.com/a/25729306
has comment: http://stackoverflow.com/comment/40225443
answers question: http://stackoverflow.com/q/25729078
has comment: http://stackoverflow.com/comment/40225369
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25729078
score: 0
type: Answer
has body: I just tried this code and it works as expected: String data = "poniedziałek28.08"; String[] dni = {"poniedziałek","wtorek","środa","czwartek","piątek","sobota","niedziela"}; String dataZseparatorem = ""; for(int i = 0; i &lt; dni.length; i++){ if(data.startsWith(dni[i]) == true){ dataZseparatorem = data.substring(dni[i].length()); } } System.out.println(dataZseparatorem); String dzien[] = dataZseparatorem.split(Pattern.quote(".")); System.out.println(dzien[0] + " " + dzien[1]); Please check your input and see if is in UTF-8 (with all the accentuated characters).
has comment: http://stackoverflow.com/comment/40225524

http://stackoverflow.com/comment/40428052
has text: Oh, and change `System.out.println(e.getCause()); ` for `e.printStackTrace()` as it will give you much more useful information.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25839599

http://stackoverflow.com/comment/40249826
type: Comment
type: QuestionComment
has text: I tried like that , that is also giving same output.
comment on: http://stackoverflow.com/q/25742148
score: 0

http://stackoverflow.com/q/25820034
upvote count: 0
answer count: 1
favorite count: 0
tagged with: android
score: -2
has answer: http://stackoverflow.com/a/25820086
has title: How zoom into a Textbox
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
has body: I was wondering if it would be possible for my application to zoom into a textbox when selected. Since the application is meant for people who are generally older, I would like this to be a possible option. Also to let you all know, this isn't related to anything about WebView. The application is simply a set of textboxes.
tagged with: java
downvote count: 2
type: Question
accepted answer: http://stackoverflow.com/a/25820086

http://stackoverflow.com/comment/40197132
score: 0
has text: why the downvote for providing the official tutorial for this question?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25714053

http://stackoverflow.com/comment/40289164
type: QuestionComment
has text: I fear your only choice is to redesign the forms in IntelliJ Form Designer. Would this be much work? Since translating GUI designs to code is generally a one-way process...
comment on: http://stackoverflow.com/q/25735952
score: 0
type: Comment

http://stackoverflow.com/comment/40382204
comment on: http://stackoverflow.com/q/25814448
has text: if I send an int[] the API receives the reference and not the array itself.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25723956
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25725198
type: Question
has comment: http://stackoverflow.com/comment/40215387
has comment: http://stackoverflow.com/comment/40216343
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40217040
accepted answer: http://stackoverflow.com/a/25725198
answer count: 1
has comment: http://stackoverflow.com/comment/40215816
has body: I am looking for a method to add a kind of watermark to a SWT CTabFolder. My goal is that the tab folder does not look as "boring" if there are no tabs present. I am aware of the setBackgroundImage method of CTabFolder. Unfortunately, this seems to be non adjustable and can only display an image in "tiled" format. Do you know of any way to add a centered image to an empty tab folder?
tagged with: swt
has title: SWT CTabFolder: Add watermark (in case of no tabs)

http://stackoverflow.com/comment/40260784
has text: I guess this solves the purpose.But the best would be going as per the ponomandr's comment above,if only array of string is required at the end.
comment on: http://stackoverflow.com/a/25747652
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/a/25829391
has comment: http://stackoverflow.com/comment/40408829
has comment: http://stackoverflow.com/comment/40408921
has comment: http://stackoverflow.com/comment/40417075
has comment: http://stackoverflow.com/comment/40408905
type: Answer
has comment: http://stackoverflow.com/comment/40408933
has comment: http://stackoverflow.com/comment/40408832
answers question: http://stackoverflow.com/q/25829292
has body: You could have your TaskManager.newRepeatingTask accept a Consumer&lt;UUID>. Then create a runnable from that, using your then known UUID. So that you internally go something like this: //inside newRepeatingTask(consumer:Consumer&lt;UUID&gt; ...) Runnable r = new Runnable() { public UUID uuid; @Override public void run() { consumer.accept(uuid); //calls the lambda } }; r.uuid = getNextUUID(); //do whatever here //add to your presumed list of runnables Now you could just do: UUID id = TaskManager.newRepeatingTask((UUID id) -&gt; { TaskManager.cancelTask(id); //probably do something better with id }, 30L, 0L); //LOOK MA, this code is DRY
upvote count: 4
has comment: http://stackoverflow.com/comment/40408993
has comment: http://stackoverflow.com/comment/40409052
downvote count: 0
has comment: http://stackoverflow.com/comment/40408956
has comment: http://stackoverflow.com/comment/40408858
score: 4

http://stackoverflow.com/comment/40379433
type: Comment
comment on: http://stackoverflow.com/a/25813398
has text: note that this doesn't play any of the audio until AFTER it's all recorded
score: 3
type: AnswerComment

http://stackoverflow.com/comment/40364522
comment on: http://stackoverflow.com/q/25804935
type: Comment
type: QuestionComment
has text: Look if [this helps](http://www.trirand.com/blog/?page_id=393/help/display-error-messages-returned-from-server)
score: 0

http://stackoverflow.com/a/25864668
has body: Like AnthonyJClink said, you can't. But.. you can (kinda) shorten your instantiation code by not using the new keyword if you instantiate your instance in static method of your class. For example: public class MyClass { private MyClass(){ } public static MyClass create(){ return new MyClass(); } public static void main(String[] args) { MyClass instance = MyClass.create(); // Add parameters as needed } } It reminds me of methods like int b = Integer.parseInt("444"); It makes your code more readable in some cases. It really depends on your needs. This public static instantiation is also often used with singletons getInstance() methods.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/25864040
downvote count: 0
score: 1

http://stackoverflow.com/a/25724180
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25723830
upvote count: 1
has body: static void sortMap() throws Exception{ DateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy"); Map&lt;Date, Integer&gt; map = new TreeMap&lt;Date, Integer&gt;(new Comparator&lt;Date&gt;() { public int compare(Date date1, Date date2) { return date2.compareTo(date1); } }); map.put(dateFormat.parse("01-09-2014"), 1); map.put(dateFormat.parse("02-09-2014"), 2); map.put(dateFormat.parse("31-08-2014"), 3); map.put(dateFormat.parse("30-08-2014"), 4); }

yaml
tags question: http://stackoverflow.com/q/25796637
tag name: yaml
type: Tag

http://stackoverflow.com/comment/40400642
type: AnswerComment
comment on: http://stackoverflow.com/a/25824781
has text: What does the URL you want to Post look like?
type: Comment
score: 0

http://stackoverflow.com/comment/40325602
type: AnswerComment
type: Comment
has text: That code was not working, it was going into an infinite loop
comment on: http://stackoverflow.com/a/25783917
score: 0

http://stackoverflow.com/q/25740171
has title: Hide Maven projects in Eclipse Package Explorer
type: UnansweredQuestion
tagged with: maven
has body: When I import a project into Eclipse using "Existing Maven Project" I can see the Maven project and all sub-projects in the Package Explorer like this: The project has a structure like this: karaf-tutorial-cxf\ \personservice-parent \psersonservice-proxy \psersonservice-server \psersonservice-webui ... Two questions: (1) Is it possible automatically hide Maven projects in the Package Explorer and only show Java projects? (in my example hide karaf-tutorial-cxf and personservice-parent) (2) When I do a text search using "File / Search / Workspace" I get multiple hits for the same source file. One for the Java file, one from it's Maven parent (personservice-parent) and one from the parents parent (karaf-tutorial-cxf). Is it possible to only show one hit (the one from the Java file)?
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/17797438
type: Question
has answer: http://stackoverflow.com/a/25740246
score: 0
answer count: 1

http://stackoverflow.com/comment/40424907
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/25833963
has text: Perhaps I have not understood what you are trying to do, I have edited my answer. Also I don't think this simple statement is in any danger of SQL injection, only the variables in WHERE clauses.
type: Comment

http://stackoverflow.com/comment/40402428
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25813398
score: 1
has text: I think if you loop through the Mixer Info, you can find all the different available target sources; check out the answer here: http://stackoverflow.com/questions/12863081/how-do-i-get-mixer-channels-layout-in-java

http://stackoverflow.com/q/25779212
has title: Prime number: How does this code works?
has comment: http://stackoverflow.com/comment/40317495
has comment: http://stackoverflow.com/comment/40317446
has answer: http://stackoverflow.com/a/25780020
upvote count: 3
tagged with: java
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/25779446
has body: This code calculates prime numbers, but how does it work? I need a clear explanation of what the if(band) at the end is doing. public class Primes { public static void main(String[] args) { int m; boolean band; for (int i = 2; i &lt; 100; i++) { m = 2; band = true; while (band &amp;&amp; m &lt;i) { if (i % m == 0) { band = false; } else { m++; } } if (band) { System.out.println("The number " + i + " is prime"); } } } }
score: 0
has comment: http://stackoverflow.com/comment/40317422
has comment: http://stackoverflow.com/comment/40317538
has answer: http://stackoverflow.com/a/25779311
favorite count: 0
has comment: http://stackoverflow.com/comment/40317452
has comment: http://stackoverflow.com/comment/40317454
has answer: http://stackoverflow.com/a/25779313
type: UnansweredQuestion
answer count: 4

http://stackoverflow.com/a/25857244
accepted answer of: http://stackoverflow.com/q/25857184
answers question: http://stackoverflow.com/q/25857184
score: 0
type: AcceptedAnswer
has body: Just check if the text is empty in your onClick/onCalculate method. If empty, use 0, ie: public void onCalculate() { float input = 0.0; if (editText.getText().toString().equals("")) { //Text is empty do nothing } else { //parse your value input = Float.parseFloat(editText.getText().toString()); } }
type: Answer

http://stackoverflow.com/comment/40403392
has text: `StringBuilder` does not have a replace method, so even if you make the list generic a `StringBuilder` you'll still need to convert it to `String`.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25826217
score: 1

http://stackoverflow.com/comment/40478939
has text: uninstall privious one and install
comment on: http://stackoverflow.com/q/25868055
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40328845
score: 1
comment on: http://stackoverflow.com/q/25785823
type: Comment
type: QuestionComment
has text: possible duplicate of [Modify a class definition's annotation string parameter at runtime](http://stackoverflow.com/questions/14268981/modify-a-class-definitions-annotation-string-parameter-at-runtime)

http://stackoverflow.com/a/25749216
has comment: http://stackoverflow.com/comment/40262352
has comment: http://stackoverflow.com/comment/40262637
has body: You seem to be confused about the difference between an object and its class. If you want have a list of classes: List&lt;Class&lt;? extends Exception&gt;&gt; list = new ArrayList&lt;Class&lt;? extends Exception&gt;&gt;(); list.add(Exception.class); If you want to have a list of Exceptions: List&lt;Exception&gt; list = new ArrayList&lt;Exception&gt;(); list.add(new Exception("Help! A problem!"));
has comment: http://stackoverflow.com/comment/40262425
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40262788
score: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25749161
has comment: http://stackoverflow.com/comment/40262632
answers question: http://stackoverflow.com/q/25749161
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/40262679

http://stackoverflow.com/q/25841221
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40430941
type: Question
has title: Implicit wait in robot class. Is it possible?
has body: I am automating an application where the robot class first click on cancel button and then it clicks on a menu item and then it clicks on a sub menu item. After clicking the sub menu it has to wait(time is unknown), because it loads an environment, and then it clicks on a button. So is there any way so that i can wait for that particular time and it has to exit when the task is finished. It should not wait more or less. I am providing my code please help me in implementing this code. import java.awt.AWTException; import java.awt.Robot; import java.awt.event.KeyEvent; import java.io.IOException; public class ChangeAsst { public static void main(String[] args) throws AWTException, IOException { Runtime.getRuntime().exec("C:\\Program Files\\PeopleSoft\\Change Assistant\\changeassistant.exe"); Robot robot = new Robot(); robot.delay(2000); System.out.println(robot.isAutoWaitForIdle()); robot.keyPress(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_C); robot.keyRelease(KeyEvent.VK_C); robot.keyRelease(KeyEvent.VK_ALT); /* * this is where i want to implement the code so that it should wait for that particular time (it should not wait more or less) * When environment loading is done it should exit from this and go to next line of code. * * I can use here as : * robot.delay(10000); * but it will wait for 10 seconds, even if loading is done in 3rd seconds also. */ robot.keyPress(KeyEvent.VK_ALT); robot.keyPress(KeyEvent.VK_T); robot.delay(300); robot.keyPress(KeyEvent.VK_C); robot.keyRelease(KeyEvent.VK_ALT); robot.delay(5000); System.out.println(robot.isAutoWaitForIdle()); } }
has comment: http://stackoverflow.com/comment/40431230
score: 0
tagged with: awtrobot
has comment: http://stackoverflow.com/comment/40431376
has comment: http://stackoverflow.com/comment/40431205

http://stackoverflow.com/a/26761500
score: 6
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/25752412
accepted answer of: http://stackoverflow.com/q/25752412
has comment: http://stackoverflow.com/comment/52831344
type: AcceptedAnswer
downvote count: 0
has body: I think it really depends on the Java EE 7 implementation. For Glass Fish, you could just pass null for Json.createXXXFactory() methods, except for Json.createWriterFactory/createGeneratorFactory() method which you could pass configuration option whether to do pretty printing or not. Map&lt;String, Object&gt; config = new HashMap&lt;String, Object&gt;(); //if you need pretty printing config.put("javax.json.stream.JsonGenerator.prettyPrinting", Boolean.valueOf(true)); JsonWriterFactory factory = Json.createWriterFactory(config);

http://stackoverflow.com/q/25743507
upvote count: 4
tagged with: built-in
answer count: 2
downvote count: 0
tagged with: publish
has title: Publishing multiple Endpoints with built-in Java JAX-WS web server
favorite count: 0
has body: So I have 2 implementations, Impl1 and Impl2, of a web service interface class. I would like to publish both under the same domain and port but with different URLS: http://some.domain.asd/ws1 and http://some.domain.asd/ws2 Apparently, I should be able to create a configuration where I have 2 Endpoints, one for each implementation, bound to a single web server instance. Note that I am not deploying but using the Java 7 internal publishing mechanism. I noticed that instead of calling Endpoint.publish(URL, new Implementor()); to directly publish a web service, I can call Endpoint ep = Endpoint.create(new Implementor()); ep.publish(serverContext); to publish the Implementor at a specific serverContext. What exactly is such a serverContext and how do I use it? I noticed that the publish method instantiates a javax.xml.ws.spi.Provider class and uses it for publishing purposes. But that is apparently not what I am looking for. Ideally, I would like a solution that resembles something like this: Object serverContext = new Server(URL); Endpoint impl1 = Endpoint.create(new Impl1()); Endpoint impl2 = Endpoint.create(new Impl2()); impl1.publish(serverContext); impl2.publish(serverContext); Can this even be done with the built-in publishing system, maybe using EndpointReferences objects? Or am I required to use a web service container to deploy my Endpoints seperately?
type: UnansweredQuestion
tagged with: java
tagged with: jax-ws
tagged with: web-services
type: Question
has answer: http://stackoverflow.com/a/31943138
has answer: http://stackoverflow.com/a/42764557
score: 4

http://stackoverflow.com/a/25793598
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25792420
has comment: http://stackoverflow.com/comment/40362052
has body: The value stack looks like a Stack such a collection of objects that you can access at the top using push(), pop(), or peek() and it has a root, that is a compound root due XWork extension of OGNL. The biggest addition that XWork provides on top of OGNL is the support for the ValueStack. While OGNL operates under the assumption there is only one "root", XWork's ValueStack concept requires there be many "roots". This compound root has a list of "roots" that are traversed from top (0-index) to down the stack (size()-1) during expression evaluation until the value is found. So each root can contain the value for example user.username but the first found value will be returned. The problem is how to access those duplicated properties in other "roots". The solution is to access the root by the index. For example top object has prefixed with [0]., [1]. is an object pushed before, and so on. That's how OGNL works on the value stack. You can also see the example where I was trying access action bean properties when model driven is implemented Passing parameters to action through ModelDriven in Struts 2. References: OGNL Basics OGNL
has comment: http://stackoverflow.com/comment/40365904
has comment: http://stackoverflow.com/comment/44215642
has comment: http://stackoverflow.com/comment/44202513
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/40367311
has comment: http://stackoverflow.com/comment/40362748
has comment: http://stackoverflow.com/comment/44180735
answers question: http://stackoverflow.com/q/25792420

http://stackoverflow.com/a/25844765
type: Answer
answers question: http://stackoverflow.com/q/25844704
score: 0
has body: you can discard the apple and try a new location if it is no proper location... Point position = null; do{ Point candidate = createRandomLocation(); double distance = measureDistance(head, candidate); if (distance &gt; 20) { //maybe you check other things as well... position = new Poisition(candidate) } }while(position ==null);

http://stackoverflow.com/q/25813108
has comment: http://stackoverflow.com/comment/40380069
has comment: http://stackoverflow.com/comment/40378993
upvote count: 0
has answer: http://stackoverflow.com/a/25813229
answer count: 1
favorite count: 0
tagged with: jframe
has title: JFrame and Container
has comment: http://stackoverflow.com/comment/40379109
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25813229
has comment: http://stackoverflow.com/comment/40379191
tagged with: java
has comment: http://stackoverflow.com/comment/40380442
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40379048
has comment: http://stackoverflow.com/comment/40378917
has body: im really stuck, i have to define the container object by associating it with the JFrame in order to get my JFrame working with all its components. my code is follows: // get content pane for attaching GUI components Container contentPane = getContentPane(); my JFrame i wish to call it billFrame, I also want to call my container billContentPane, so im looking for something like: private JFrame billFrame = new JFrame(); Would the above code be correct, or what would i have to change? would an instance variable have to be declared or am i way off the mark?
score: -1
has comment: http://stackoverflow.com/comment/40381370
has comment: http://stackoverflow.com/comment/40378971
tagged with: contentpane

http://stackoverflow.com/a/25802415
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25802052
has comment: http://stackoverflow.com/comment/40359776
answers question: http://stackoverflow.com/q/25802052
type: Answer
has comment: http://stackoverflow.com/comment/40359822
has body: If you only have like 50 elements, as noted in my comment, just sort it and take the last k elements. It's 2 lines only: public static double[] largests(double[] arr, int k) { Arrays.sort(arr); return Arrays.copyOfRange(arr, arr.length - k, arr.length); } This modifies (sorts) the original array. If you want your original array unmodified, you only need +1 line: public static double[] largests2(double[] arr, int k) { arr = Arrays.copyOf(arr, arr.length); Arrays.sort(arr); return Arrays.copyOfRange(arr, arr.length - k, arr.length); }
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/40359919
has comment: http://stackoverflow.com/comment/40359880

http://stackoverflow.com/comment/40504925
type: Comment
score: 1
type: AnswerComment
has text: Hi Nivedita ! I'm understand how do it work, Thanks your answer.
comment on: http://stackoverflow.com/a/25870850

http://stackoverflow.com/a/25849175
has body: Your MessageList class is an inner class. Inner class which is not static can not exist without instance of outer class. In my opinion you have to mark this class as static and since than below code should work properly: ObjectMapper deserializerMapper = new ObjectMapper(); StoreMessageList root = deserializerMapper.readValue(json, StoreMessageList.class); System.out.println(root);
score: 0
accepted answer of: http://stackoverflow.com/q/25804776
answers question: http://stackoverflow.com/q/25804776
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/40475709
comment on: http://stackoverflow.com/q/25849605
type: Comment
type: QuestionComment
has text: Ohh that looks like your POJO is not proper one. Check getter setter for your User Pojo with field id. But I think uptil now you might got your answer.
score: 0

http://stackoverflow.com/a/25732750
has comment: http://stackoverflow.com/comment/40231958
downvote count: 0
score: 1
has body: run this command in dos java -help to see all options and java -version you should get the some details.
type: Answer
answers question: http://stackoverflow.com/q/25732741
upvote count: 1

http://stackoverflow.com/q/25805550
upvote count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25805744
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/25805676
has answer: http://stackoverflow.com/a/25805722
accepted answer: http://stackoverflow.com/a/25805722
downvote count: 2
has title: Java Generics : Syntax Explanation
has body: I am new to java generics my question is : public static &lt; E &gt; void printArray( E[] inputArray ) In the above statement when the return type of function is void then why we have used E before void? Why this syntax is valid ? As per theory a method could itself be an return type? Then suppose E = method_abc then how compiler will manage public static method_abc void printArray (E[] Array) My reference program was public class GenericMethodTest { // generic method printArray public static &lt; E &gt; void printArray( E[] inputArray ) { // Display array elements for ( E element : inputArray ){ System.out.printf( "%s ", element ); } System.out.println(); } public static void main( String args[] ) { // Create arrays of Integer, Double and Character Integer[] intArray = { 1, 2, 3, 4, 5 }; Double[] doubleArray = { 1.1, 2.2, 3.3, 4.4 }; Character[] charArray = { 'H', 'E', 'L', 'L', 'O' }; System.out.println( "Array integerArray contains:" ); printArray( intArray ); // pass an Integer array System.out.println( "\nArray doubleArray contains:" ); printArray( doubleArray ); // pass a Double array System.out.println( "\nArray characterArray contains:" ); printArray( charArray ); // pass a Character array } }
answer count: 3
tagged with: generics
favorite count: 0
has answer: http://stackoverflow.com/a/25805676

http://stackoverflow.com/a/25873920
answers question: http://stackoverflow.com/q/25865972
has comment: http://stackoverflow.com/comment/40518455
type: Answer
has comment: http://stackoverflow.com/comment/40507973
downvote count: 0
score: 4
upvote count: 4
has body: You’re right, the thread state for a Thread inside the method Thread.sleep should be TIMED_WAITING. To cite the authoritative source: public static final Thread.State TIMED_WAITING Thread state for a waiting thread with a specified waiting time. A thread is in the timed waiting state due to calling one of the following methods with a specified positive waiting time: Thread.sleep Object.wait with timeout Thread.join with timeout LockSupport.parkNanos LockSupport.parkUntil I tested several Java versions (Oracle’s implementation) in the range 1.6 to 1.8, inclusive, and all show the correct behavior of reporting threads inside Thread.sleep with the state TIMED_WAITING. It’s also important to consider the following statement about Thread.sleep(): … The thread does not lose ownership of any monitors. So, since the thread does not lose ownership of monitors, it won’t reacquire monitors. So it shouldn’t be in Thread.State.BLOCKED. So either you are using a different JVM/JRE implementation or a modified Thread class, maybe it has been modified via Instrumentation at runtime. In either case, the information you have given in your question are not enough to narrow your problem further. It would be useful as well to know which version of jstack you have used as the output has a different format than I got. Maybe it’s the tool which prints the state wrong…

http://stackoverflow.com/comment/40212637
type: Comment
score: 0
type: AnswerComment
has text: Hi, thanks for the reply, but the problem is that Magnolia author does not start, so, I cannot access to the control panel.
comment on: http://stackoverflow.com/a/25722496

http://stackoverflow.com/q/25771677
possible better answer: http://stackoverflow.com/a/25771998
tagged with: android
type: Question
has comment: http://stackoverflow.com/comment/40312377
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25771998
accepted answer: http://stackoverflow.com/a/25771934
has title: How to send parameters to existing hidden fragment from activity
tagged with: android-fragments
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25771934
tagged with: communication
has body: I have a MainActivity with a NavigationDrawer. When I click on the navigation, a new fragment is created. By clicking on the next navigation point, the old is removed and the new is added with a transaction. Sometimes i open a new window within a navigation point. in this case i hide the old fragment and add a new fragment. now my problem: I have a fragmentA with an editText. When I click on this editText field a new fragmentB will be opened. The old fragmentA will be hidden. FragmentB has a list with items. When I click on one of this items I want to close this fragmentB and fill the value of the listItem in the editText of fragmentA. I tried many things, but it's not working. I transfer the listitem information to the MainActivity with a Communicator interface. That works. However, the way from the Mainactivity to the fragmentA is the problem. I can't put the item value with Bundle arguments because the fragment A is already there. I tried to call a public function which exists in fragmentA, but everytime I want to call this function from the MainActivity it is not possible, because there is no such function. I have no idea for updating the editText in fragmentA and hope for help. Sorry for my bad english.
score: 0

http://stackoverflow.com/comment/40397036
score: 0
type: AnswerComment
has text: Thanks, It help. But I have a class called Feed and 2 others that inherits from it... Is there a way to create different annotation for the subclasses?
type: Comment
comment on: http://stackoverflow.com/a/25822694

http://stackoverflow.com/comment/40432665
score: 0
type: Comment
has text: Thanks for your response.. Give me some idea to show two preview view for camera..
type: AnswerComment
comment on: http://stackoverflow.com/a/25842201

http://stackoverflow.com/a/25772092
has comment: http://stackoverflow.com/comment/40304279
answers question: http://stackoverflow.com/q/25771848
downvote count: 0
has body: ObjectInputStream::readObject returns an Object. readObject You are casting it to a List&lt;String&gt; without first checking if it really is a List&lt;String&gt;. As far as the compiler knows, it can be any kind of Object (a String, an Integer, and so on...)
type: Answer
has comment: http://stackoverflow.com/comment/40304030
has comment: http://stackoverflow.com/comment/40303994
score: 1
upvote count: 1

http://stackoverflow.com/comment/40354173
score: 0
has text: Rich text is a special type of item that contains an internal markup for formatting. So essentially you'll need to get the object and then modify it. There are lots of classes to help you, but it is not easy to manipulate and can get complicated quickly.
type: Comment
comment on: http://stackoverflow.com/a/25797435
type: AnswerComment

http://stackoverflow.com/comment/40423641
type: Comment
type: QuestionComment
score: 1
has text: `coming` is null. You only execute that line if `coming` is null, and trying to access a property of a null object is going to cause problems
comment on: http://stackoverflow.com/q/25837441

http://stackoverflow.com/a/25868877
has comment: http://stackoverflow.com/comment/40513464
downvote count: 1
has comment: http://stackoverflow.com/comment/40506255
has body: The Exception means that the socket was closed unexpectedly. See this What&#39;s causing my java.net.SocketException: Connection reset?
has comment: http://stackoverflow.com/comment/40513186
has comment: http://stackoverflow.com/comment/137612983
type: Answer
upvote count: 0
answers question: http://stackoverflow.com/q/25868300
score: -1
has comment: http://stackoverflow.com/comment/40513266

http://stackoverflow.com/q/25761729
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/25761951
has title: MapView not working
answer count: 4
has body: I Code, Google map not come on the mobile Screen please anyone help me. I have attached MainActivity Code, Manifest.xml Code and main.xml Code. MainActivity code below : public class MainActivity extends MapActivity { MapView mymaps; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mymaps = (MapView)findViewById(R.id.maps); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } } Manifest.xml code below : <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="17" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <uses-library android:name="com.google.android.maps"/> This is my apiKey : android:apiKey="AIzaSyB6JuQng3ru7CukjE_9osXMX1fa4SbLz9Q" />
has comment: http://stackoverflow.com/comment/40285208
tagged with: java
has comment: http://stackoverflow.com/comment/40285130
has answer: http://stackoverflow.com/a/25761888
type: Question
has answer: http://stackoverflow.com/a/25761821
score: 0
has answer: http://stackoverflow.com/a/25762026

http://stackoverflow.com/a/25813562
has comment: http://stackoverflow.com/comment/40381344
downvote count: 0
answers question: http://stackoverflow.com/q/25794516
score: 1
has comment: http://stackoverflow.com/comment/40381979
has body: The marshaller reacts correct. The minimum expected xml for example for an User class could be: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;user&gt;&lt;/user&gt; which is in fact an empty User. If you now send this: &lt;?xml version="1.0" encoding="UTF-8"?&gt; there is no starting value for the marshaller and the payload is marked as corrupted. Similar case for sending nothing. But if you use jersey 2.? (2.12 for me) you can use an ExceptionMapper to react on that (sample). import javax.servlet.http.HttpServletRequest; import javax.ws.rs.BadRequestException; import javax.ws.rs.core.Context; import javax.ws.rs.core.NoContentException; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import javax.ws.rs.ext.ExceptionMapper; import javax.ws.rs.ext.Provider; import javax.xml.bind.UnmarshalException; @Provider public class BadRequestExceptionMapper implements ExceptionMapper&lt;BadRequestException&gt;{ @Context private HttpServletRequest cr; @Override public Response toResponse(BadRequestException e) { String reason = String.format("Reason: %s", e.toString()); if( e.getCause() instanceof UnmarshalException ) reason = "Request payload is invalid."; if( e.getCause() instanceof NoContentException ) reason = "No payload given."; return Response.status(Status.BAD_REQUEST) .entity(String.format("%s [resource:%s, contentType:%s, method:%s]", reason, cr.getPathInfo(), cr.getContentType(), cr.getMethod() ) ).build(); } } Hope this was helpfull somehow :)
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25794516

methods
tags question: http://stackoverflow.com/q/25785718
tags question: http://stackoverflow.com/q/25823644
tags question: http://stackoverflow.com/q/25838341
tags question: http://stackoverflow.com/q/25832120
tags question: http://stackoverflow.com/q/25740300
tags question: http://stackoverflow.com/q/25811320
tags question: http://stackoverflow.com/q/25859745
tag name: methods
tags question: http://stackoverflow.com/q/25824269
tags question: http://stackoverflow.com/q/25794066
tags question: http://stackoverflow.com/q/25847779
tags question: http://stackoverflow.com/q/25836295
tags question: http://stackoverflow.com/q/25756237
tags question: http://stackoverflow.com/q/25798208
type: Tag
tags question: http://stackoverflow.com/q/25834489
tags question: http://stackoverflow.com/q/25831314
tags question: http://stackoverflow.com/q/25820291
tags question: http://stackoverflow.com/q/25844942
tags question: http://stackoverflow.com/q/25774561
tags question: http://stackoverflow.com/q/25821845
tags question: http://stackoverflow.com/q/25842228
tags question: http://stackoverflow.com/q/25760218
tags question: http://stackoverflow.com/q/25798003
tags question: http://stackoverflow.com/q/25754328
tags question: http://stackoverflow.com/q/25796444
tags question: http://stackoverflow.com/q/25847309
tags question: http://stackoverflow.com/q/25867191
tags question: http://stackoverflow.com/q/25731000
tags question: http://stackoverflow.com/q/25736377
tags question: http://stackoverflow.com/q/25714594
tags question: http://stackoverflow.com/q/25867436
tags question: http://stackoverflow.com/q/25817035
tags question: http://stackoverflow.com/q/25768560
tags question: http://stackoverflow.com/q/25726803
tags question: http://stackoverflow.com/q/25785129
tags question: http://stackoverflow.com/q/25858326
tags question: http://stackoverflow.com/q/25840574
tags question: http://stackoverflow.com/q/25731521
tags question: http://stackoverflow.com/q/25735685
tags question: http://stackoverflow.com/q/25768865
tags question: http://stackoverflow.com/q/25713380
tags question: http://stackoverflow.com/q/25802158

http://stackoverflow.com/q/25744398
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/25304422
has title: Retrieve ServerValue.Timestamp from Firebase in Android app, when data is sent
accepted answer: http://stackoverflow.com/a/25750727
has answer: http://stackoverflow.com/a/52203779
tagged with: chat
type: Question
has comment: http://stackoverflow.com/comment/40254918
linked to: http://stackoverflow.com/q/25500138
has answer: http://stackoverflow.com/a/25750727
has answer: http://stackoverflow.com/a/41644646
upvote count: 7
has answer: http://stackoverflow.com/a/43402101
has comment: http://stackoverflow.com/comment/40256473
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/40254716
tagged with: android
possible better answer: http://stackoverflow.com/a/41644646
tagged with: timestamp
tagged with: firebase
type: AnsweredQuestion
has body: I would like to know how to use Firebase's ServerValue.TIMESTAMP method, when I want to create a timestamp at the Firebase server, and then retrieve it to the local client. In Firebase guides, only javascript has a more detailed description of this case, but I'm having a hard time figureing how to translate this in to my Android appliction. Thanks in advance!
downvote count: 0

http://stackoverflow.com/comment/40343497
type: Comment
type: QuestionComment
has text: I attached the log cat in main post. @Selvin You are right ` <action android:name="MY_AWESOME_ACTION" /> ' Is not the the solution i want to achive...i need the app to rerun again after device reboot, so i ll try again on MyOnBootReceiver to see..Any suggestion ? :)
comment on: http://stackoverflow.com/q/25785908
score: 0

http://stackoverflow.com/q/25785724
has comment: http://stackoverflow.com/comment/40330111
favorite count: 0
has comment: http://stackoverflow.com/comment/40331363
has answer: http://stackoverflow.com/a/25788651
tagged with: simple-html-dom
has body: IS it possible to get all the elements which has href as a attribute from the dom using simple_html_dom in php and also get the value of that href ?
type: UnansweredQuestion
tagged with: codeigniter
upvote count: 1
tagged with: php
score: 1
tagged with: java
type: Question
has title: How to get value of href for any element in the dom having href attribute using simple_html_dom
has comment: http://stackoverflow.com/comment/40329274
has comment: http://stackoverflow.com/comment/40328625
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/40382699
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25814448
has text: Try `params.put("user_ids", userIds);`. what does that?
score: 0

http://stackoverflow.com/comment/52260255
type: AnswerComment
has text: This is absolutely what I was looking for, even though we managed to write our own custom code for the purpose. Anyway, thanks!
type: Comment
comment on: http://stackoverflow.com/a/30890313
score: 1

atomic
type: Tag
tags question: http://stackoverflow.com/q/25840733
tag name: atomic

http://stackoverflow.com/comment/40232902
score: 0
type: Comment
has text: This doesn't work for me... the whole scenario is as following: The replacement text is in hashmap with key as the string to be replaced in the text. I am able to replace all the keys.. but I would just need to replace all except the first one. I m iterating through hashmap and then replacing. I tried your code inside the hashmap iteration.
type: AnswerComment
comment on: http://stackoverflow.com/a/25730603

http://stackoverflow.com/q/25818220
type: Question
answer count: 2
has body: I wrote the following code... public class MatrixAddition { public static void main(String[] args) { double matrix[][] = { { 1.2, 3.3, 1.2 }, { 1.0, 2.2, 4.5 }, { 1.3, 4.5, 2.2 } }; double matrix1[][] = { { 2.2, -3.3, 1.1 }, { 7.0, -2.2, 4.2 }, { 2.2, 0.0, 0.3 } }; double result[][] = new double[matrix.length][matrix1.length]; for(int iResult = 0; iResult &lt; result.length; iResult++) { for(int jResult = 0; jResult &lt; result[iResult].length; jResult++) { result[iResult][jResult] = matrix[iResult][jResult] + matrix1[iResult][jResult]; System.out.print(result[iResult][jResult] + " "); } System.out.print("\n"); } } } The result is: 3.4000000000000004 0.0 2.3 8.0 0.0 8.7 3.5 4.5 2.5 Every time when i change the values for Matrix[i0][j0] and Matrix1[i0][j0] i get proper results, but when the values are 1.2 and 2.2 i always get 3.400000000000004. How can i fix that , and why that happens. Thanks in advance.
linked to: http://stackoverflow.com/q/588004
score: 0
has comment: http://stackoverflow.com/comment/40389017
tagged with: matrix
linked to: http://stackoverflow.com/q/2100490
has answer: http://stackoverflow.com/a/25818298
has answer: http://stackoverflow.com/a/25818304
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40388891
has comment: http://stackoverflow.com/comment/40389617
tagged with: java
has title: Matrices addition with weird result

geotools
type: Tag
tags question: http://stackoverflow.com/q/25800696
tag name: geotools

http://stackoverflow.com/q/25772114
has body: I've defined a grammar in ANTLRv4, as well as written a small example file to test it's parsing, and it is constantly giving me the error: line 1:0 mismatched input 'import' expecting 'class' the test file is http://pastebin.com/ThpuexL5 the grammar file is http://pastebin.com/6PAUHzrT I have no idea why the grammar I've written is trying to match to 'class' instead of 'import' even though I've defined that import should come first.
tagged with: parsing
tagged with: antlr4
answer count: 0
has comment: http://stackoverflow.com/comment/40339074
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40339791
has comment: http://stackoverflow.com/comment/40312832
has comment: http://stackoverflow.com/comment/40307888
tagged with: java
has title: Issues parsing a test file with ANTLRv4
type: Question
has comment: http://stackoverflow.com/comment/40332413
score: 0

http://stackoverflow.com/q/25851853
answer count: 1
has body: I'm working on a game for Android platform, using Java and LibGDX engine. I've run into an odd issue where FPS in my game drops contantly every 30-40 seconds from 57-60 to 40-45 frames and then gets back. Below are screenshots of logcat output. Garbage Collector is not working at these moments (there is nothing filtered from the log): I've done some profiling and found out that the problem occurs because of EGLImpl.eglSwapBuffers calls that every 30-40 seconds take more time than usual. On the screenshot below (taken while profiling game menu when nothing happens at all) it takes 3,7ms: In my rendeing cycle for the menu I just call MyStage.act() and MyStage.draw() which draw a set of ImageButtons - nothing special. My frame render time for the menu (17ms average) also seems too long for such simple rendering, but these stange periodic long buffer swap calls are my main concern now. By the way if I profile during the gameplay it becomes worse - these EGLImpl.eglSwapBuffers calls take 15ms and more and drop FPS to 30 and keep it there constantly: I could really use some advice on how to investigate this.
has title: Android LibGDX game: FPS drops because of long EGLImpl.eglSwapBuffers calls
tagged with: opengl-es
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 4
downvote count: 0
tagged with: frame-rate
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40460360
tagged with: libgdx
score: 4
has answer: http://stackoverflow.com/a/25862459

http://stackoverflow.com/comment/40199397
type: Comment
has text: @dici Please reply with `@username`. That javadoc entry is simply stating that [Threads are GC roots](http://stackoverflow.com/questions/6366211/what-are-the-roots).
type: AnswerComment
comment on: http://stackoverflow.com/a/25715110
score: 0

http://stackoverflow.com/q/25813564
score: 0
answer count: 3
has body: I just started to learn Java with the Standford course. As you may know every other chapter teaches you how to create program to solve a problem. I always tend to practice a little bit more by creating new problems based on what we get on the course. As im learning the for statement I tried to create a program that multiplies n 10 times. So it would be n * n * n... and so on... And it works, but i was wondering if there was a simpler way to solve this problem. Here is my code. /*This program multiplies an n number 10 times. * */ import acm.program.ConsoleProgram; public class LiftOff extends ConsoleProgram { public void init() { setSize(height,width); } private static final int height = 600; private static final int width = 600; public void run () { println ("This program multiplies a number 10 times"); double x= readInt("Number: "); double stop = x * x * x * x * x * x * x * x * x * x * x; for (double x1 = x ; x1 &lt;= stop; x1*= x) { println (x1); } println("Done"); } } I used doubles because int would go negative. I tried to make double stop = xE+10 but it would not work. Any solutions other than this one base on what I've learned so far. Take into account this uses the acm library. Thanks.
has answer: http://stackoverflow.com/a/25813646
has comment: http://stackoverflow.com/comment/40379890
accepted answer: http://stackoverflow.com/a/25813599
has comment: http://stackoverflow.com/comment/40380024
has comment: http://stackoverflow.com/comment/40379827
has title: Multiply n 10 times in java (Beginner)
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40379868
tagged with: math
tagged with: java
possible better answer: http://stackoverflow.com/a/25813630
has answer: http://stackoverflow.com/a/25813630
has answer: http://stackoverflow.com/a/25813599
type: Question

http://stackoverflow.com/comment/40281267
comment on: http://stackoverflow.com/q/25759492
score: 0
type: QuestionComment
type: Comment
has text: What are #126, 123 and others code-line strings?

http://stackoverflow.com/comment/40238345
score: 0
type: Comment
has text: @TomG.. when I say meaningful, Ids should be easy to remember for Users. For example **bugcategory-bugNum** (defect-1234) is more easy to remember than an UUID number 067e6162-3b6f-4ae2-a171-2470b63dff00. With the help of ID generation strategies we can generate custom ids that are combination of text and numbers.
type: QuestionComment
comment on: http://stackoverflow.com/q/25716485

http://stackoverflow.com/comment/97438736
type: AnswerComment
has text: @RobinVarghese did you find any solution to your problem. I have a similar use case to be solved. Appreciate if you have some suggestion.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25873705

http://stackoverflow.com/comment/40204380
comment on: http://stackoverflow.com/q/25718053
score: 0
type: Comment
type: QuestionComment
has text: Because ,you are not printing anything from your servlet.

http://stackoverflow.com/q/25714545
has body: I am trying to use Hibernate or native SQL or java to return a list of Product objects, but I can not get the code working, I appreciate if anybody help me, thanks a lot, This is the logic: ... ArrayList&lt;Product&gt; prodList = new ArrayList&lt;Product&gt;(); EntityManager entityManager = this.entityManager; try { //the logic of following query is: select all records from prodTable table where productDate is //passed 2 months than today's date(something list today's day minus productDate is 2 months), //and then the records are not existed in prodCategory table by the key of ProductID and //productCategory combination. So the prodList is the combination of the above two conditions. //something like this: String queryString = "select p from prodTable p where (today - p.ProductDate) greaterThan 2 months AND p is not in (select c from prodCategory c where c.ProductID = p.ProductID and c.category = '09' ) //need help of this line of query. prodList = entityManager.createQuery(queryString).getResultList(); return prodList; } catch (Exception e) { throw e; } ...
has title: how to create this query string in java createQuery?
type: Question
has answer: http://stackoverflow.com/a/25717846
tagged with: java
tagged with: hibernate
score: 0
tagged with: native
has comment: http://stackoverflow.com/comment/40197950
tagged with: sql
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/40197747
type: UnansweredQuestion

http://stackoverflow.com/q/25858400
has body: I have looked everywhere on the internet and tried everything the forums say to do and nothing works. This error keeps coming up. I have tried running my java project (not for android) even the drop down run as button doesn't work because it says "none applicable".
has answer: http://stackoverflow.com/a/48842377
has answer: http://stackoverflow.com/a/52140320
has comment: http://stackoverflow.com/comment/40462142
has answer: http://stackoverflow.com/a/35786821
favorite count: 0
has comment: http://stackoverflow.com/comment/40462028
has comment: http://stackoverflow.com/comment/40462067
has answer: http://stackoverflow.com/a/75910597
has answer: http://stackoverflow.com/a/34709322
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/32316526
has answer: http://stackoverflow.com/a/25858666
has comment: http://stackoverflow.com/comment/40462094
has comment: http://stackoverflow.com/comment/40462092
has title: Eclipse Java error: This selection cannot be launched and there are no recent launches
upvote count: 46
tagged with: java
has answer: http://stackoverflow.com/a/31002928
has answer: http://stackoverflow.com/a/31709011
has comment: http://stackoverflow.com/comment/40461975
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40461980
score: 46
type: Question
has answer: http://stackoverflow.com/a/33772898
downvote count: 0
has comment: http://stackoverflow.com/comment/40462173
has answer: http://stackoverflow.com/a/76710398
answer count: 11
has comment: http://stackoverflow.com/comment/40462044
has comment: http://stackoverflow.com/comment/40461918

http://stackoverflow.com/comment/40367295
score: 0
comment on: http://stackoverflow.com/q/25806919
type: QuestionComment
type: Comment
has text: This is not possible. Sorry!

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/25718066
type: Tag

http://stackoverflow.com/q/25754101
tagged with: java
has comment: http://stackoverflow.com/comment/40272423
type: Question
has title: Best way to create 5D or 6D array in java
tagged with: arrays
score: 0
answer count: 3
upvote count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25759520
tagged with: multidimensional-array
has comment: http://stackoverflow.com/comment/40272458
has answer: http://stackoverflow.com/a/25754317
has answer: http://stackoverflow.com/a/25754257
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40272512
has comment: http://stackoverflow.com/comment/40272269
has body: I am working on redesigning of a code in which 6D array are created . This is required for Cplex linear calculation. Now, there are API's which can support 1D or int variable in cplex also so its not important to have 6 dimension array. Only the mapping is important with the variable which will be required when retrieing it from another method. Is there any way of replacing 6D array. This will also help in simplying the complexity of the code. -> can i replace somehow the 6D array and store the variable in 1D array or int variable.. -> I tried HashMap with key as list and value as Integer but eventually it is taking more time because HashMap internally uses Array. Sample code is: int [][][][][][] testVariable = new int [2][2][3][5][2][2]; HashMap&lt;List&lt;Integer&gt;, Integer&gt; mapping = new HashMap&lt;List&lt;Integer&gt;, Integer&gt;(); int[] arrayAdd = new int[11111]; for (int a =0; a &lt;= 2; a++) { for (int l = 0; l &lt; 2; l++) { for (int y = 0; y &lt; 3; y++) { for (int r = 0; r &lt; 5; r++) { for(int oc=0; oc&lt; 2; oc++){ for(int c=0; c&lt; 2; c++){ // usual array of 6D testVariable[a][l][y][r][oc][c]=count; // FIRST METHOD ( Takes more time then Array) LinkedList&lt;Integer&gt; listAdd = new LinkedList&lt;Integer&gt;(); listAdd.add(a); listAdd.add(l); listAdd.add(y); listAdd.add(r); listAdd.add(oc); listAdd.add(c); mapping.put(listAdd, count); // second method .. this i am still testing but it doesnt make much sense) arrayAdd[a + l + y + r + oc + c] = count; // Arrays.fill(arrayAdd, count); //System.out.println("Value of list is " + listAdd); count ++; } } } } } }
has comment: http://stackoverflow.com/comment/40272024

http://stackoverflow.com/comment/82777964
type: Comment
comment on: http://stackoverflow.com/a/37870725
has text: Just one suggestion, while calculating sample duration, it should be divided by track time scale to get actual duration.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25715807
score: 0
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/25715862
linked to: http://stackoverflow.com/q/5134555
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25715856
has title: Converting a one-dimensional array[81] to a multi-dimensional array[9][9] (sudoku solver)
tagged with: java
type: Question
answer count: 2
tagged with: arrays
duplicate of: http://stackoverflow.com/q/5134555
has body: I have recently started making a sudoku solver. The solver itself is done and works great but i have found one issue. My solver is based on a 2D array that stores the sudoku game board numbers. The array looks like this.... The 12's represent empty spaces that need numbers in them. private static int[][] currentPuzzle = new int[][] { { 12, 12, 6, 12, 12, 12, 12, 12, 12 }, { 12, 12, 12, 12, 3, 6, 5, 12, 12 }, { 2, 3, 8, 12, 12, 4, 12, 12, 12 }, { 8, 7, 12, 12, 12, 12, 12, 12, 5 }, { 12, 12, 3, 12, 9, 12, 2, 12, 12 }, { 4, 12, 12, 12, 12, 12, 12, 6, 8 }, { 12, 12, 12, 4, 12, 12, 8, 1, 9 }, { 12, 12, 9, 3, 7, 12, 12, 12, 12 }, { 12, 12, 12, 12, 12, 12, 6, 12, 12 } }; The problem is that my program reads the sudoku board integers from a game using the reflection java api. The method returns the sudoku board as a 1D array that looks like this.... The 12's represent empty spaces that need numbers in them. private static int[] currentPuzzle = new int[] { 12, 12, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 3, 6, 5, 12, 12, 2, 3, 8, 12, 12, 4, 12, 12, 12, 8, 7, 12, 12, 12, 12, 12, 12, 5, 12, 12, 3, 12, 9, 12, 2, 12, 12, 4, 12, 12, 12, 12, 12, 12, 6, 8, 12, 12, 12, 4, 12, 12, 8, 1, 9, 12, 12, 9, 3, 7, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 6, 12, 12 }; I need to convert the 1D array version(the second array shown above) of the board into the a 2D array version(the first array shown above) format. The new 2D array must have 9 rows with 9 columns. Do you guys have any ideas?

http://stackoverflow.com/comment/40294653
score: 0
type: Comment
type: QuestionComment
has text: Put it on some file sharing service like Dropbox and share the link. A screen shot won't do, we need the PDF.
comment on: http://stackoverflow.com/q/25766536

http://stackoverflow.com/a/25864905
downvote count: 0
type: AcceptedAnswer
score: 4
accepted answer of: http://stackoverflow.com/q/25783038
has body: We solved the problem by investigating ActiveMQ source code to understand the fragment: gc candidates after first tx:89:10178611 Turns out, 89 is the log file name (db-89.log), and 10178611 the offset in the file. So, we dumped the log file: xxd -g1 db-89.log | less then we did a text search for our offset (converted to hexadecimal). In the dump, there was the human-readable name of the queue with a hanging transaction and the server it came from. I don't have access to the problematic server or the code, but the admin told me informally that their developers "fixed" the closing of the transaction, whatever the fix might have been. This solved the problem.
answers question: http://stackoverflow.com/q/25783038
type: Answer
upvote count: 4

http://stackoverflow.com/a/25851698
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25851577
has body: byte[] BC_imagedata = rs.getBytes("BCImg"); BC_format = new ImageIcon(BC_imagedata); ID_Front_BC.setIcon(BC_format); byte[] ID_imagedata = rs.getBytes("IDImg"); if(ID_imagedata == null){ID_format=null;}else{ ID_format = new ImageIcon(ID_imagedata);} ID_Front_Pic.setIcon(ID_format); Should be if(ID_imagedata == null) not if(ID_imagedata.equals(null)) that will always through a null pointer exception. It is expecting an object as its input but instead you are passing null.

http://stackoverflow.com/comment/40346696
score: 0
type: Comment
has text: No, I am not looking for `local inner class` if they exist.
comment on: http://stackoverflow.com/a/25795434
type: AnswerComment

http://stackoverflow.com/a/26381072
has comment: http://stackoverflow.com/comment/41451884
has comment: http://stackoverflow.com/comment/41417709
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/41459603
answers question: http://stackoverflow.com/q/25741168
has body: Had the same situation (403 status code) with CAS SLO, in my spring security log I found: Invalid CSRF token found for http://localhost:8080/j_spring_cas_security_check so I disabled csrf filter in my security config: http.csrf().disable(); This might not be a good practice, just a quick solution that works for me now. Also I am not shure if I can get the right csrf token if SLO is initiated in other protected application.
has comment: http://stackoverflow.com/comment/41452050
upvote count: 3
accepted answer of: http://stackoverflow.com/q/25741168
score: 3
has comment: http://stackoverflow.com/comment/41427767

http://stackoverflow.com/a/25744643
type: Answer
answers question: http://stackoverflow.com/q/25744463
has body: You must declare nums to : int nums[] = new int[taille] ;
score: 0

http://stackoverflow.com/comment/40315937
type: Comment
type: QuestionComment
score: 0
has text: Why do you think you need to pass a reference to Descriptors in each read()/search()? read() and search() are methods of FILE class, and Descriptor is a member of FILE, so read() and search() methods can refer Descriptor without any pssed information.
comment on: http://stackoverflow.com/q/25778285

http://stackoverflow.com/comment/40296601
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25767422
has text: like in first query: r.roles .

http://stackoverflow.com/q/25867169
has answer: http://stackoverflow.com/a/25867792
has title: is using a base class for entites a good idea?
favorite count: 0
type: UnansweredQuestion
has body: I read this article about a base class for hibernate entities. Is is nowadays a good idea to use a base class for common fields like id, version, create_at, create_by, etc.? What about hashcode and equals-Methods? I do not like to use the id field for my equals methods. Is it possible to solve this by composition? What are the downsides?
upvote count: 1
downvote count: 1
type: Question
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25867724
score: 0
answer count: 2

http://stackoverflow.com/q/25764529
tagged with: servlets
score: 0
has body: I have an ajax get request to my server(where Text is my sentence I want to send to my server) $.get("http://localhost:8080/myname/MyServlet?actn=InsertData&amp;sentence="+Text,function(data){ }); And in my MyServlet class I have the function InsertData and there I print the sentence i've sent from the $.get call public String InsertData(String Sentence) { System.out.println(Sentence); ........... ........... } The problem is if for example im sending the sentence : The stock’s rise has boosted Zuckerberg’s wealth to $34.5 billion, according to the Bloomberg Billionaires Index. The output in InsertData : The stock?s rise has boosted Zuckerberg?s wealth to $34.5 billion, according to the Bloomberg Billionaires Index. Another example for the problem : Facebook shares had already jumped 81 percent in the 12 months through Sept. 5, compared with a 21 percent increase for the S&amp;P 500. The output in InsertData : Facebook shares had already jumped 81 percent in the 12 months through Sept. 5, compared with a 21 percent increase for the S I tried using encodeURIComponent but it doesn't solve it. I tried to use UTF-8 decoding on the servlets but it doesn't solve either. How can I solve that?
answer count: 1
tagged with: jquery
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25764625
tagged with: java
has title: JQuery & Java servlets : escaping special characters
type: Question
tagged with: javascript
tagged with: character-encoding

http://stackoverflow.com/comment/40431230
type: Comment
comment on: http://stackoverflow.com/q/25841221
score: 0
type: QuestionComment
has text: Unfortunately, not, it's part of a closed software package that I no longer have access to...

http://stackoverflow.com/comment/40328985
type: Comment
comment on: http://stackoverflow.com/a/25785938
has text: Thanks a lot ! Changed either 1 to DEFAULT and it works.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25715696
tagged with: java
has title: how do i make a variable that combines two variables?
possible better answer: http://stackoverflow.com/a/25715741
has body: i tried looking online and did not fined anything helpful, i am making a hangman game, and i want a String that would get a random word from a huge pile of words, i thought that if i made all my words variables like word1, and made a String that equals word plus a random integer Ex. String randomWord = word+randomInt; then made a random number generator that would generate a random number and set it to randomInt, but when i do that it tells me that word is not a variable, i tried putting ' those things around the whole statement, but it didn't work, how could i do something like this? CODE: import java.awt.*; import javax.swing.*; import java.util.*; import java.awt.event.*; import java.applet.*; import java.lang.*; public class hangMan { public static void main(String[] arg) { Random random = new Random(); int randomInt = random.nextInt(2) + 1; System.out.println("Random Integer in Java: " + randomInt); //word letters final String word1Letter1 = "l"; final String word1Letter2 = "u"; final String word1Letter3 = "d"; final String word1Letter4 = "e"; final String word1 = "lude"; final String word2Letter1 = "l"; final String word2Letter2 = "o"; final String word2Letter3 = "s"; final String word2Letter4 = "e"; final String word2 = "lose"; final String word3Letter1 = "s"; final String word3Letter2 = "t"; final String word3Letter3 = "o"; final String word3Letter4 = "p"; final String word3 = "stop"; //fault counter final int faultCounter = 8; String randomWord = word+randomInt; //looks for the game ---------------------------------------------------------------------------------- JFrame hangPanel = new JFrame("Hang Game"); hangPanel.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); hangPanel.setLocationRelativeTo(null); JPanel northContainer = new JPanel(); northContainer.setVisible(true); northContainer.setBackground(Color.gray); JPanel southContainer = new JPanel(); southContainer.setVisible(true); southContainer.setBackground(Color.gray); final JEditorPane outComunication…
score: 0
tagged with: random
answer count: 3
has answer: http://stackoverflow.com/a/25715727
accepted answer: http://stackoverflow.com/a/25715727
tagged with: variables
tagged with: string
tagged with: int
has answer: http://stackoverflow.com/a/25715993
has comment: http://stackoverflow.com/comment/40199966
has comment: http://stackoverflow.com/comment/40199954
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40199938
has answer: http://stackoverflow.com/a/25715741

non-static
tags question: http://stackoverflow.com/q/25734310
type: Tag
tag name: non-static

http://stackoverflow.com/q/25810725
favorite count: 0
has comment: http://stackoverflow.com/comment/40445640
type: UnansweredQuestion
has body: When using org.apache.cxf.jaxrs.client.WebClient the url works and connects, so I know my parameters and my emailServiceURI are not the problem. But when using import org.springframework.web.client.RestTemplate, I get this exception. I'm using this code in the IDE. RestTemplate template = new RestTemplate(); template.postForObject(emailServiceURI,params,ParametersFromFilenet.class); - 404 Not Found org.springframework.web.client.HttpClientErrorException: 404 Not Found at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:88) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:537) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:493) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:452) at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:302) at com.phx.filenet.FilenetDelegator.sendToWebService(FilenetDelegator.java:107) at com.phx.filenet.FilenetDelegator.main(FilenetDelegator.java:46) Ultimately I want to create a jar that will call a web service with parameters from a jar. I ran into problems including a jace.jar with maven and resolved that, a problem getting the right jars for springframework.web.client and resolved that, a problem kicking it off from command line and resolved that. This is the latest challenge I faced so I am bringing it to the community.
tagged with: maven
tagged with: spring
tagged with: http-status-code-404
answer count: 0
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/40382897
type: Question
tagged with: webservice-client
has title: How to Resolve 404 error using org.springframework.web.client.RestTemplate.postForObject(). With valid Parameters and URI
downvote count: 0

http://stackoverflow.com/q/25818084
type: Question
has body: I have a series of input images like the one attached. These are images of a television screen, and transformed using Canny Edge. This is not a necessary step, but I thought it would be nicer to illustrate the issue. What I'd like to do now is find the 4 coordinates of the edges in the big(gest) square in the image. I've taken a look at HoughTransform, but while it detects the image, I have a hard time understanding how this can give me the point of the image. Basically, I'd like to call a method like: public Point[] findEdges(BufferedImage image) Is there any library, algorithm, or anything else out there which can be easily used (it's a simple hobby project) in my Java application which I haven't found yet?
has comment: http://stackoverflow.com/comment/40389175
has comment: http://stackoverflow.com/comment/40389095
has comment: http://stackoverflow.com/comment/40393317
downvote count: 0
has comment: http://stackoverflow.com/comment/68765722
favorite count: 0
has comment: http://stackoverflow.com/comment/40388657
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8667818
answer count: 0
score: 1
has comment: http://stackoverflow.com/comment/40388694
tagged with: java
has title: Edge detection in images
has comment: http://stackoverflow.com/comment/40389364
tagged with: image-processing
upvote count: 1
has comment: http://stackoverflow.com/comment/40388763
has comment: http://stackoverflow.com/comment/40389302

http://stackoverflow.com/q/25739969
linked to: http://stackoverflow.com/q/17117589
upvote count: 13
has answer: http://stackoverflow.com/a/25911059
score: 12
has body: I have following configuration in my pom.xml <build> <plugins> maven-surefire-plugin 2.17 **/DocumentChangeSubscriberTest.java (...) DocumentChangeSubscriberTest is an arquillian test that I want to run only in specified profile. When I type mvn install all tests are run, even DocumentChangeSubscriberTest that I want to exclude. How to exclude test from the default (anonymous) profile? I tried <includes><include>... and it works fine - only included tests were run. I saw maven surefire test plugin runs tests even if they are excluded: but this is not working for me. I also tried many versions of maven-surefire-plugin without result. Any ideas?
possible better answer: http://stackoverflow.com/a/25911059
downvote count: 1
favorite count: 0
linked to: http://stackoverflow.com/q/9461519
answer count: 5
has answer: http://stackoverflow.com/a/25740168
has answer: http://stackoverflow.com/a/32029297
tagged with: maven
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25740299
has answer: http://stackoverflow.com/a/29988181
accepted answer: http://stackoverflow.com/a/25740299
tagged with: java
type: Question
has title: Maven (surefire) test plugin excludes not working
tagged with: jboss-arquillian

http://stackoverflow.com/a/25796737
type: Answer
score: 1
has body: Bridging an ActiveMQ broker with a WebSphere MQ queue manager requires the same client libraries as a direct connection. You are correct that you can pretty easy setup such a bridge using Apache Camel, that comes bundled with ActiveMQ. One possible benefit from having a local broker as a buffer might be that your application can rely on a broker that is up and controlled by you. The remote/external controlled WebSphere MQ might be taken down for maint. by external parties or the network might be shaky. Of course, your application can handle such things using logic and rescheduled transmissions but it's far easier to set up a Camel route in ActiveMQ to do that and focus your logic in the application to do business logic.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25789676

http://stackoverflow.com/comment/40382582
score: 0
comment on: http://stackoverflow.com/q/25813749
type: Comment
has text: I have it as a property in the `studentsFrame`: `private static DefaultTableModel tableModel;`
type: QuestionComment

http://stackoverflow.com/comment/40265938
has text: the property `deployed.environment` is not a property that Jetty itself is aware of, that would be either something custom to your configuration, or something custom that the linux distribution's packaging of Jetty added.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25747247
type: AnswerComment

http://stackoverflow.com/comment/40475261
type: AnswerComment
has text: It's another problem. To solve it you can install global focus listener. Use Toolkig.getDefaultToolkit().addAWTEventListener(...) method. So each time when you get focus ganed event for a JTextComponent you can check whether it's empty or not.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25865351

http://stackoverflow.com/a/25746479
has comment: http://stackoverflow.com/comment/40326082
downvote count: 0
score: 4
has body: Can I use only redis to store my data ? It depends on your requirements but with 150+ NoSQL database available, I suspect redis is not your only option. Reason why I am asking is that every article I have seen use Redis/memcached as an intermediate layer for caching. It is faster than JDBC, but do you need it to be faster? Can I just rely on redis to persist my data through out ? You could, it depends on your reliability requirements. e.g. some organisations only trust traditional RDBMS databases. Note: you need to have redis on multiple servers to pretect against a failure. Where to host/run redis database ? Wherever you like. Since Redis is an in-memory database, its requirement of host will definitely be different than applications that require more processing. Hosts which have more RAM will definitely be better here. I would normally put a NoSQL instance on the same machine. The amount of RAM you give it depends on how much data you need. So where do people normally go on to host their database ? Across multiple servers for redundacy, they can be shared with the applications. Elasticcaching from AWS, can this be used to host redis(as a primary database, not just caching layer) Any resources ? I would ask them. I always ask this, I found lots of good documents online, but nothing really good to start with. Please share any good resource if you are aware of. There is no one resource as there is no one answer. If there was, there would be 150+ NoSQL databases. Disclaimer: I have work another NoSQL key-value store which is persisted as well as in memory and is dramatically faster (if you need that sort of thing) It is also simpler to use/deploy. https://github.com/OpenHFT/Chronicle-Map
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/40326115
has comment: http://stackoverflow.com/comment/40334061
answers question: http://stackoverflow.com/q/25745790

http://stackoverflow.com/comment/40254138
type: Comment
has text: see the line `gestureListener = new View.OnTouchListener(){...`, you just created a listener but it wasn't attached to anything on your layout
type: AnswerComment
comment on: http://stackoverflow.com/a/25743970
score: 0

http://stackoverflow.com/comment/40454752
type: QuestionComment
has text: This http://www.java2s.com/Code/Java/Database-SQL-JDBC/GetIndexInfo.htm may help you.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25854388

http://stackoverflow.com/q/25715824
has comment: http://stackoverflow.com/comment/40200865
has comment: http://stackoverflow.com/comment/40200751
has comment: http://stackoverflow.com/comment/40200898
type: Question
has comment: http://stackoverflow.com/comment/40200486
has comment: http://stackoverflow.com/comment/40200787
has comment: http://stackoverflow.com/comment/40223153
downvote count: 4
tagged with: fileinputstream
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/40200844
has comment: http://stackoverflow.com/comment/40222722
has comment: http://stackoverflow.com/comment/40200343
has answer: http://stackoverflow.com/a/25716154
tagged with: file-io
has comment: http://stackoverflow.com/comment/40200874
answer count: 1
favorite count: 0
tagged with: serialization
has title: Java serialize List each object holds a file in a byte array
score: -4
has comment: http://stackoverflow.com/comment/40200803
accepted answer: http://stackoverflow.com/a/25716154
has body: I have an object that has a List each ObjectA has a few data members (strings and a byte[]). Along with a FileInputStream used to read a file into the byte array. I have initialized all data members in the global scope of the object so that I can recycle them to reduce the amount of object creation per function call. When I serialize the object my FileInputStream is null, as I store the file in the byte array. so I expect that the FileInputStream being null would be skipped by the serialization process. both the main object and the objects that are put in the list of the main object are implementing serializable I'm able to serialize the object that holds the list of objects and deserialize it as long as the list is empty. When the list has at least one object in it. It's still able to serialize but when i attempt to deserialize it I get the following error. IOException: writing aborted; java.io.NotSerializableException: java.io.FileInputStream The variables in my object's is as followed: public class MainObject implements Serializable{ private String name; private List&lt;ObjectA&gt; obj; } public class ObjectA implements Serializable{ private String id; private String name; private File fileStream; byte []data; } To trouble shoot this I saved the serialized object to a file and looked at it and I can see the MainObject is being saved. If I include objects into the list the objects are also being saved. Here is the code I made for reading the files and adding them to the object. File[] files = new File(filePath).listFiles(); for (File file : files) { if (file.isFile()) { System.out.println(file.getName()); try { fin = new FileInputStream(filePath+file.getName()); ois = new ObjectInputStream(fin); mainObjectList.add((MainObject) ois.readObject()); ois.close(); fin.close(); } catch (FileNotFoundException e) { System.err.println("FileNotFoundException: " + e.getMessage()); } catch (ClassNotFoundException e) { System.err.println("ClassNotFoundException: " + e.getMessag…
has comment: http://stackoverflow.com/comment/40200808
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40200825
tagged with: java

http://stackoverflow.com/a/25777498
has body: To add to Eran's answer: The value: String OneThree = "I'm " +lyric+ "my baby " +userString; Does not update when lyric and userString change, it is a one time setting. Update it in your loop, and you will see the change when printed.
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25777452
upvote count: 1
type: Answer

http://stackoverflow.com/q/25827824
type: Question
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/25832057
has title: Intellij + Gradle: properties file
answer count: 2
accepted answer: http://stackoverflow.com/a/25832057
downvote count: 0
score: 1
favorite count: 0
possible better answer: http://stackoverflow.com/a/25832337
has body: My configuration: Gradle installed via Homebrew (Mac OS), Intellij Idea 13. Preferences: "Use default Gradle wrapper" and gradle home: /Users/my_username/.gradle For the following project: / build.gradle gradle.properties The gradle.properties file contains a variable NAME = PJ. I also have a gradle.properties under /Users/my_username/.gradle/gradle.properties having a variable TEST=Hello. For the given task, gradle prints Hello and null task hello &lt;&lt; { println TEST println NAME } Which means that it does not read by default the gradle.properties in the same directory. Is it a normal behavior or do I miss something in path variable so can the build.gradle script can read it? A work-around I found is to add: file("gradle.properties").withInputStream { stream -&gt; new Properties().load(stream) } When I used android studio the .properties file of the same dir was automatically imported. PS: Although TEST var gets printed I get a warning for Cannot resolve symbol. I saw around and this is typical error (?).
has answer: http://stackoverflow.com/a/25832337
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: gradle

http://stackoverflow.com/a/25800838
has comment: http://stackoverflow.com/comment/40358204
has comment: http://stackoverflow.com/comment/40381132
has comment: http://stackoverflow.com/comment/40375503
has comment: http://stackoverflow.com/comment/40372921
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/25800713
has comment: http://stackoverflow.com/comment/40358357
has body: You are doing a HTTP/1.1 requests, which has an implicit keep-alive. That means, that the server will not necessary close the connection once the full response is sent, but instead will keep it open for a while in the hope that it will get more requests and thus can save the overhead of another TCP connection setup. While this helps with performance in the normal case of a browser, it does not help in your case. I would recommend to use HTTP/1.0 instead of HTTP/1.1, so that you don't have to deal with keep-alive or other HTTP/1.1 features like chunked encoding. Apart from that it is recommended to use existing HTTP libraries which deal with all these problems already.
has comment: http://stackoverflow.com/comment/40357546
has comment: http://stackoverflow.com/comment/40375595
has comment: http://stackoverflow.com/comment/40380050
upvote count: 2
has comment: http://stackoverflow.com/comment/40357372

http://stackoverflow.com/comment/40392430
type: AnswerComment
type: Comment
has text: Ok, also is there a way to use if(randomVar = (int)) {} or something like that? That would be the most useful.
comment on: http://stackoverflow.com/a/25820057
score: 0

http://stackoverflow.com/a/25751765
upvote count: 8
accepted answer of: http://stackoverflow.com/q/25751709
type: Answer
answers question: http://stackoverflow.com/q/25751709
score: 8
type: AcceptedAnswer
has body: Section 14.20.2 of the JLS states: If execution of the try block completes abruptly because of a throw of a value V, ... ... If the finally block completes abruptly for reason S, then the try statement completes abruptly for reason S (and the throw of value V is discarded and forgotten). Java must discard the original exception V ("complete abruptly") and the whole try-finally block "completes abruptly" with S (the finally Exception, "B"). There is no way to retrieve the original try block exception "A", which corresponds to V in the JLS.
downvote count: 0

http://stackoverflow.com/a/25773852
downvote count: 3
score: -2
has body: I won't give you the code, just the approach. One approach is to print the number into a string then use regular expression on that string. Get the portion of the string after the decimal place and count the numbers until you get to a 0. There are corner cases but you can take care of that. One thing though, some numbers cannot be represented exactly, such as 4/3, so the number of the decimal places theoretically is infinite. But if you print to a string, you're capping the number of decimal places which makes it easy to count. Just know that if you cap at N decimal places and your counter returns N there's a little doubt whether it's exactly N decimal places or infinite. If you have trouble implementing this approach show me what you've got and where you're stuck and I can help you further.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25773721

http://stackoverflow.com/comment/40483887
type: Comment
score: 2
comment on: http://stackoverflow.com/q/25870733
type: QuestionComment
has text: All the same reasons: particularly, no guarantee when it'll be called. Generally, it's usual practice to manually manage native objects, and `try`-with-resources makes it much easier for some uses.

http://stackoverflow.com/comment/40460988
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25854916
has text: umm, keep in mind that i have no back-reference to `Organization` under `Address` so it is uni-directional. I added an `addAddress` method, and the problem still occurs. Also I'm using a `joinTable`, not a `joinColumn`.

http://stackoverflow.com/comment/40454180
type: AnswerComment
type: Comment
has text: They are the top-left and bottom-right corners of the rectangle. I suggest you also read the documentation [here](http://docs.opencv.org/java/). It's a little spotty for Java, but it can help you get a better handle on things.
comment on: http://stackoverflow.com/a/25853940
score: 0

exception
tags question: http://stackoverflow.com/q/25719588
tags question: http://stackoverflow.com/q/25819082
tags question: http://stackoverflow.com/q/25777474
tags question: http://stackoverflow.com/q/25743279
tags question: http://stackoverflow.com/q/25862516
tags question: http://stackoverflow.com/q/25751581
tags question: http://stackoverflow.com/q/25858545
tags question: http://stackoverflow.com/q/25751434
tags question: http://stackoverflow.com/q/25833459
tags question: http://stackoverflow.com/q/25776131
tags question: http://stackoverflow.com/q/25761221
tags question: http://stackoverflow.com/q/25751709
tags question: http://stackoverflow.com/q/25769152
tags question: http://stackoverflow.com/q/25834888
tags question: http://stackoverflow.com/q/25749161
tags question: http://stackoverflow.com/q/25763142
tags question: http://stackoverflow.com/q/25862193
tags question: http://stackoverflow.com/q/25829959
tags question: http://stackoverflow.com/q/25869705
tags question: http://stackoverflow.com/q/25790992
tags question: http://stackoverflow.com/q/25742913
type: Tag
tags question: http://stackoverflow.com/q/25830620
tags question: http://stackoverflow.com/q/25784845
tags question: http://stackoverflow.com/q/25848731
tags question: http://stackoverflow.com/q/25783758
tags question: http://stackoverflow.com/q/25715151
tags question: http://stackoverflow.com/q/25862989
tags question: http://stackoverflow.com/q/25741463
tags question: http://stackoverflow.com/q/25791406
tags question: http://stackoverflow.com/q/25771438
tags question: http://stackoverflow.com/q/25743574
tags question: http://stackoverflow.com/q/25771873
tags question: http://stackoverflow.com/q/25762222
tags question: http://stackoverflow.com/q/25800804
tags question: http://stackoverflow.com/q/25735922
tags question: http://stackoverflow.com/q/25730032
tags question: http://stackoverflow.com/q/25814729
tags question: http://stackoverflow.com/q/25717604
tags question: http://stackoverflow.com/q/25727152
tags question: http://stackoverflow.com/q/25831411
tags question: http://stackoverflow.com/q/25822958
tags question: http://stackoverflow.com/q/25822720
tags question: http://stackoverflow.com/q/25869285
tags question: http://stackoverflow.com/q/25847343
tag name: exception
tags question: http://stackoverflow.com/q/25796964
tags question: http://stackoverflow.com/q/25770529
tags question: http://stackoverflow.com/q/25778431
tags question: http://stackoverflow.com/q/25834156
tags question: http://stackoverflow.com/q/25803479
tags question: http://stackoverflow.com/q/25789036
tags question: http://stackoverflow.com/q/25840461
tags question: http://stackoverflow.com/q/25836192
tags question: http://stackoverflow.com/q/25736794

http://stackoverflow.com/q/25820793
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25820947
answer count: 2
has body: I'm writing my first program in Java with an object-oriented approach. So far I've been learning to program in Java with a sequential approach, but the switch to object-oriented has given me a few problems. Firstly, my program is a simple program that makes a virtual dog perform some tricks. I have a dog class and a dogDriver class. In my dogDriver class I have the following code fragment: System.out.println("\nWhat trick shall Sparky do?"); System.out.println("Roll Over"); System.out.println("Jump"); System.out.println("Sit"); System.out.println("Bark"); System.out.print("\nYour command: "); String command = keyboard.nextLine(); Yet in my dog class I wish to retrieve the inputted command in a method and perform the calculations in there, for instance: public String getResponse() { if (command.equalsIgnoreCase("Roll Over")) { // Roll Over Code response = "I just Rolled Over!"; } // rest of the commands return response; } I believe an easy option is to make the variable 'command' public in the driver class and use: if (dog.command.equalsIgnoreCase("Roll Over")) // rest of code But I hear it's not advisable to make your variables public. From what I've gathered I can return a variable's value to the driver class with 'return 'variable', but how can I return a variables value to a class (i.e. dog) from the driver class?
tagged with: variables
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/25820947
has title: Using a variable from the driver class in another class' method (java)
possible better answer: http://stackoverflow.com/a/25820832
has answer: http://stackoverflow.com/a/25820832
tagged with: return

http://stackoverflow.com/comment/72376858
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25728855
has text: Try referencing `com.mysql.jdbc.Driver` in Java code (not in string literal) for any valid syntax that doesn't affect performance, e.g. a simple line `com.mysql.jdbc.Driver.class.getName();` which is a meaningless call to a getter that does nothing. This will be shaded by the shade plugin and cause autoloaders to autoload the class.
type: Comment

http://stackoverflow.com/comment/40375650
score: 0
type: Comment
type: QuestionComment
has text: Thanks injecto...I have added.it was a big line that's why edited the same.
comment on: http://stackoverflow.com/q/25805236

http://stackoverflow.com/q/25720414
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40282930
has title: How to handle the Clients for Peer to Peer Connection at Server Side in Java
type: Question
has body: I am working on project which require peer to peer connection between multiple clients. Clients are Window and Android Applications. So far I am able to connect the Window and Android Application to the Server which accept the connection on two port one for Window and One for the Android. In this Project we require to send some file and other resources from window to android, when the android client request. I want to know whether it is a good practice to accept the connection from window on start-up and store the socket resources in Vector with Window Client Id, And when Android send the request for a particular window client then use that socket resource and connect window to android client, Or store the window IP and Port in Database, Create the connection to window when request came from Android. Which approach is better and how to achieve that. There may be 10L connection at the same time. I am developing all the three application(Android,Web and Window) in Java.
has comment: http://stackoverflow.com/comment/40218044
has comment: http://stackoverflow.com/comment/40214830
has comment: http://stackoverflow.com/comment/40277630
score: 0
has comment: http://stackoverflow.com/comment/40219614
type: UnansweredQuestion
tagged with: sockets
tagged with: android

http://stackoverflow.com/q/25804122
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25809414
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: configuration
has title: How to configure embedded Jetty to pick up web fragments?
has body: My Java app uses embedded Jetty 9.2.2. I added a library to pom.xml containg web_fragment.xml file. But the fragment is not picked up by Jetty. When I start the application I can see in logs that the library is loaded. However when a request is made to a servlet from the library, the app returns 404. How to make it to work? In the app there is a Spring configuration file dispatcher-servlet.xml and the library is included there: <import resource="classpath:/web.fragment.lib.spring.xml" /> There is no web.xml file, but the app contains spring.xml file with mappings. It uses the dispatcher-servlet.xml file: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd" default-lazy-init="false"> <context:annotation-config/> <context:property-placeholder system-properties-mode="FALLBACK" location="classpath:config.properties"/> <constructor-arg ref="WebServer"/> <entry key="contextConfigLocation" value="**classpath:dispatcher-servlet.xml**"/> / </beans>
upvote count: 1
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
accepted answer: http://stackoverflow.com/a/25809414
tagged with: jetty
tagged with: spring

http://stackoverflow.com/comment/40218212
type: QuestionComment
comment on: http://stackoverflow.com/q/25725497
has text: And what did you use as your input? Not a double?
type: Comment
score: 0

http://stackoverflow.com/comment/129691284
comment on: http://stackoverflow.com/a/25977404
type: Comment
has text: Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT instead
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40339579
type: Comment
type: QuestionComment
has text: @Luiggi Mendoza Yes it is :) I just tried it on Eclipse and got *Ã±*
comment on: http://stackoverflow.com/q/25791465
score: 0

http://stackoverflow.com/q/25801924
has title: Error shows : The method getLayoutParams() in the type View is not applicable for the arguments (Vector2di, Rect, boolean, boolean)
type: Question
downvote count: 0
favorite count: 0
tagged with: android
answer count: 0
type: UnansweredQuestion
has body: The method getLayoutParams() showing Error and asks for Quick fix available error shows Remove arguments to match getLayoutParams(). This is link for Full cade : https://code.google.com/p/idp-tum/source/browse/trunk/src/com/metaio/Example/MetaioSDKViewActivity.java?spec=svn7&amp;r=7, Please anyone help me. Problem has In this line : FrameLayout.LayoutParams params = mSurfaceView.getLayoutParams(mCameraResolution, getWindowSize(), true, portrait); // Below code has problem private void updateLayout(long delay) { try { mSurfaceView.queueEv`enter code here`ent(new Runnable() { @Override public void run() { setScreenRotation(); }; }); mSurfaceView.postDelayed(new Runnable() { @Override public void run() { final boolean portrait = (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT); MetaioDebug.log("Portrait: "+portrait); FrameLayout.LayoutParams params = mSurfaceView.getLayoutParams(mCameraResolution, getWindowSize(), true, portrait); mSurfaceView.setLayoutParams(params); } }, delay); } catch (Exception e) { } }
upvote count: 1
score: 1
tagged with: java

http://stackoverflow.com/comment/40334500
score: 0
has text: I did some experimentation. I changed getPercentInstance to getNumberInstance on the first line and it works but has no percent sign.
comment on: http://stackoverflow.com/q/25789001
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40413798
has text: And besides, it is not (6*8)! ?
comment on: http://stackoverflow.com/q/25831939
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/25841068
type: AcceptedAnswer
type: Answer
has body: When you call a1.k() you dynamically dispatch to the k method that is defined by the actual object whose reference is in a1. In this case, it is a C not an A or a B, and hence the k method is the override defined in C. The static type (of a1 for example) is used for static resolution; e.g. resolving static methods, overload signatures, and fields. But for instance method invocation, the ultimate selection of the method to be invoked is dynamic. I know the k() in class C should be called, instead of the k() in class A. But why this.x returns 100? I thought the instance variable is bounded to the static type. Well it is. But it is the static type that determines which x is used by this.x in the k() call is the static type of this in the C.k method body!
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25840826
has comment: http://stackoverflow.com/comment/40430633
answers question: http://stackoverflow.com/q/25840826
has comment: http://stackoverflow.com/comment/40430656
upvote count: 1

http://stackoverflow.com/comment/40463403
has text: If that's your code, it's sleeping in the main thread, meaning the entire app stops. (Except, of course, the method never gets called.)
comment on: http://stackoverflow.com/q/25859081
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/25811839
downvote count: 0
type: Answer
upvote count: 1
has body: SimpleDateFormat format = new SimpleDateFormat("yyyy-mm-dd"); should be like SimpleDateFormat format = new SimpleDateFormat("dd/MM/yyyy",Locale.ENGLISH); Try to use Locale for safety Again Date fdate = format.parse(fDateStr); gives you java.util.Date you need to convert it o java.sql.Date to set it to PreparedStatement like this public static Date convertUtilDateToSqlDate(java.util.Date date){ if(date != null) { Date sqlDate = new Date(date.getTime()); return sqlDate; } return null; } Then prSelect.setDate(1, convertUtilDateToSqlDate(fdte)); prSelect.setDate(2, convertUtilDateToSqlDate(tdate));
has comment: http://stackoverflow.com/comment/40376290
score: 1
answers question: http://stackoverflow.com/q/25811059
accepted answer of: http://stackoverflow.com/q/25811059
has comment: http://stackoverflow.com/comment/40379131
has comment: http://stackoverflow.com/comment/40377782
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40377710
has comment: http://stackoverflow.com/comment/40376409

mapreduce
tags question: http://stackoverflow.com/q/25777805
type: Tag
tags question: http://stackoverflow.com/q/25753572
tags question: http://stackoverflow.com/q/25832596
tags question: http://stackoverflow.com/q/25744036
tags question: http://stackoverflow.com/q/25778996
tags question: http://stackoverflow.com/q/25731303
tag name: mapreduce
tags question: http://stackoverflow.com/q/25760810
tags question: http://stackoverflow.com/q/25722958
tags question: http://stackoverflow.com/q/25827950
tags question: http://stackoverflow.com/q/25843137
tags question: http://stackoverflow.com/q/25749894
tags question: http://stackoverflow.com/q/25836192
tags question: http://stackoverflow.com/q/25792398
tags question: http://stackoverflow.com/q/25861926
tags question: http://stackoverflow.com/q/25731506
tags question: http://stackoverflow.com/q/25723526
tags question: http://stackoverflow.com/q/25824245

http://stackoverflow.com/comment/40339977
type: Comment
has text: Even if I use your solution or `LIST_TITLE.equals("String")` it doesn't work. More details: I use this in an `AsyncTask (doInBackground)`. I fetch titles from a website and save them in a `List list_title`. Now I try to compare this list_title with some strings to set an icon. In this AsyncTask I have no context, so I used your solution without context. `LIST_TITLE.equals(getResources().getString(R.string.percentbattery))` Could this be the mistake? Thanks
comment on: http://stackoverflow.com/a/25791564
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40354181
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25797974
has text: This isn't coming out any faster. Also, I now am unable to sort the array, although I imagine there is a swift workaround for this.
type: AnswerComment

http://stackoverflow.com/q/25819159
has answer: http://stackoverflow.com/a/25845439
downvote count: 0
type: UnansweredQuestion
tagged with: network-programming
score: 1
tagged with: java
type: Question
has title: HtmlUnit submitting a form?
tagged with: htmlunit
answer count: 1
has body: I am trying to submit the form on the website: http://pfam.xfam.org/search using java and HtmlUnit but I can't get it to work. I think the problem is that the "Submit" button is not really a button but some form of other input. I am not too familiar with all the Html elements and I just got started with HtmlUnit. Any help would be highly appreciated. Below is my code so far, which enter a sequence to the form: import com.gargoylesoftware.htmlunit.*; import com.gargoylesoftware.htmlunit.html.*; public class ProteinSearch { static String protein = "MAGAASPCANGCGPSAPSDAEVVHLCRSLEVGTVMTLFYSKKSQRPERKTFQVKLETRQITWSRGADKIEGAIDIREIKEIRPGKTSRDFDRYQEDPAFRPDQSHCFVILYGMEFRLKTLSLQATSEDEVNMWIRGLTWLMEDTLQAATPLQIERWLRKQFYSVDRNREDRISAKDLKNMLSQVNYRVPNMRFLRERLTDLEQRTSDITYGQFAQLYRSLMYSAQKTMDLPFLEASALRAGERPELCRVSLPEFQQFLLEYQGELWAVDRLQVQEFMLSFLRDPLREIEEPYFFLDEFVT"; public static void main(String[] args) { WebClient client = new WebClient(); try { HtmlPage currentPage = (HtmlPage)client.getPage("http://pfam.xfam.org/search"); HtmlForm form = (HtmlForm) currentPage.getElementById("proteinSeqSearchForm"); HtmlTextArea searchBox = form.getTextAreaByName("seq"); searchBox.setTextContent(protein); //currentPage = form.getAcceptAttribute(); System.out.println(form.getId()); } catch(Exception ex) { System.out.println("Some form of error happened !"); } } }
favorite count: 0
upvote count: 1

http://stackoverflow.com/q/25856684
type: Question
has title: How to display part's name instead of input file name when Eclipse is closed?
tagged with: eclipse
score: 0
answer count: 1
has body: When Eclipse is closed and there are editor's with unsaved content, Eclipse will show a save dialog which lists all unsaved editors. Am I right in assuming that the editor's input file name is displayed here? I now have two different types of editors that have the same input file. This means when I close Eclipse, there are two equal entries in the save dialog for two different editors. Can I get Eclipse to display the part's name instead (which I set by calling setPartName("some name"))?
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/40467474
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25863055
accepted answer: http://stackoverflow.com/a/25863055

http://stackoverflow.com/q/25807179
type: Question
has comment: http://stackoverflow.com/comment/40367728
tagged with: location
answer count: 1
accepted answer: http://stackoverflow.com/a/25807461
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/25807461
has body: Can anyone tell me what's wrong with this? It's giving me an error on ;}} I added and removed {} and () but it didn't work. I took this code from stackoverflow but it didn't work package com.f.da; import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; public class PageSeven extends Activity { Button da; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.oulo); addListenerOnButton(); } public void addListenerOnButton() { da = (Button) findViewById(R.id.da);; da.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { String CURRENT_LOCATION = "37.980442, 23.727892"; String DESTINATION_LOCATION = "DA"; Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("http://maps.google.com/maps?saddr="+ CURRENT_LOCATION +" daddr="+DESTINATION_LOCATION)); startActivity(intent); } }}; } }
has title: It gives me an error at GPS
tagged with: gps
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40367821
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/25870850
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: Value is passed as command line arguments. For ex, you have this program(Cmd.java): public class Cmd { public static void main(String agrs[]) { System.out.println("Values are:"+args[0]+" and "+args[1]); args[0]="New1"; args[1]="New2"; System.out.println("Modified values are:"+args[0]+" and "+args[1]); } } Compile it like: javac Cmd.java Execute it like: java Cmd Value1 Value2 Output will be: Values are Vaue1 and Value2 Modified values are New1 and New1 Hope you got the point! BONUS: If you don't pass any values during execution the program will throw an ArrayIndexOutOfBoundsException. You may want to handle that! Read more about Command Line arguments at The Java tutorials (Oracle docs)!
has comment: http://stackoverflow.com/comment/40504925
answers question: http://stackoverflow.com/q/25870635

http://stackoverflow.com/comment/40321213
type: AnswerComment
has text: just out of curiosity, *why would anyone put long-term* operations in *static* blocks?.
comment on: http://stackoverflow.com/a/25781442
type: Comment
score: 1

http://stackoverflow.com/comment/136586699
has text: This didn't work for me, but [this solution](https://stackoverflow.com/a/70891659/) did.
type: Comment
comment on: http://stackoverflow.com/a/74208102
score: 1
type: AnswerComment

http://stackoverflow.com/a/25813646
score: 0
type: Answer
has body: You are computing the result twice (first time with stop). How would you do if you wanted to compute n^1000 ? There's much simpler : int pow = 10; int n = 3; int res = 1; for (int i=0 ; i&lt;pow ; i++) res *= n; It may be a bit advanced for a beginner, but you might be interested to know that there are much faster ways to compute a^b. Take a look at fast exponentiation.
answers question: http://stackoverflow.com/q/25813564

http://stackoverflow.com/comment/40417230
has text: 1500 files, each (let's say 100 lines of 80 characters). 2 bytes per characters. That makes 1500 * 100 * 80 * 2 = 24,000,000 bytes, or 24 MBs, which is tiny. Why not read all the lines into a list in memory? You could even use two `Map<Character, List<String>>` to index all the lines by the first character of their frst and second word. Of course, if your program ends after a single query, that's not needed.
type: QuestionComment
comment on: http://stackoverflow.com/q/25834008
type: Comment
score: 1

http://stackoverflow.com/q/25800150
downvote count: 0
favorite count: 0
answer count: 1
has answer: http://stackoverflow.com/a/25800234
score: 4
has title: Search Algorithm error regarding first index value
has body: Hi I am taking a look at this post in the link below regarding this search algorithm and when I tried to run it, everything works correctly by printing out the index value of the number(l) you are searching for but if the number(l) you are searching for is the first element in the array then it just prints -1 instead of 0.What correction needs to be made in this program? Lets say int l = 3, then it should print 0. The code below is from this post jump search algorithm with the correction as stated by Alex Winston. I followed along exactly what this wiki article http://en.wikipedia.org/wiki/Jump_search posted regarding this algorithm's implementation import java.math.*; public class jamp { public static int min(int a,int b) { return a&lt;b?a:b; } public static void main(String[]args) { int a[]=new int[]{3,7,9,12,14,15,16,17,18}; int l=14; //lets say int l = 3; System.out.println(jumpsearch(a,a.length,l)); } public static int jumpsearch(int a[],int n, int l ) { int t=0; int b=(int)Math.sqrt(n); while (a[min(b,n)-1]&lt;l){ t=b; b=b+(int)Math.sqrt(n); if ( t&gt;=n) return -1 ; } while (a[t]&lt;l){ t=t+1; if ( t==min(b,n)) return -1 ; if ( a[t]==l) { return t; } } return -1; // if this is 0, then it works but if you search for a element that is not in the array then it still prints 0 which is incorrect } }
type: AnsweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/2882362
accepted answer: http://stackoverflow.com/a/25800234
type: Question
upvote count: 4

http://stackoverflow.com/q/25813654
type: Question
has comment: http://stackoverflow.com/comment/40385255
has body: I'm trying to find a reference, ideally from the language standard, as to why casting a container of T to a super-type of the container and a super-type of T does not work, when done in the same statement. I've tried looking up various combinations of erasure, casting generics, and specific container classes, but can't find an exact duplicate (most only address T and its superclass). I'm particularly interested in what the language standard has to say on the issue and the terminology used for it. For example, the following is not accepted by the compiler: final WebappContext context = ...; final List&lt;FilterRegistration&gt; filters = Lists.newArrayList( context.addFilter(...), ... ); Where WebappContext.addFilter returns a org.glassfish.grizzly.servlet.FilterRegistration, which implements javax.servlet.FilterRegistration.Dynamic, which extends FilterRegistration. The call to Lists.newArrayList returns an ArrayList&lt;T&gt;, depending on the type of its arguments. I get an error like: Incompatible Types Required: List&lt;javax.servlet.FilterRegistration&gt; Found: ArrrayList&lt;org.glassfish.grizzly.servlet.FilterRegistration&gt; This is despite List being a superclass of ArrayList, and FilterRegistration being a superclass of the Grizzly implementation. If I change it to: final WebappContext context = ...; final List&lt;FilterRegistration&gt; filters = Lists.&lt;FilterRegistration&gt;newArrayList( context.addFilter(...), ... ); Then everything is perfectly happy, not even an unchecked warning. The only change I can find is the return type goes from ArrrayList&lt;org.glassfish.grizzly.servlet.FilterRegistration&gt; to ArrrayList&lt;javax.servlet.FilterRegistration&gt;. I know C++ has a rule that the compiler may only perform a single cast while trying to resolve the best type for a particular call. This seems to behave in the same manner, but what does Java call it and how are the rules defined? Is it related to type erasure, and how so?
has comment: http://stackoverflow.com/comment/40381374
tagged with: language-lawyer
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40396386
tagged with: generics
has comment: http://stackoverflow.com/comment/40380051
favorite count: 0
upvote count: 2
linked to: http://stackoverflow.com/q/2745265
has comment: http://stackoverflow.com/comment/40380150
downvote count: 2
possible better answer: http://stackoverflow.com/a/25816768
has answer: http://stackoverflow.com/a/25816768
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25817431
has title: Casting Generic<T> to SuperGeneric<SuperT>
tagged with: java
has comment: http://stackoverflow.com/comment/40380399
has comment: http://stackoverflow.com/comment/40380056
accepted answer: http://stackoverflow.com/a/25817431

http://stackoverflow.com/q/25760215
tagged with: playframework
score: 2
answer count: 1
linked to: http://stackoverflow.com/q/20576937
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/51422415
type: UnansweredQuestion
has title: Handling fieldsets in Play! Framework 2.3 (Java)
has answer: http://stackoverflow.com/a/25761808
tagged with: playframework-2.0
upvote count: 2
has body: I'm trying to figure out how Play! handles forms where multiple fields with the same name are used. For example, take a look at this form snippet: Select product... @for(product<-Product.findAll()) { @product.name } Member price Public price Add line... I'm using the bracket notation because the user can add as many orderlines as he would like by clicking the "Add line..." button. When clicking on the button, a JavaScript function clones the and appends it just below. So basically, the submitted form contains several orderlines. Now what I want to do is to collect all of the data in my controller, but I couldn't figure out how to do it. Some people suggested me to do something like this in the controller: public static Result createOrder(String[] quantity, String[] productId, String[] price) { for(int i=0; i<quantity.length; i++){ ... } for(int i=0; i<productId.length; i++){ ... } for(int i=0; i<price.length; i++){ ... } } But the problem with this is that it requires me to implement a custom implicit QueryStringBindable for the type Array[String]. Isn't that too much for such a basic feature? So my question is how can I handle a form with a variable number of parameters that have the same name? Like, how would you implement a shopping cart where you create several orderlines(in a completely random order), and then submit them to create an order? PS : I already tried to have different names (like [productId0, quantity0, price0] for the first line, then [productId1, quantity1, price1] and so on...) for each input, using JavaScript, but it ended up being too complex to keep the index accurate...
tagged with: java
tagged with: forms
type: Question
linked to: http://stackoverflow.com/q/10218814

http://stackoverflow.com/comment/40402485
has text: I never gave a loop a thought, I was over thinking this entire thing thinking I would have to subtract the years then figure out the inbetween.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25825952

http://stackoverflow.com/q/25821741
tagged with: android
has body: I am new to Andoid development and I have created a snippet for replacing fragments programetically. I followed the guide on android developers. I have create a method named selectFrag and fired it on button click: public void selectFrag(View view) { Fragment fr; if(view == findViewById(R.id.showsecond)) { fr = new secondfragment(); } else { fr = new firstfragment(); } FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.fragment_place,fr); ft.addToBackStack(null); ft.commit(); } Code works perfectly and I understand everything except addToBackStack(null). I experimented and understood that this method is for adding the fragment to the back button's stack, so that if we click back button, it do not leave the screen and show the previous work. But, I do not understand what null shows here. I searched on web but I only knew that it is a TAG and we could use something like this. So, my question is very simple :What is meant by null here? or What does null do? (sorry for my bad English.)
upvote count: 12
downvote count: 0
has title: What is the purpose of null in addToBackStack(null)?
has answer: http://stackoverflow.com/a/42422280
type: AnsweredQuestion
tagged with: android-layout
tagged with: android-fragments
possible better answer: http://stackoverflow.com/a/49520764
tagged with: java
has answer: http://stackoverflow.com/a/49520764
has comment: http://stackoverflow.com/comment/40395077
score: 12
type: Question
linked to: http://stackoverflow.com/q/14518086
favorite count: 0
has answer: http://stackoverflow.com/a/25821838
accepted answer: http://stackoverflow.com/a/25821838
answer count: 3

http://stackoverflow.com/q/25836227
has answer: http://stackoverflow.com/a/25836266
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25836255
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25836255
has body: I have two programs. I create a static array and some methods such as the following: public Someclass{ static int counter[] = new int[n]; //methods &amp; main } the n is defined to be some number, so I know it will have some length. I later fill this array and I test to see that it gets filled correctly, so I know some indexes should have values other than 0. Now when I try to call it in second program, it is though I never filled it because it only gives me 0's. //second program public Someclass2{ public static main(String[] args){ String n = "someword" int[] nums = new int[n.length] for( int i = 0; i &lt; n.length; i++){ nums[i] = nums[i] + (25 * SomeClass.counter[i]); } } } For some reason, when I call the array in the second program it returns all zeros and doesnt change the value of nums, even though I know the counter array should have non-zero values. I think it has to do with the fact that I initialize it statically but I filled it in a local method and in the class. So techincally it never gets it's zeroes updated. I am having trouble trying to fix this and if anyone could help I would aprreciate it. Thank you
has comment: http://stackoverflow.com/comment/40421380
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/25836266
tagged with: arrays
has title: calling static array from another class
has answer: http://stackoverflow.com/a/25836281
tagged with: class
has answer: http://stackoverflow.com/a/25836269
downvote count: 0
tagged with: global
favorite count: 0
tagged with: static
has comment: http://stackoverflow.com/comment/40421387

http://stackoverflow.com/q/25862198
upvote count: 3
type: UnansweredQuestion
tagged with: multithreading
type: Question
score: 3
has body: Writing in Java I call zip() method that receives a few method that return an Observable&lt;...>. Currently I am not able to progress to the following map and this is probably due to the fact that one of the methods didn't return a value yet. (Though it seems all methods where called.) Is there a way to debug the process and see why it is stuck? Thanks.
tagged with: java
has answer: http://stackoverflow.com/a/25874231
tagged with: java-7
answer count: 1
downvote count: 0
favorite count: 0
has title: Debugging RxJava zip operator that halts
tagged with: rx-java

http://stackoverflow.com/a/25927259
has comment: http://stackoverflow.com/comment/107563752
has comment: http://stackoverflow.com/comment/40661138
has comment: http://stackoverflow.com/comment/40587277
has body: I had similar problem last month and someone helped me out with an optional example. I'd like to suggest you the same public boolean isServerReachable() // To check if server is reachable { try { InetAddress.getByName("google.com").isReachable(3000); //Replace with your name return true; } catch (Exception e) { return false; } } if return true than your url server is available else is not available currently.
score: 0
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40624147
has comment: http://stackoverflow.com/comment/107506593
type: Answer
answers question: http://stackoverflow.com/q/25805580

http://stackoverflow.com/a/50773836
answers question: http://stackoverflow.com/q/25718066
type: Answer
downvote count: 1
has body: I also faxed this issue. I resolved by go to your eclipse workspace folder->.metadata ->org.eclipse.debug.core inside this folder there will be .launches folder delete this folder. I am sure this will resolve you problem.
upvote count: 0
score: -1

http://stackoverflow.com/q/25829341
has comment: http://stackoverflow.com/comment/40408745
has comment: http://stackoverflow.com/comment/40408746
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3184883
accepted answer: http://stackoverflow.com/a/25829374
tagged with: java
duplicate of: http://stackoverflow.com/q/3184883
type: Question
score: 0
has comment: http://stackoverflow.com/comment/40408755
answer count: 1
has answer: http://stackoverflow.com/a/25829374
has title: ConcurrentModificationException in thread "AWT-EventQueue-0"?
has body: I am trying to make a text adventure in java gui. I have just started this project and I am trying to get the game to realize when a player types "get" + the item. I want it to take the item out of the current ArrayList it is in and add it to the inventory screen I have made. Currently everything works correctly except for when I type a different command like "look". All it should show then is the room description, but it hows the description and picks up the item and puts it in the inventory screen. Then I get this error. Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) at java.util.ArrayList$Itr.next(ArrayList.java:851) at Gamegui.processCommands(Gamegui.java:327) at Gamegui.playerInputKeyPressed(Gamegui.java:359) at Gamegui.access$200(Gamegui.java:14) at Gamegui$3.keyPressed(Gamegui.java:171) at java.awt.Component.processKeyEvent(Component.java:6483) at javax.swing.JComponent.processKeyEvent(JComponent.java:2829) at java.awt.Component.processEvent(Component.java:6302) at java.awt.Container.processEvent(Container.java:2234) at java.awt.Component.dispatchEventImpl(Component.java:4881) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Component.dispatchEvent(Component.java:4703) at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954) at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:806) at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1074) at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:945) at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:771) at java.awt.Component.dispatchEventImpl(Component.java:4752) at java.awt.Container.dispatchEventImpl(Container.java:2292) at java.awt.Window.dispatchEventImpl(Window.java:2739) at java.awt.Component.dispatchEvent…

http://stackoverflow.com/comment/40522817
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25820929
has text: I have startedreading the documentation, thanks for that. Yet most of the issue to go in this file seem the same as those in the manifest, and in fact they are saying the manifest is automatically generated. Does it mean all the things that were going into the manifest are to go to the buld.gradle file now?

http://stackoverflow.com/a/25742631
upvote count: 1
answers question: http://stackoverflow.com/q/25741671
accepted answer of: http://stackoverflow.com/q/25741671
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: This might help you a bit. LinearLayout layout = new LinearLayout(this); layout.setOrientation(LinearLayout.VERTICAL); int adlayout = 12345; //if you need id of layout somewhere else //View.generateViewId();Can be used if minSDK= 17 layout.setId(adlayout); android.view.ViewGroup.LayoutParams params = layout.getLayoutParams(); params.height = 48; params.width = LayoutParams.MATCH_PARENT; //Below code is used if you need height in dp. //int height = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, &lt;HEIGHT&gt;, getResources().getDisplayMetrics()); ir.adad.AdView adView = new ir.adad.AdView(this); int adViewId = 123456;//Should not be dublicate. adView.setId(adViewId); android.view.ViewGroup.LayoutParams paramView = adView.getLayoutParams(); paramView.height = LayoutParams.WRAP_CONTENT; paramView.width = LayoutParams.WRAP_CONTENT; layout.addView(adView)
score: 1

datetime
tags question: http://stackoverflow.com/q/25720263
tags question: http://stackoverflow.com/q/25747499
tags question: http://stackoverflow.com/q/25736410
tags question: http://stackoverflow.com/q/25781657
tag name: datetime
tags question: http://stackoverflow.com/q/25780270
tags question: http://stackoverflow.com/q/25729113
type: Tag
tags question: http://stackoverflow.com/q/25816919
tags question: http://stackoverflow.com/q/25813940
tags question: http://stackoverflow.com/q/25735583
tags question: http://stackoverflow.com/q/25861804

http://stackoverflow.com/comment/40347317
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25795568
has text: I don't know what you mean by 'error in input'. Each call to readline will return all the bytes up to but not including a newline/carriage return. The only time you would get an exception is if the bytes found don't parse correctly given the character set you selected when creating the reader.
type: Comment

http://stackoverflow.com/a/25831717
type: Answer
has body: An excerpt from the docs: Note that links between module sites in a multi module build will not work, since local build directory structure doesn't match deployed site. This means you need to do a staging to check you links and the whole layout etc. This can be achieved by using the stage goal.
answers question: http://stackoverflow.com/q/25830789
score: 0

http://stackoverflow.com/q/25787897
tagged with: android-asynctask
score: 0
has answer: http://stackoverflow.com/a/25787945
answer count: 3
tagged with: web-services
accepted answer: http://stackoverflow.com/a/25788020
tagged with: java
tagged with: tcpclient
has title: NetworkOnMainThreadExeption TCP Connection AsinkTask
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25787935
type: Question
has answer: http://stackoverflow.com/a/25787935
tagged with: android
has answer: http://stackoverflow.com/a/25788020
has body: I have a problem, i'm trying to do a connection to my local tcp server, to upload an image. But i doesn't work and I did made the connection into a asinktask method. Did anybody know where i can come from. public class ComplexFTPTransfer extends AsyncTask&lt;File, Long[], Void&gt; { String server = "192.168.1.145"; int port = 21; @Override protected void onPreExecute() { super.onPreExecute(); try { ftpClient = new FTPClient(); ftpClient.connect(server, port); ftpClient.login("marc", "1234"); ftpClient.enterLocalPassiveMode(); System.out.println("!&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"); } catch (SocketException e) { this.cancel(true); } catch (IOException e) { this.cancel(true); } CameraActivity.this.setProgressBarIndeterminateVisibility(true); } @Override protected Void doInBackground(File... params) { if(!this.isCancelled()) { try { InputStream item = null; try { item = new FileInputStream(params[0]); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } int streamSize = 0; while(item.read() != -1) { streamSize++; } InputStream is = new BufferedInputStream(item, streamSize); OutputStream os = ftpClient.storeFileStream("/test.jpg"); Util.copyStream(is, os, streamSize, streamSize, new CopyStreamListener() { @Override public void bytesTransferred(long totalBytesTransferred, int bytesTransferred, long streamSize) { publishProgress(new Long[] {totalBytesTransferred, streamSize}); } @Override public void bytesTransferred(CopyStreamEvent event) { } }); ftpClient.completePendingCommand(); ftpClient.logout(); ftpClient.disconnect(); } catch (IOException e) { } catch (Exception e) { } } return null; } @Override protected void onProgressUpdate(Long[]... values) { super.onProgressUpdate(values); Log.d("UPDATE", values[0] + " of " + values[1] + " copied."); //TODO Put code here…

http://stackoverflow.com/a/25794018
type: Answer
score: 4
answers question: http://stackoverflow.com/q/25791416
has comment: http://stackoverflow.com/comment/40344520
upvote count: 4
downvote count: 0
has body: I can only get this to work via a pretty massive hack, that isn't even remotely portable. However, maybe it will give you enough to work from to create a viable solution. (This works under Java 8.) I created a package com.sun.javafx.scene.control.skin.resources, and created a controls_fi_FI.properties file in it with the single line ProgressIndicator.doneString=Valmis I created a test app with the following: import java.util.Locale; import java.util.ResourceBundle; import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.control.ProgressIndicator; import javafx.scene.layout.BorderPane; public class Main extends Application { @Override public void start(Stage primaryStage) { System.out.println(ResourceBundle.getBundle("com/sun/javafx/scene/control/skin/resources/controls").getString("ProgressIndicator.doneString")); BorderPane root = new BorderPane(); ProgressIndicator progressIndicator = new ProgressIndicator(1); root.setCenter(progressIndicator); Scene scene = new Scene(root,400,400); primaryStage.setScene(scene); primaryStage.show(); } public static void main(String[] args) { Locale.setDefault(new Locale("fi", "FI")); launch(args); } } Running this app most ways doesn't work as desired: while the System.out.println(...) produces the correct result, the text displayed in the progress indicator is wrong. However, if I bundle com/sun/javafx/control/skin/resources/controls_fi_FI.properties in a jar file, and move that jar file to the jre/lib/ext subdirectory of my JDK installation (ie. the same location as jfxrt.jar), it runs as required (at least in my simple test; as I said, I make no claims for this to be any kind of robust solution). The issue appears to be that ControlsResources is being loaded by the extension class loader, and so is using the same class loader to load the resource bundle. With better knowledge of class loaders than I have, you might be able to mold this into a reasonable solution...

http://stackoverflow.com/a/78677149
has comment: http://stackoverflow.com/comment/138716032
answers question: http://stackoverflow.com/q/25852634
score: 0
type: Answer
has body: It is a concept of Dynamic Method Dispatch

http://stackoverflow.com/comment/40220732
type: QuestionComment
has text: So what's the actual question here? What problem are you trying to solve?
type: Comment
comment on: http://stackoverflow.com/q/25717922
score: 1

android-broadcast
tag name: android-broadcast
tags question: http://stackoverflow.com/q/25716906
type: Tag

http://stackoverflow.com/a/25751859
upvote count: 6
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25751743
answers question: http://stackoverflow.com/q/25751743
score: 6
type: Answer
has body: What is the reason for this? The variables x and y are not arrays. They are array references. An array is an object, and you reassigned x to refer to a different array than y, and only changed x, thus you have different values in the two different arrays. What happens to c2; does it reference the original Counter or the new Counter, why? In your example there was only one Counter object created, when you called new Counter, there's no original, and you made the Counter reference c2 refer to the same instance that c1 refers to, so they are pointing to the same thing. Surely then the current variable is still assigned to the old first Node? Why then does this implementation work? Your for each loop invokes iterator() which returns a new ListIterator which instantiates it's own current which points to the latest value of first in your stack.
has comment: http://stackoverflow.com/comment/67251479
type: AcceptedAnswer

http://stackoverflow.com/comment/40270117
score: 0
type: Comment
has text: Thank you so much! I did all the things you've suggested and now it's finally printed the number of babies.
type: AnswerComment
comment on: http://stackoverflow.com/a/25752933

http://stackoverflow.com/comment/40272420
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25753953
has text: I am not really sure what you mean, but the part inside the onCreate method works, I get errors in the logcat, but it displays this fragment. When I try to call openHome or openRecommended it crashes...

http://stackoverflow.com/q/25777511
type: UnansweredQuestion
downvote count: 1
has body: Say Person is base class. Doctor class extends Person. Now suppose diagnose() is method which belongs to Doctor class. Person p = New Person(); Doctor q = (Doctor)p; q.diagnose(); Why would this throw error? q is object reference of kind Doctor. All objects of class share same copy of methods, so diagnose() should be available to q. There are no fields of methods which would be available to p would not be available in Doctor. Why would java not allow this?
has title: Java : Type of Ref or new () decides which methods are visible
tagged with: java
has comment: http://stackoverflow.com/comment/40314670
score: -1
has answer: http://stackoverflow.com/a/25777536
type: Question
answer count: 2
upvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40314682
has answer: http://stackoverflow.com/a/25777541

http://stackoverflow.com/a/25794487
score: 0
has body: It's useful in lots of ways if Stack implements List: it means that it can be used in places where a List is required. But if you're using it as a stack, then you're obliged to do sensible stack-like operations on it, and that includes not arbitrarily yanking things out from the middle. That doesn't mean it's a bad implementation of a LIFO queue, it just means that you have to be careful to use it in a LIFO fashion. (That said, a strong case could be made for having Stack.remove() throw an OperationNotSupportedException.)
has comment: http://stackoverflow.com/comment/40345541
type: Answer
has comment: http://stackoverflow.com/comment/40345124
has comment: http://stackoverflow.com/comment/40345397
has comment: http://stackoverflow.com/comment/40345015
has comment: http://stackoverflow.com/comment/40345289
has comment: http://stackoverflow.com/comment/40345260
has comment: http://stackoverflow.com/comment/40345450
answers question: http://stackoverflow.com/q/25794417

http://stackoverflow.com/q/25861144
has answer: http://stackoverflow.com/a/43895017
has answer: http://stackoverflow.com/a/25862371
score: 1
tagged with: java
type: Question
has title: cdi does not inject entitymanager
answer count: 2
upvote count: 1
downvote count: 0
has body: cdi don't injects entitymanager, always the nullpointer. Following configuration: persistence.xml <?xml version="1.0" encoding="UTF-8"?> org.hibernate.ejb.HibernatePersistence java:/tutoroo <property name="hibernate.show_sql" value="true" /> <property name="hibernate.format_sql" value="false" /> <property name="hibernate.hbm2ddl.auto" value="create-drop" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /> public class ProdutorEntityManager implements Serializable { private EntityManagerFactory factory = Persistence.createEntityManagerFactory("tutoroo"); //private EntityManager entityManager = factory.createEntityManager(); @Produces @PersistenceContext @RequestScoped public EntityManager criaEntityManager(){ return factory.createEntityManager(); } public void dispose(@Disposes EntityManager em) { em.close(); } } public class UsuarioDaoImp implements UsuarioDao { @Inject private EntityManager manager; public void salvar(Usuario usuario) { manager.persist(usuario); } } When I debug the EntityManager UsuarioDaoImp class, this exception occurs: com.sun.jdi.InvocationException occurred invoking method. I do not know what I'm doing wrong. Can anyone help? Server is: jboss-as-7.1.1
favorite count: 0
tagged with: cdi
type: UnansweredQuestion

http://stackoverflow.com/a/25763769
type: Answer
has comment: http://stackoverflow.com/comment/40289806
has comment: http://stackoverflow.com/comment/129616692
has comment: http://stackoverflow.com/comment/40292477
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
has body: You need to run Exchange exchange = pollingConsumer.receive(); in a loop. For e.g. Exchange ex = pollingConsumer.receive(); while (ex != null) { process(ex); ex = pollingConsumer.receive(); }
accepted answer of: http://stackoverflow.com/q/25763655
answers question: http://stackoverflow.com/q/25763655

http://stackoverflow.com/q/25723565
tagged with: spring
type: UnansweredQuestion
score: 0
tagged with: java
type: Question
tagged with: hibernate
has answer: http://stackoverflow.com/a/25723631
answer count: 2
has answer: http://stackoverflow.com/a/25723646
has body: hi my userupdate profile have the foregin key as user here is my CloudSvrUsersProfile class @Entity @Table(name="CLOUD_SVR_USERS_PROFILE") @NamedQuery(name="CloudSvrUsersProfile.findAll", query="SELECT c FROM CloudSvrUsersProfile c") public class CloudSvrUsersProfile implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue @Column(name="USERS_PROFILE_ID",nullable=false) private long usersProfileId; @Column(name="ADDRESS_1") private String address1; @Column(name="ADDRESS_2") private String address2; @Column(name="ADDRESS_3") private String address3; @Column(name="EMAIL_ID") private String emialId; public String getEmialId() { return emialId; } public void setEmialId(String emialId) { this.emialId = emialId; } @Column(name="CREATED_BY") private BigDecimal createdBy; @Column(name="CREATED_DATE") private Timestamp createdDate; @Column(name="FIRST_NAME") private String firstName; @Column(name="LAST_NAME") private String lastName; @Column(name="STATE") private String state; @Column(name="STATUS") private BigDecimal status; @Column(name="ZIP_CODE") private Long zipCode; @Id @Column(name="USER_ID",nullable=false) @GeneratedValue(generator="gen") @GenericGenerator(name="gen", strategy="foreign", parameters=@Parameter(name="property", value="user")) private Long userId; @ManyToOne @JoinColumn(name="USER_ID",nullable=false) private CloudSvrUser user; /** * @return the usersProfileId */ public long getUsersProfileId() { return usersProfileId; } /** * @param usersProfileId the usersProfileId to set */ public void setUsersProfileId(long usersProfileId) { this.usersProfileId = usersProfileId; } /** * @return the address1 */ public String getAddress1() { return address1; } /** * @param address1 the address1 to set */ public void setAddress1(String address1) { this.address1 = address1; } /** * @return the address2 */ public String getAddress2() { return address2; } /** * @param address2 the address2 to set */ public void setAddress2(String addre…
has title: Unknown mappedBy in: com.omnypay.dao.bo.CloudSvrUser.UserPwdList, referenced property unknown: java.util.List.user

http://stackoverflow.com/q/25729804
tagged with: swingworker
has answer: http://stackoverflow.com/a/25729959
score: 0
has comment: http://stackoverflow.com/comment/40226238
accepted answer: http://stackoverflow.com/a/25731531
answer count: 3
tagged with: user-interface
has body: I am having a rough time getting some of my code to work. The code starts a SwingWorker and gets the results. I am having trouble passing data to the worker and getting information back from the worker. The data I want to pass is made up of objects of classes I defined myself. For example I have both an Item and Inventory object. The Item object contains basically all primitive types (name, price, etc) and the Inventory contains a LinkedList of Items. I can't quite remember the series of events that lead up to my sanity check, but as a sanity check I implemented Item.getDeepCopy(Item inItem) and Inventory.getDeepCopy(Inventory) functions so that I could pass copies of Items and Inventorys to my workers. Is this needed? How I use the deep copy functions is when I pass data to and get data from my StringWorkers. Say I launch a worker as a result of a button click. In the event handler I first get a deep copy of my classes private local copy of Inventory or Item and pass that to the workers constructor. Is this correct? Do I need to pass a deep copy? I think not.. I do this out of fear that the worker will try to modify the classes reference to the object within the worker itself causing some threading issues. But after some reading and critical thinking this couldn't be the case because java is pass-by-value, so what is passed to the worker cannot possibly lead to the GUI components data changing. Is this correct thinking? Then when the worker is done, it calls an overridden done method I wrote. This method runs on the EDT so I can call functions from my GUI component, namely a function I call WorkerDone(boolean result, Inventory outInv). The worker calls this function and passes (not a deep copy) its local copy of Inventory or Item back to the GUI. When the GUI gets it it then performs a deep copy and sets its local Inventory or Item to this value. Is this a good use for the deep copy? Edit: A little more. Basically I want to pass "some data" to the worker and allow …
has comment: http://stackoverflow.com/comment/40226333
has comment: http://stackoverflow.com/comment/40226872
has answer: http://stackoverflow.com/a/25731531
has title: Does Java's pass-by-valueness mean I do not need a deepCopy function for my class?
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/25729862
has comment: http://stackoverflow.com/comment/40228393
tagged with: multithreading
linked to: http://stackoverflow.com/q/40480
has answer: http://stackoverflow.com/a/25729862
type: Question
has comment: http://stackoverflow.com/comment/40232925

http://stackoverflow.com/a/25741408
type: Answer
score: 13
upvote count: 13
has body: Here is Java 8 solution implemented by Date &amp; Time API: int dobYear = 21; int dobMonth = 10; int dobDay = 22; LocalDate now = LocalDate.now(); LocalDate dob = now.minusYears(dobYear) .minusMonths(dobMonth) .minusDays(dobDay); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy"); System.out.println(dob.format(formatter)); Output: 18/10/1992.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25740431
answers question: http://stackoverflow.com/q/25740431

http://stackoverflow.com/comment/40245394
has text: @prabugp Thanks but I don't think a comment can be marked as answered. Also, I'm still expecting an official answer. I'm planning on finding out the first version of Hibernate that introduces FlushMode.MANUAL, and check the release note for suggestions.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25724810
type: Comment

http://stackoverflow.com/q/25729827
has comment: http://stackoverflow.com/comment/40227202
has title: Call Java method from Scala named "clone"
favorite count: 0
has answer: http://stackoverflow.com/a/25738632
type: Question
tagged with: scala
linked to: http://stackoverflow.com/q/15860647
upvote count: 3
has comment: http://stackoverflow.com/comment/40227129
tagged with: java
accepted answer: http://stackoverflow.com/a/25738632
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40226767
tagged with: clone
has body: I want to call a Java method with the following API from Scala: // Java API public interface JavaAPI { JustSomeAPISpecificType clone(); } // Scala code in class a.b.c.D val api: JavaAPI = factory.getAPI val result: JustSomeAPISpecificType = api.clone However, this does not work, as the Scala compiler (2.10) thinks I want to call Object.clone: Error: method clone in class Object cannot be accessed in Option[JavaAPI] Access to protected method clone not permitted because prefix type Option[JavaAPI] does not conform to class D in package a.b.c where the access take place Any ideas? Thanks.
score: 2
tagged with: api
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40239300

http://stackoverflow.com/q/25772687
has comment: http://stackoverflow.com/comment/40305341
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/25773244
has comment: http://stackoverflow.com/comment/40305635
has comment: http://stackoverflow.com/comment/40307310
tagged with: java
has comment: http://stackoverflow.com/comment/40305857
has comment: http://stackoverflow.com/comment/40305597
has title: Java using multiple threads during memory allocation
has body: I'm currently writing a java program that allocates a large multi-dimensional array for processing. During allocation, java ends up using all of the CPUs available to it (in my case, 8 CPUs). Is this expected behaviour? I'm running Ubuntu 14.04 with java version 1.7.0_65. If you need any more information please let me know. If this is the expected behaviour, is there a way to limit it so that it only uses one CPU? public class test { public static void main(String[] args){ System.out.println("Test"); int a = 1000; int b = 100; int c = 100; int d = 1; int e = 10; float[][][][][] test = new float[a][b][c][d][e]; System.out.println("Done"); } } EDIT: By setting the initial heap size large enough, the program never ended up using more than one CPU. In the future I will be using both the large enough initial JVM size and the taskset command to limit the cpu affiinty.
type: Question
has comment: http://stackoverflow.com/comment/40305528
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/25772725
has answer: http://stackoverflow.com/a/25772725
answer count: 3
has comment: http://stackoverflow.com/comment/40305539
tagged with: memory-management
has answer: http://stackoverflow.com/a/25773319
upvote count: 3
tagged with: multithreading
has comment: http://stackoverflow.com/comment/40305693
has comment: http://stackoverflow.com/comment/40305706
accepted answer: http://stackoverflow.com/a/25773319

http://stackoverflow.com/comment/40350525
type: Comment
has text: Thanks! It worked perfectly. I should've thought of that haha.
comment on: http://stackoverflow.com/a/25796771
score: 0
type: AnswerComment

maven-jaxb2-plugin
type: Tag
tags question: http://stackoverflow.com/q/25728801
tag name: maven-jaxb2-plugin
tags question: http://stackoverflow.com/q/25805166

http://stackoverflow.com/comment/40216340
type: Comment
has text: @will The method will never return as you call `getAge()` in both the try and catch. If the goal is to keep looping until a valid age is entered, then I would use `verifyAge()` to control a while loop until a valid age is entered - I've edited the answer to demonstrate
comment on: http://stackoverflow.com/a/25719621
type: AnswerComment
score: 0

http://stackoverflow.com/q/25781529
answer count: 2
tagged with: maven-3
score: 0
has answer: http://stackoverflow.com/a/25792756
tagged with: maven-plugin
tagged with: maven-2
has body: I have the following structure in pom.xml: x y maven-clean-plugin maven-war-plugin maven-antrun-plugin 1.6 <executions> <execution> run <execution> <executions> I want to achieve a serial execution for plugins: Delete some folders and some files (1st plugin) Move a file (2nd plugin) Run cmd file (3rd plugin) What should I use for to have the order above (sequential execution)? Is it relevant ? Is it ok to use pre-integration-test for example ? P.S.: Here are the phases: http://maven.apache.org/ref/3.2.2/maven-core/lifecycles.html
has answer: http://stackoverflow.com/a/25782200
type: UnansweredQuestion
tagged with: maven
tagged with: java
type: Question
has title: Serial execution of plugins in Maven using <phase>

http://stackoverflow.com/comment/40346720
type: AnswerComment
has text: @joeyrohan I don't understand your comment. If you're looking for *local inner classes* they're just called *local classes* and they are a special kind of *inner classes*. Otherwise, what are you looking for?
comment on: http://stackoverflow.com/a/25795434
type: Comment
score: 1

http://stackoverflow.com/a/25834698
has body: You can even do it this way Simply this Double arry[] = {0.0,5.0,2.0,3.0,8.0,0.0,0.0,0.0,1.1,1.0}; Arrays.sort(arry, new Comparator&lt;Double&gt;() { public int compare(Double s1, Double s2) { if(s1==0.0) return 1; else if(s2==0.0) return -1; else if(s1 == 0.0 &amp;&amp; s2 == 0.0) return 0; else return s1.compareTo(s2); } }); System.out.println(Arrays.toString(arry)); or this //first normal sorting Double arry[] = {0.0,5.0,2.0,3.0,8.0,0.0,0.0,1.0}; Arrays.sort(arry, new Comparator&lt;Double&gt;() { public int compare(Double s1, Double s2) { if(s1&lt;s2) return -1; else if(s1&gt;s2) return 1; else return 0; } }); // push the zeros at the end of the array int count = 0; int n =arry.length; for (int i = 0; i &lt; n; i++) if (arry[i] != 0) arry[count++] = arry[i]; while (count &lt; n) arry[count++] = 0.0; System.out.println(Arrays.toString(arry));
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/90558625
answers question: http://stackoverflow.com/q/25834221
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40395418
type: Comment
has text: I have already deployed in jboss4.2 with RESOURCE_LOCAL, But there are no exception on that environment. this exception come on when I deploy the jboss6.
score: 1
comment on: http://stackoverflow.com/a/25803023
type: AnswerComment

http://stackoverflow.com/comment/40386872
type: QuestionComment
has text: You should write your code in the question, not link to screenshots.
score: 2
comment on: http://stackoverflow.com/q/25817035
type: Comment

http://stackoverflow.com/a/25756360
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25756315
has body: If you don't want to keep the count for each number (for example in a map-reduce scenario with a log of different values) you can sort the collection, and then linearly scan through the list. Every time the value changes, you reset your counter. If your counter reaches max you remeber the number and the index.

http://stackoverflow.com/comment/40429250
comment on: http://stackoverflow.com/q/25840304
has text: possible duplicate of [Jar file gives java.lang.NoClassDefFoundError](http://stackoverflow.com/questions/19400561/jar-file-gives-java-lang-noclassdeffounderror)
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/54571622
accepted answer of: http://stackoverflow.com/q/25832378
type: Answer
has body: You have only one dimension defined here: tab[i][j] When you try to get j = 1 you try to access to null object. This is why you get NullPointerException.
type: AcceptedAnswer
score: 0
answers question: http://stackoverflow.com/q/25832378

http://stackoverflow.com/comment/40452678
type: Comment
comment on: http://stackoverflow.com/a/25851236
has text: I edited my post hope it helps.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40310449
score: 0
type: Comment
has text: I check it, but it suggest to import "org.apache.http.impl.client.LaxRedirectStrategy" again.
type: AnswerComment
comment on: http://stackoverflow.com/a/25775029

http://stackoverflow.com/comment/40386123
has text: @HovercraftFullOfEels It makes sense. I tried to solve aki, but hit another problem. All balls run to the corner of the screen when the mouse is inside the screen. Tour again? Or edit the post?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25816386

http://stackoverflow.com/q/25849567
type: UnansweredQuestion
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40467532
has comment: http://stackoverflow.com/comment/40471323
has title: Spring MVC Service Beans loaded twice
type: Question
has comment: http://stackoverflow.com/comment/40449503
has body: I have a problem with my Spring MVC application where my @Service classes are being created twice. I found few threads discussing this issue and most of the time it's related to have the <context:component-scan /> defined both in the Application and also Servlet Context. But in my case I have all the configuration in the Application Context file and the Servlet Context conf file is empty. I'm including the web.xml and the applicationContext.xml files. applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:task="http://www.springframework.org/schema/task" xmlns:jpa="http://www.springframework.org/schema/data/jpa" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd"> <tx:annotation-driven /> <mvc:annotation-driven /> <task:annotation-driven /> <context:component-scan base-package="my.app" /> <mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:resources mapping="/assets/**" location="/WEB-INF/assets/" /> <mvc:resources…
has comment: http://stackoverflow.com/comment/40467495
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40447415
tagged with: spring
has comment: http://stackoverflow.com/comment/40611058
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/25862507
downvote count: 0

communication
tag name: communication
tags question: http://stackoverflow.com/q/25771677
type: Tag

target-platform
tags question: http://stackoverflow.com/q/25781969
tag name: target-platform
type: Tag

http://stackoverflow.com/a/67152080
type: Answer
answers question: http://stackoverflow.com/q/25776903
upvote count: 3
has body: Caused by: java.lang.ClassNotFoundException: com.mchange.v2.c3p0.DataSources The Error Itself says that it is not able to Find the com.mchange.v2.c3p0.DataSources class from the jars which are added in your Maven Dependencies. The Exception is thrown at the time when you are configuring the Hibernate i.e., at LINE 19: Configuration configuration = new Configuration().configure(); Please add the c3p0-0.9.1.2.jar to the classpath or add the dependency in pom.xml from the link maven dependency. In my case, it worked!! hope it helps you too...
score: 3
downvote count: 0

http://stackoverflow.com/comment/40330020
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25786219
has text: Are you using iReport? If so, try create a group by product or description.

http://stackoverflow.com/q/25868660
has comment: http://stackoverflow.com/comment/40481320
answer count: 1
downvote count: 0
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25870949
has comment: http://stackoverflow.com/comment/40482466
type: Question
has comment: http://stackoverflow.com/comment/40483900
has body: There is an utility class called "ConcurrencyUtils" that uses ExecutorService internally private static final ExecutorService executor = Executors.newCachedThreadPool(new CommonPoolThreadFactory()); as you can see it uses a thread pool that will add threads on demand. The problem is that if there is at least one thread in that pool (if util is used at least once) then when main method execution finishes application however didnt shut down, as the threads are still alive and are not garbage collected... initially i've tried to use public static void close(){ executor.shutdown(); } and call it when the programm naturally should stop its execution. But there is no guarantee that main method is the last one to be finished and there can be other tasks that should finish before application will be terminated thus I dont know where do i call "close()" to clear up threads in util... I wonder if community can hint me a smarter/cleaner way to implement this? ConcurrencyUtil is intended to be available for use from everywhere and I cannot create an instance of it I need it to provide its interface through static not instance methods. Update Let me explain this case in detail, ConcurrencyUtil has its own implementation of pool, and it provides usefull methods to chain several runnables and execute them in paralell or make some of them wait for otherso to finish and then execute... doesent matter it should be an utility class so that whenever you want you use async() or chain() and dont wory how it works. Now the sample code : public static void main(String[] args) { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { System.out.println("hoooooooooooook"); } }); ConcurrencyUtil.chain() .add(()-&gt;System.out.println("task 1")) .add(()-&gt;System.out.println("task 2")) .execute() .join(); System.out.println("main finish"); } When this executes i'll have this : created new thread with name [common-pool : thread-1] created new thread with name [common-…
has comment: http://stackoverflow.com/comment/40483970
tagged with: garbage-collection
has comment: http://stackoverflow.com/comment/40480386
has comment: http://stackoverflow.com/comment/40481640
has comment: http://stackoverflow.com/comment/40481615
has comment: http://stackoverflow.com/comment/40480880
has comment: http://stackoverflow.com/comment/40483712
has comment: http://stackoverflow.com/comment/40481031
has comment: http://stackoverflow.com/comment/40483602
has comment: http://stackoverflow.com/comment/40482145
tagged with: java
tagged with: multithreading
upvote count: 1
has comment: http://stackoverflow.com/comment/40481990
has comment: http://stackoverflow.com/comment/40481373
has comment: http://stackoverflow.com/comment/40483557
has answer: http://stackoverflow.com/a/25870949
has title: Properly managing memory when using ExecutorService
linked to: http://stackoverflow.com/q/2921945
tagged with: concurrency
has comment: http://stackoverflow.com/comment/40481666
has comment: http://stackoverflow.com/comment/40480155
has comment: http://stackoverflow.com/comment/40481090
has comment: http://stackoverflow.com/comment/40482011
type: AnsweredQuestion

http://stackoverflow.com/q/25733759
accepted answer: http://stackoverflow.com/a/25738673
favorite count: 0
possible better answer: http://stackoverflow.com/a/25734004
has body: Is there a way to include or exclude certain files based on a condition in Apache Ant (1.8.3)? For instance, I have a macrodef that takes an attribute. I would like to include certain files if the attribute's value matches xyz: <attribute name="myattr" /> <include name="**/@{myattr}/**" /> <exclude name="WEB-INF/config/**" /> <!-- if @{myattr} = "xyz", then <include name="PATH/TO/file.xml" /> --> <zipfileset dir="${ear}/@{myattr}/WEB-INF/" includes="*.xml" prefix="WEB-INF/" /> For instance, if myattr value is xyz, I would like to include the commented file in portion above.
has answer: http://stackoverflow.com/a/25734004
has title: Include a File If a Condition Is Met Inside Apache Ant fileset
upvote count: 1
has answer: http://stackoverflow.com/a/25738673
type: AnsweredQuestion
tagged with: conditional-statements
score: 1
tagged with: ant
tagged with: java
type: Question
answer count: 2
downvote count: 0

http://stackoverflow.com/q/25818275
type: UnansweredQuestion
tagged with: netty
score: 1
tagged with: java
upvote count: 1
tagged with: http
type: Question
tagged with: multiplexing
has body: Unfortunately, JDK's HttpUrlConnection or UrlConnection do not run asynchronously. So, if HTTP connections hang for any reason, you will end up loosing a thread. Plus, Selector's multiplexing allows for using only a few threads for making a high number of HTTP GET calls. So, I have been developing a code that uses NIO's Selector and makes HTTP GET. So, the core works well except that to fully support HTTP 1.1, I have to support Keep-Alive, chunked-transfer-mode, and several other things that HTTP 1.1 supports. So, I have been also looking to do this with Netty, but I have not been able to find an example, which shows how to make several HTTP GET requests using a single thread. So, I would appreciate it if someone could point me to a netty example or any other appropriate library. Thanks
has answer: http://stackoverflow.com/a/25818772
answer count: 1
downvote count: 0
has title: Making a high number of http GET requests with few threads using Netty
favorite count: 0

http://stackoverflow.com/q/25724353
has body: I'm developing an open-source project that is both for a company under one name, and for the community under another name. I would like to be able to easily pass the changes from one to another, but the name and the license are different, so I don't know how to just apply the modifications from one to the other. Let's give an example: ProjectOne : file : src/main/projectone.main : -&gt; /** This file is part of ProjectOne... **/ -&gt; contentA ProjectTwo : file : src/main/projecttwo.main : -&gt; /** This file is part of ProjectTwo... **/ -&gt; contentA Now, consider that I'm modifying the content of projectTwo : contentA -&gt; contentB I get : ProjectOne : file : src/main/projectone.main : -&gt; /** This file is part of ProjectOne... **/ -&gt; contentA ProjectTwo : file : src/main/projecttwo.main : -&gt; /** This file is part of ProjectTwo... **/ -&gt; contentB I would like to be able to easily modify ProjectOne as well, but keeping its own license, package and project name... ProjectOne : file : src/main/projectone.main : -&gt; /** This file is part of ProjectOne... **/ -&gt; contentB ProjectTwo : file : src/main/projecttwo.main : -&gt; /** This file is part of ProjectTwo... **/ -&gt; contentB My project uses Maven for dependencies, Netbeans as IDE and git to manage revisions. Is there a trick (branch, plugin...) that could help me do that?
tagged with: project-management
possible better answer: http://stackoverflow.com/a/25725157
has comment: http://stackoverflow.com/comment/40216887
has comment: http://stackoverflow.com/comment/40216544
downvote count: 0
has answer: http://stackoverflow.com/a/25725157
has comment: http://stackoverflow.com/comment/40217254
has answer: http://stackoverflow.com/a/28425916
accepted answer: http://stackoverflow.com/a/25725241
favorite count: 0
answer count: 3
has title: Develop a project with two names?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40216857
has comment: http://stackoverflow.com/comment/40217338
tagged with: git
type: Question
has answer: http://stackoverflow.com/a/25725241
has comment: http://stackoverflow.com/comment/44473595
tagged with: java
has comment: http://stackoverflow.com/comment/40217457
score: 4
upvote count: 4

http://stackoverflow.com/q/25746110
has title: Draw hidden lines as stippled in wireframe
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jogl
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25746298
score: 3
tagged with: opengl
upvote count: 3
tagged with: java
type: Question
has body: I'm trying to draw all hidden lines (or the parts of lines) as dashed (i.e. stippled) in my wireframe drawing. After a bit of research, it makes sense that this should be achievable by taking several passes at rendering. Here's what I have so far. // -- preamble stuff -- gl.glClearColor(1.f, 1.f, 1.f, 1.f); gl.glShadeModel(GL.GL_SMOOTH); gl.glDepthFunc(GL.GL_LEQUAL); gl.glLineWidth(2); gl.glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // -- render hidden lines with stipple set, color mask enabled, depth buffer disabled -- gl.glDisable(GL_DEPTH_TEST); gl.glColorMask(true, true, true, true); gl.glLineStipple(1, (short) 0x00FF); gl.glEnable(GL_LINE_STIPPLE); gl.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); renderGLDisplayLists(); // -- does the rendering // -- render in fill mode with color mask disabled, depth buffer enabled -- gl.glEnable(GL_DEPTH_TEST); gl.glColorMask(false, false, false, false); gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); renderGLDisplayLists(); // -- final pass to render visible lines -- gl.glColorMask(true, true, true, true); gl.glEnable(GL_LINE); gl.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); renderGLDisplayLists(); I've attached what happens when I run this on a particular case I'm working on.

http://stackoverflow.com/comment/40286956
score: 1
has text: Thanks for this informative answer. Just adding a note here. I was asking this question because the children of CTabItem are not disposed after CTabItem is disposed, which causing memory leak. As you mentioned, releaseChildren is implemented in Composite. The releaseChildren in Widget is no-op. As CTabItem is inherited from Widget not Composite, therefore the children are not disposed or destroyed. The solution to this problem is listen the SWT.Disposed event on CTabItem and dispose the control set into the CTabItem
type: AnswerComment
comment on: http://stackoverflow.com/a/25719073
type: Comment

http://stackoverflow.com/comment/40219843
type: Comment
has text: if resultSet.getString(index) is null, then nothing to do, right? just set currTempValue =null; or currTempValue = ""; unless i am missing something
comment on: http://stackoverflow.com/q/25726352
score: 0
type: QuestionComment

http://stackoverflow.com/a/25718038
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25717981
type: Answer
answers question: http://stackoverflow.com/q/25717981
upvote count: 3
has body: You'll have to use the file system, and maintain a lock file, Or use some IPC mechanism (perhaps abuse the network stack by binding a local port?) If you want the first instance to be aware of the second instance, you'll also need to do IPC communication to facilitate that. Different instances of java run in separate JVMs, while Windows application accomplish that feature via an OS-provided mechanism (instance handles).
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/40258049
type: Comment
comment on: http://stackoverflow.com/q/25732736
type: QuestionComment
has text: You say *"The getData method is inside my Iterator"*, but by the looks, *you're not using an iterator*, but the list itself. At least that's what `this.linked_list` looks like to me. I'd expect something like `Iterator it = this.linked_list.iterator()`, followed by the usual calls of `it.hasNext()`, `it.next()` and so on.
score: 0

http://stackoverflow.com/comment/40289765
comment on: http://stackoverflow.com/a/25762428
score: 0
type: Comment
has text: this not only been tested, but also works. Method readNumber return int, because this method returns only if s.next() is valid integer, so value is never null (while value==null prevents this). **Below sample session:** `>Enter how many numbers to add: >2 >Enter number[1]: >111 >Enter number[2]: >eee >bad format, try again... >fff >bad format, try again... >222 >The Sum is:333`
type: AnswerComment

http://stackoverflow.com/q/25788046
has comment: http://stackoverflow.com/comment/40337609
downvote count: 0
has comment: http://stackoverflow.com/comment/40334725
has title: How to access activity in viewGroup
favorite count: 0
has comment: http://stackoverflow.com/comment/40336341
has comment: http://stackoverflow.com/comment/40343433
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/40337748
answer count: 0
score: 1
tagged with: java
has body: Now i am going on with the transparency of screen. What i need is when drag a slider down with ACTION_MOVE method along with the (x,y)coordinates the opacity should also get differ. Actually i had my screen seperately which is declared as extends activity class and my dragger is of extends viewgroup. For that i had declared the variable static of the layout and tried to access it in extends viewgroup class. It causes me null point error Here what i had tried: public class NextViewGroup extends ViewGroup { case MotionEvent.ACTION_MOVE: { // Log.i ( "Inside Action Move", "" ); if ( event.getY() &gt;= 560 &amp;&amp; CameraFlag == 0 ) { MyActivity.sample(); } } Activity class: public class MyActivity extends Activity { public boolean status = false; Button first, second; public static LinearLayout layout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my); layout = (LinearLayout) findViewById(R.id.transparency); } public static void sample() { try { layout.getBackground().setAlpha(30); } catch (Exception e) { e.printStackTrace(); } } } If anyone have idea about this please help me friends.
upvote count: 1
type: Question

http://stackoverflow.com/comment/40472732
type: QuestionComment
comment on: http://stackoverflow.com/q/25864320
score: 0
has text: is your loadimagefromweboperations actually returning a drawable or are they null
type: Comment

http://stackoverflow.com/q/25797419
has body: If i wanted to make a game that had a similar menu layout to games like candy crush would it be better to use fragments or activities. So when the user clicks on the app icon your immediately hit with a loading screen (loading textures and media) then before actually getting to play a level you go through 2 or 3 different menus. From past experience with activities it would be quite difficult to load all the game data in the first activity and keep a reference to it through 2 or more additional activities. So is the answer here to use fragments?
tagged with: android
linked to: http://stackoverflow.com/q/19927452
has comment: http://stackoverflow.com/comment/40350884
tagged with: android-fragments
score: 0
tagged with: java
answer count: 0
type: UnansweredQuestion
has title: Activities or fragments for 2d game
has comment: http://stackoverflow.com/comment/40350902
tagged with: android-activity
type: Question

http://stackoverflow.com/q/25872624
tagged with: http://stackoverflow.com/tag/zip
type: Question
score: 0
tagged with: maven
answer count: 1
has body: I want to include artifact my_groupid:my_artifact:1.1 into my project, but it has wrong name in maven repository. The repository structure is: my_groupid my_artifact 1.1 my_artifact-1.1-config.jar my_artifact-1.1-config.jar.md5 my_artifact-1.1-config.jar.sha1 my_artifact-1.1.pom my_artifact-1.1.pom.md5 my_artifact-1.1.pom.sha1 my_artifact-1.1.pom conatins: 4.0.0 my_groupid my_artifact pom 1.1 <dependencies/> The artifact my_artifact-1.1-config.jar contains just two XML files in the root and seems like a simple zip. I've tried build-helper-maven-plugin like Maven - Depend on assembled zip but I can't specify type zip. Simple my_groupid my_artifact 1.1 jar is not working because of wrong artifact name in repository. How to include this artifact to access my XMLs?
tagged with: java
accepted answer: http://stackoverflow.com/a/25873040
has title: Include maven dependecny with wrong name
linked to: http://stackoverflow.com/q/12298178
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25873040
tagged with: dependencies

http://stackoverflow.com/comment/40365656
comment on: http://stackoverflow.com/a/25790991
type: Comment
type: AnswerComment
has text: Hey! Many thanks for that! The other answer was great, but that StretchIcon is so much easier. However, it is not quite stretching it sideways. Any way to fix that? http://gyazo.com/437111079ae300dd0309127b8b914a5c.png
score: 0

http://stackoverflow.com/a/31838310
downvote count: 0
has comment: http://stackoverflow.com/comment/77918371
type: Answer
answers question: http://stackoverflow.com/q/25850328
score: 3
upvote count: 3
has body: The main purpose of marker interfaces is to create special types where types themselves have no behavior of their own. public interface MarkerEntity { } public boolean save(Object object) throws InvalidEntityFoundException { if(!(object instanceof MarkerEntity)) { throw new InvalidEntityFoundException("Invalid Entity Found, can't be saved); } return db.save(object); } Here save method makes sure that only the objects of classes that implement the MarkerEntity interface are saved, for other types InvalidEntityFoundException is thrown. So here MarkerEntity marker interface is defining a type that adds special behavior to the classes implementing it. Though annotations can also used now to mark classes for some special treatments but marker annotations are replacement for naming pattern not for Marker interfaces. But marker annotations can't fully replace the marker interfaces because; marker interfaces are used to define type (as already explained above) where as marker annotations do not. Source for marker interface comment

http://stackoverflow.com/q/25787641
has body: In my Grails applications, I have a controller function to return a PDF file. When I make a call to the URL (to return the file), It downloads the file, rather than displaying the PDF file in the browser. When I open other pdf files from other websites, it displays in browser.. so I think it has something to do with my returned response? def separator = grailsApplication.config.project.separator.flag def path = grailsApplication.config.project.images.path+"public/"+user.id+"/" render(contentType: "multipart/form-data", file: new File(path+note.preview), fileName: note.preview) Do I need to change the contentType? (I kind of tried to make it /application/pdf but didnt work?..still downloads.
linked to: http://stackoverflow.com/q/1395151
tagged with: outputstream
upvote count: 3
has title: Grails - Displaying PDF in browser rather than downloading
type: UnansweredQuestion
tagged with: file
has answer: http://stackoverflow.com/a/25789009
type: Question
score: 3
tagged with: java
tagged with: grails
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25787966

tcp
type: Tag
tags question: http://stackoverflow.com/q/25720788
tags question: http://stackoverflow.com/q/25787970
tags question: http://stackoverflow.com/q/25863419
tags question: http://stackoverflow.com/q/25782488
tags question: http://stackoverflow.com/q/25739372
tags question: http://stackoverflow.com/q/25789785
tags question: http://stackoverflow.com/q/25870568
tag name: tcp
tags question: http://stackoverflow.com/q/25713399

http://stackoverflow.com/a/25808662
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40371020
has comment: http://stackoverflow.com/comment/40370345
accepted answer of: http://stackoverflow.com/q/25808451
score: 2
has comment: http://stackoverflow.com/comment/40370787
has comment: http://stackoverflow.com/comment/40370441
has body: You can register all 20 JLabels with the same mouse listener. You would do something like this: MouseListener m = new MouseAdapter() // create our own mouse listener { @Override public void mouseEntered(MouseEvent e) { e.getComponent().setBackground(Color.RED);; // this method changes the colours of all the labels } @Override public void mouseExited(MouseEvent e) { e.getComponent().setBackground(Color.GREEN); // this method changes the colours back to normal } }; for (JLabel label: labels) // iterate over all the labels { label.addMouseListener(m); // give them all our mouse listener } Where "labels" is some collection (List, Set, array...) of your JLabels, and changeLabelColours() and changeLabelColoursBack() are two methods that you define to change the colours. hope this helps! EDIT: reading your edited question, I think I should point out that this code will cause ALL labels to change colour when ANY of the labels is moused-over. I think that's what you mean.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40370543
has comment: http://stackoverflow.com/comment/40370930
has comment: http://stackoverflow.com/comment/40370608
has comment: http://stackoverflow.com/comment/40370407
answers question: http://stackoverflow.com/q/25808451

http://stackoverflow.com/comment/40258255
type: Comment
type: QuestionComment
has text: @Pshemo - Yes. `Animal` needs to be *abstract*.
comment on: http://stackoverflow.com/q/25746974
score: 0

http://stackoverflow.com/comment/40238573
score: 0
type: Comment
has text: @TimBish I have given details in edit of my question......
type: QuestionComment
comment on: http://stackoverflow.com/q/25717922

http://stackoverflow.com/comment/40403632
comment on: http://stackoverflow.com/a/25792370
score: 0
type: Comment
has text: Just check if you are opening and closing the stream properly.Like if u are trying to close a already closed stream etc.
type: AnswerComment

http://stackoverflow.com/q/25790336
downvote count: 0
has comment: http://stackoverflow.com/comment/40406503
has title: A required class was missing while executing org.mortbay.jetty:maven-jetty-plugin:6.1.26:run: org/mortbay/util/Attributes
favorite count: 0
type: UnansweredQuestion
tagged with: maven
has body: I have just trying to run ActiveWeb example https://github.com/javalite/activeweb-bootstrap Cloning code: D:\Users\Dims\Design\!Pure&gt;git clone https://github.com/javalite/activeweb-bootstrap.git Cloning into 'activeweb-bootstrap'... remote: Counting objects: 54, done. remote: Total 54 (delta 0), reused 0 (delta 0) Unpacking objects: 100% (54/54), done. Checking connectivity... done. Changing directory: D:\Users\Dims\Design\!Pure&gt;cd activeweb-bootstrap Running maven goal: D:\Users\Dims\Design\!Pure\activeweb-bootstrap&gt;mvn jetty:run [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for org.javalite:activeweb-bootstrap:war:1.1-SNAPSHOT [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 31, column 21 [WARNING] 'build.plugins.plugin.version' for org.javalite:activejdbc-instrumentation is missing. @ line 66, column 21 [WARNING] [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support building such malformed projects. [WARNING] [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building ActiveWeb Example using Bootstrap 1.1-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] &gt;&gt;&gt; maven-jetty-plugin:6.1.26:run (default-cli) &gt; test-compile @ activeweb-bootstrap &gt;&gt;&gt; [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ activeweb-bootstrap --- [WARNING] Using platform encoding (Cp1251 actually) to copy filtered resources, i.e. build is platform dependent! [INFO] skip non existing resourceDirectory D:\Users\Dims\Design\!Pure\activeweb-bootstrap\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ activeweb-bootstrap --- [INFO] Changes detec…
tagged with: activeweb
answer count: 0
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40356670

http://stackoverflow.com/comment/40411109
score: 0
type: AnswerComment
has text: to add to this calling s2.goo() is not a call done on object but on the class variable that s2 refers which is SuperClass. So effectively the superclass method is called irrespective of underlying object
type: Comment
comment on: http://stackoverflow.com/a/25830651

http://stackoverflow.com/comment/40477456
type: Comment
has text: Tag your question with which language you're using - that would be a start.
type: QuestionComment
comment on: http://stackoverflow.com/q/25867154
score: 0

http://stackoverflow.com/comment/40304818
type: QuestionComment
score: 0
has text: @genpfault I edited the question, can you take a look again please?
comment on: http://stackoverflow.com/q/25771993
type: Comment

http://stackoverflow.com/a/38708520
type: Answer
answers question: http://stackoverflow.com/q/25759045
has body: I was getting same exception and it got resolved after I have added following. com.ibm.jaxws thinclient 8.0.0 provided
score: 0

http://stackoverflow.com/q/25775972
has comment: http://stackoverflow.com/comment/40312097
type: Question
has comment: http://stackoverflow.com/comment/40311902
has body: Well confusing title, to put it longer but simpler, can you create an object class, in which a constructor will create multiple of the objects of the class and store them in an static object arrayList, all this in one class? If you can't can you make a static void in that class to do so? Regards Augustas
has comment: http://stackoverflow.com/comment/40311850
linked to: http://stackoverflow.com/q/929021
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40311858
has title: Can you make a constructor in an object class that will make multiple of the object and store it on a public static variable in the object class?
possible better answer: http://stackoverflow.com/a/25776229
has comment: http://stackoverflow.com/comment/40311849
has answer: http://stackoverflow.com/a/25776609
accepted answer: http://stackoverflow.com/a/25776609
has comment: http://stackoverflow.com/comment/40311749
has answer: http://stackoverflow.com/a/25776229
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40311790
tagged with: java

http://stackoverflow.com/q/25864036
tagged with: apache-httpclient-4.x
has answer: http://stackoverflow.com/a/25906395
type: UnansweredQuestion
tagged with: java
has title: How to post a file to a protected URL using apache httpclient 4.3.5
type: Question
has body: I need to post a file to a protected url with a set of request parameters using apache httpclient 4.3.5. Could you please share some sample code for the same? Thanks
score: 0
answer count: 1

http://stackoverflow.com/comment/40259845
comment on: http://stackoverflow.com/q/25747769
score: 0
type: Comment
type: QuestionComment
has text: did u test it on an IDE like eclipse?

http://stackoverflow.com/comment/40417690
score: 0
type: Comment
has text: Hmm... `readObject` doesn't seem to throw `InterruptedException` though, which I assume means it doesn't listen to interrupts? Or how could I see in the API that this is going to work?
comment on: http://stackoverflow.com/a/25834268
type: AnswerComment

http://stackoverflow.com/a/55244250
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25832616
has body: httpclient.getParams().setParameter(CoreConnectionPNames.CONNECTION_TIMEOUT, 1500); httpclient.getParams().setParameter(CoreConnectionPNames.SO_TIMEOUT, 1500);
score: 1

http://stackoverflow.com/comment/40286009
comment on: http://stackoverflow.com/a/25761002
type: AnswerComment
score: 0
type: Comment
has text: Can you try `myFile = new File("\\\\server\\path\\to\\share");` to see if you can access it that way? From the Javadoc: `Returns null if this abstract pathname does not denote a directory, or if an I/O error occurs.`

face-recognition
tags question: http://stackoverflow.com/q/25754609
tags question: http://stackoverflow.com/q/25718887
type: Tag
tag name: face-recognition

http://stackoverflow.com/q/25745786
accepted answer: http://stackoverflow.com/a/25745877
answer count: 1
downvote count: 0
tagged with: jsp
favorite count: 0
tagged with: http://stackoverflow.com/tag/html
tagged with: http://stackoverflow.com/tag/xml
has body: I want to print a text file uploaded on my server on my JSP page. That text file contains XML tags. I already find how to read a text file from URL to string and how to print it. Im doing it like this: &lt;% URL website = new URL("this is my url"); URLConnection connection = website.openConnection(); BufferedReader in = new BufferedReader( new InputStreamReader( connection.getInputStream())); StringBuilder response1 = new StringBuilder(); //response1.append("&lt;![CDATA["); String inputLine; while ((inputLine = in.readLine()) != null) { response1.append(inputLine+"\n"); } //response1.append("]]&gt;"); out.println(response1.toString()); in.close(); %&gt; However when i open my JSP page im getting only text. All my XML tags disapears. What to do to print them aswell? As u can see, i have tried to do CDATA but it isnt working. Edit: As @markbernard suggested, I need to use escapeXml(String) method from StringEscapeUtils. If u got maven, just add dependecy, if not download a lib into your Web-INF/lib directory. Usage for my case: String result = response1.toString(); out.println(StringEscapeUtils.escapeXml(result));
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25745877
score: 1
upvote count: 1
type: Question
has title: How to treat XML tags like a plain text in JSP page
tagged with: java

http://stackoverflow.com/a/25776201
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/25775977
has body: There is a SceneProperty you can monitor to see if the scene attached to a window changes. There is no public Java 8 API to monitor all of the windows known to the JavaFX runtime. That information would be available from an unsupported private API that you might find if you wanted to review the JavaFX source code, though making use of unsupported private APIs is not recommended for most applications. Probably, internally, ScenicView works this way and you might get some more information on the process by asking the ScenicView developers.
downvote count: 0

http://stackoverflow.com/comment/40468940
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25862211
has text: why are you trying to do this in your Application class?
type: Comment

http://stackoverflow.com/q/25749550
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/25749756
has body: Ok so I want to read the contents of a tar.gz file (or a xy) but that's the same thing. What I am doing is more or less this: TarArchiveInputStream tarInput = new TarArchiveInputStream(new GzipCompressorInputStream(new FileInputStream("c://temp//test.tar.gz"))); TarArchiveEntry currentEntry = tarInput.getNextTarEntry(); BufferedReader br = null; StringBuilder sb = new StringBuilder(); while (currentEntry != null) { File f = currentEntry.getFile(); br = new BufferedReader(new FileReader(f)); System.out.println("For File = " + currentEntry.getName()); String line; while ((line = br.readLine()) != null) { System.out.println("line="+line); } } if (br!=null) { br.close(); } But I get null when I call the getFile method of TarArchiveEntry. I am using Apache commons compress 1.8.1
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25749756
tagged with: java
tagged with: apache-commons-compress
type: Question
score: 12
upvote count: 12
has title: Read tar.gz in Java with Commons-compression

http://stackoverflow.com/comment/40282696
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25760257
score: 1
has text: possible duplicate of [Event listener in Java without app having focus? (Global keypress detection)](http://stackoverflow.com/questions/800747/event-listener-in-java-without-app-having-focus-global-keypress-detection)

http://stackoverflow.com/comment/40415204
type: Comment
has text: are you know a good way to add a checkBox to listCell? Just if I add checkBox to the graphics of listCell then checkBox appears just after the text of listCell. There are graphicsGap, but it's static number and if width of listCell have changed then checkBox will remain in place.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25832408

http://stackoverflow.com/a/25890792
has body: Your activities are using different settings for taskAffinity. Most of then use the default (no task affinity given), but one of them specifies the empty string as its taskAffinity. Remove the line android:taskAffinity=""
score: 3
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25846110
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25846110
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/40520870

http://stackoverflow.com/q/25718066
has answer: http://stackoverflow.com/a/25759319
has comment: http://stackoverflow.com/comment/40204397
has title: Eclipse debugger and remote debugger not working
tagged with: remote-debugging
has body: I m using Eclipse Luna Version: Luna Release (4.4.0) Build id: 20140612-0600-32 BIT I have some breakpoints and remote debugger on which use to work as expected. Suddenly it stopped working. I m debugging using Target runtime option. Now , it does not stop at the breakpoints. Though in case of remote debugging , it connects to the port. Verified that using netstat. But it is just not stopping at breakpoints. I m using SUN JDK 1.7 Some times I get PERM SPACE OUT issue. Kindly suggest.
has answer: http://stackoverflow.com/a/25745458
has comment: http://stackoverflow.com/comment/40229927
downvote count: 0
type: UnansweredQuestion
tagged with: java
score: 6
type: Question
tagged with: debugging
upvote count: 6
has answer: http://stackoverflow.com/a/50773836
has comment: http://stackoverflow.com/comment/40239152
tagged with: eclipse
answer count: 3
has comment: http://stackoverflow.com/comment/40204490
tagged with: eclipse-plugin
favorite count: 0

http://stackoverflow.com/comment/69510012
score: 0
type: Comment
type: QuestionComment
has text: I'm having the same issue but with Tomcat 8.5, Jersey REST & Firebase... None of the methods below work (or other suggestions on the internet for that matter)!!!
comment on: http://stackoverflow.com/q/25828425

http://stackoverflow.com/comment/43290702
has text: Hello benka i am facing problem while read and write operation will you help me out.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25866874
type: AnswerComment

http://stackoverflow.com/q/25831611
tagged with: android
has comment: http://stackoverflow.com/comment/41098299
upvote count: 3
downvote count: 2
has answer: http://stackoverflow.com/a/26437213
has comment: http://stackoverflow.com/comment/40412753
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40413064
has comment: http://stackoverflow.com/comment/40416070
has comment: http://stackoverflow.com/comment/40414322
has body: I have a large String from the database. I showed it in the TextView with scrolling. This is a totally boring method to show large text though; I want to show data in pages. There are multiple questions similar to this one, but I am not able to find any solutions from them; they are incomplete and off track. Challenges How to count number of lines that fit to screen? How to split string in sub parts so that each substring fits to a page?
linked to: http://stackoverflow.com/q/14276853
answer count: 1
tagged with: textview
tagged with: string
has comment: http://stackoverflow.com/comment/40412800
favorite count: 0
has title: How to show long Strings in pages in android?
type: UnansweredQuestion

http://stackoverflow.com/comment/40224191
score: 2
has text: https://jira.spring.io/browse/SPR-1358
comment on: http://stackoverflow.com/q/25728488
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40246618
type: QuestionComment
type: Comment
has text: i think "ap" is in j3data.getJSONObject(1); not j3data.getJSONObject(0);
score: 0
comment on: http://stackoverflow.com/q/25739304

http://stackoverflow.com/comment/90063264
type: Comment
type: AnswerComment
has text: That may not work if using PowerMock; see https://github.com/powermock/powermock/issues/925
score: 1
comment on: http://stackoverflow.com/a/25771253

http://stackoverflow.com/comment/40386395
type: Comment
has text: Thank you so far, kamil. I've updated my post to show everything I'm doing. Still there is no validation happening, just a 400 returned.
comment on: http://stackoverflow.com/a/25815779
type: AnswerComment
score: 0

http://stackoverflow.com/a/25765137
type: AcceptedAnswer
type: Answer
has body: I made it work by putting following line in my code: configurationPath = configurationPath.replace("${catalina.base}", System.getProperty("catalina.base")); I envisaged there where some automation for replacing ${catalina.base}, but obviously not
accepted answer of: http://stackoverflow.com/q/25760924
answers question: http://stackoverflow.com/q/25760924
score: 0

http://stackoverflow.com/a/25839724
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25839603
has body: try this: ServletContext context = getServletContext(); RequestDispatcher dispatcher = context.getRequestDispatcher("/GotoHere"); dispatcher.forward(request, response);

http://stackoverflow.com/comment/51432068
comment on: http://stackoverflow.com/q/25827804
type: Comment
type: QuestionComment
score: 0
has text: Is this a persistent stream (say, a file), or something like a network stream in which you only have one chance to see an item if you don't store it?

http://stackoverflow.com/q/25857231
has comment: http://stackoverflow.com/comment/40460231
score: 0
has answer: http://stackoverflow.com/a/25857611
accepted answer: http://stackoverflow.com/a/25857611
tagged with: rest-assured
has comment: http://stackoverflow.com/comment/40460256
answer count: 1
has comment: http://stackoverflow.com/comment/40460379
has comment: http://stackoverflow.com/comment/40460764
has body: I'm trying to do some API testing but I'm not sure how to get started. Like in Java, how could I read in the response of a server for example: localhost:3000/ping the response is: { "status": "success", "data": { "alive": true } } Looks like httpclient is no longer being developed, so I looked into REST-Assured (https://code.google.com/p/rest-assured/). My question is, how could I translate this to javacode? I was looking at httpclient, but I don't even know how to use it. Any help will be much appreciated, thanks much! Screenshot:
type: AnsweredQuestion
tagged with: java-http-client
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40460186
tagged with: testing
has title: Getting JSON data from server running on localhost

http://stackoverflow.com/q/25716511
has answer: http://stackoverflow.com/a/25716564
possible better answer: http://stackoverflow.com/a/25716553
has comment: http://stackoverflow.com/comment/40201540
tagged with: java
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40201558
has comment: http://stackoverflow.com/comment/40201729
has answer: http://stackoverflow.com/a/25716553
has comment: http://stackoverflow.com/comment/40202236
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25716564
has title: Is it a good way to represent used / invaild data by -1?
has body: Introduction I had made a extremely simple simulation on real time shuffling ball and pick ball on some time interval https://github.com/gaplo917/Mark6-java/blob/master/src/Mark6.java What I want to simulate is : There are total 49 ball in a machine, the machine will keep shuffling the ball. After a period of time, the machine will open the gate pick a ball out. Here is the video : http://youtu.be/5QHsYA2lcI0?t=2m2s What I had written ( extremely easy version ): There are 49 ball and I made it for 49+1 space. Each shuffle of the ball if the ball is shuffle into the extra space. After a period of time, I will check the extra space to see the ball is swapped into it and pick it out. Then mark the space with -1 to represent the spaces is no longer valid. Instead, I should pick a ball randomly but not using an extra space. Just ignore this scenario... After this work, I will try to use Android Game engine to simulate the gravity and collision for learning purpose. Back to my question : Is it a good way to represent used data by -1 ? Is it a normal approach in real world application?
type: Question

http://stackoverflow.com/comment/40277013
type: QuestionComment
has text: For what purpose? If it's for an update, the best bet is not to fetch them at all, but to express the update as a single UPDATE statement, and have all the work done by the database. Transporting a million rows back and forth cannot possibly be fast.
comment on: http://stackoverflow.com/q/25757013
score: 1
type: Comment

http://stackoverflow.com/q/25811227
type: Question
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/25811385
tagged with: inheritance
favorite count: 0
tagged with: class
score: 0
answer count: 3
tagged with: constructor
has answer: http://stackoverflow.com/a/25811333
accepted answer: http://stackoverflow.com/a/25811333
has comment: http://stackoverflow.com/comment/40375071
possible better answer: http://stackoverflow.com/a/25811280
has answer: http://stackoverflow.com/a/25811280
type: AnsweredQuestion
tagged with: java
has title: Constructor method of subclass for a superclass type object?
tagged with: date
has body: I have seen constructer method of subclass being used for a variable with superclass type. For example: DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); Is formatter a DateFormat type object or a SimpleDateFormat type? Since the class SimpleDateFormat inherit from DateFormat, it probably has more methods than its superclass. Can the instance formatter call these functions only exist in SimpleDateFormat but not DateFormat? Are DateFormat and SimpleDateFormat interchangeable in this case? such as: SimpleDateFormat formatter = new DateFormat ("yyyy-MM-dd");

http://stackoverflow.com/comment/40258406
type: Comment
comment on: http://stackoverflow.com/a/25730121
has text: Thanks! Is there any way to make the music app to present the search string (or the relevant information in it) in the search slot? It happens after asking for music using Google's voice search in the selected music app.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40509080
comment on: http://stackoverflow.com/a/25813026
type: Comment
score: 0
type: AnswerComment
has text: I've tried with ContainerRequestFilter, ContainerResponseFilter and java servlet filter but still can't catch post requests from client to the server. The requests are send to protected page if this is matter...

http://stackoverflow.com/comment/40355752
has text: if user 1 plays then 3, 2 if user 2 plays then 1, 3 if user 3 plays then 2, 1 Is that what you want?
comment on: http://stackoverflow.com/q/25800068
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25737507
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/25737365
score: 1
downvote count: 0
has body: The main pain point here probably isn't the ArrayList, but the use of the + operator with Strings. Since Strings are immutable in java, each invocation forces the creation of a new object and copying of all the data, which, as you stated, may be quite long. A faster way to do this would be to use a StringBuilder, which does not (necessarily) force the copying of the data on each operation: StringBuilder result = new StringBuilder(); for(String[] classLines: writtenClasses) { for(String classLine: classLines) { result.append(classLine).append('\n'); } }

http://stackoverflow.com/q/25734738
tagged with: divide-and-conquer
tagged with: algorithm
tagged with: arrays
downvote count: 0
answer count: 1
has title: Trying to understand this algorithm for finding Kth min from two sorted array
accepted answer: http://stackoverflow.com/a/25734770
score: 1
tagged with: big-o
favorite count: 0
upvote count: 1
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25734770
type: Question
has body: Description: Given two sorted arrays (none-descending), find the Kth min element in T = O(lg(m + n)), m and n are length of two arrays, respectively. Question: Do not understand the algorithm below about three points: Why we can drop the left part of A directly, when A[aPartitionIndex] &lt; B[bPartitionIndex]? Why can not drop the left part of A, and the right part of B at the same time? Some "resource" said this algorithm can be applied on finding Kth min in N sorted arrays, how? split k into N parts? Code: Java. Solution: Binary Search. // k is based on 1, not 0. public int findKthMin(int[] A, int as, int ae, int[] B, int bs, int be, int k) { int aLen = ae - as + 1; int bLen = be - bs + 1; // Guarantee the first array's size is smaller than the second one, // which is convenient to remaining part calculation. if (aLen &gt; bLen) return findKthMin(B, bs, be, A, as, ae, k); // Base case. if (aLen == 0) return B[bs + k - 1]; if (k == 1) return Math.min(A[as], B[bs]); // k based on 1, not 0. // Split k, // one part is distributed to A, // the other part is distributed to B. int ak = aLen &lt; (k/2)? aLen: k/2; int bk = k - ak; // *k is based on 1, not 0. int aPartitionIndex = as + (ak - 1); int bPartitionIndex = bs + (bk - 1); if (A[aPartitionIndex] == B[bPartitionIndex]) { return A[aPartitionIndex]; } else if (A[aPartitionIndex] &lt; B[bPartitionIndex]) { // Drop the left part of A, and // do recursion on the right part of A, and // the entire current part of B. k = k - ak; return findKthMin(A, aPartitionIndex + 1, ae, B, bs, be, k); } else { // Drop the left part of B, and // do recursion on the entire current part of A, and // the right part of B. k = k - bk; return findKthMin(A, as, ae, B, bPartitionIndex + 1, be, k); } }

http://stackoverflow.com/a/26222778
answers question: http://stackoverflow.com/q/25805204
has body: I had the same issue... Let me expand a bit on Anushree's comment: Go to Window &rArr; Preferences &rArr; Run/Debug &rArr; Launching &rArr; VisualVM Configuration Browse... for the VisualVM Executable in your JDK's bin-directory Make sure to also set the JDK's root directory under JDK Home. If you leave that pointing to your JRE directory, you'll run into the next error... Happy profiling... BTW: If you then have issues getting your application to show up inside jVisualVM, take a look here: Getting Java program running in Eclipse to show up in VisualVM
upvote count: 26
downvote count: 0
score: 26
type: Answer

http://stackoverflow.com/q/25839209
type: UnansweredQuestion
has body: I need this below code to start failing when the provided date string doesn't match the given format 100%. SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy"); format.setLenient(false); format.parse("09/10/20144"); For some reason even with setLenient(false) this call returns an actual 09/10/20144 date. I tried passing "new ParsePosition(0)" to the parse call but that doesn't help at all since the date still returns as 09/10/20144. I need any exceptions from the exact date format to fail hard. Is there any good way of doing that?
linked to: http://stackoverflow.com/q/489538
tagged with: simpledateformat
tagged with: java
tagged with: date
type: Question
has answer: http://stackoverflow.com/a/25841912
answer count: 2
has title: How to make SimpleDateFormat.parse() fail hard?
has answer: http://stackoverflow.com/a/25850309
downvote count: 0
has comment: http://stackoverflow.com/comment/40427122
score: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/40445411
upvote count: 4

http://stackoverflow.com/comment/40199000
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25715057
type: AnswerComment
has text: I'm saying the objects referenced by local variables **can** die before execution exits their (local variable) scope. [Scope](http://docs.oracle.com/javase/specs/jls/se8/html/jls-6.html#jls-6.3) only deals with the validity of the use of a name in a program.

http://stackoverflow.com/comment/40217040
comment on: http://stackoverflow.com/q/25723956
score: 0
type: Comment
type: QuestionComment
has text: Well, kind of. I would prefer a centered image. But a resizing one would be okay if the aspect ratio stays the same.

http://stackoverflow.com/a/25802279
answers question: http://stackoverflow.com/q/25802158
has body: Simply create the Locale object with the desired language and country code, for example: Locale finnish = new Locale("fi", "FI"); You're not restricted to the constants that are defined in the Locale class. See the API documentation.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25802158
downvote count: 0
has comment: http://stackoverflow.com/comment/40361371
type: Answer
score: 7
upvote count: 7

http://stackoverflow.com/q/25825973
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25826336
upvote count: 1
score: 1
tagged with: java
type: Question
tagged with: intellij-idea
answer count: 1
downvote count: 0
has title: Add properties file when deploying
tagged with: tomcat
favorite count: 0
has body: I am building a web application using IntelliJ 13 Ultimate and a tomcat8 server. I have a properties file next to my TextUtil class in order to access it with TextUtil.class.getResource(TEXT_PROPERTY_PATH).getFile() But when I am starting my server with IntelliJ, by default the file is not being copied (which is quite logical, because it is not part of the compiler output). I edited the artifact and added the files manually. But by doing this, the file is not being updated on change without restarting the server. Is there A) a better place for the properties-file from where I can access it withou having the context-object or B) a way to leave the file where it is and get it updated on change?

http://stackoverflow.com/comment/40468798
type: QuestionComment
type: Comment
score: 1
has text: Just refresh it and try to clean the project...
comment on: http://stackoverflow.com/q/25862158

http://stackoverflow.com/comment/40429617
type: QuestionComment
has text: @Chechus true, but that's a different *subtype* of `Exception`. I guess that what I don't understand (from the question) is, how is it violating Liskov Substitution Principle ?
score: 1
comment on: http://stackoverflow.com/q/25840461
type: Comment

http://stackoverflow.com/q/25810003
has answer: http://stackoverflow.com/a/25811674
answer count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: hibernate-mapping
has answer: http://stackoverflow.com/a/25810173
has body: Is it possible to add mapping in code rather in hibernate.cfg.xml file?? I have one hibernate.cfg.xml file for several different servers and I would like to load the mapping dynamically and not from the cfg file. Thank you!
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40373459
has title: Adding entity mapping in code rather in hibernate.cfg.xml
tagged with: hibernate
has comment: http://stackoverflow.com/comment/40396747

http://stackoverflow.com/a/25800979
type: AcceptedAnswer
has body: Data distribution should take place as long as you have multiple nodes in a cluster (I believe the requirement would be that they all need to have the config - programmatic or config file). Replication (different from distribution) can be controlled by the config. If you wish to look more into how data can be assigned to partitions, you can check the hazelcast docs for reference - a suggested route would be to add the partition name to the map to achieve better data access (for read heavy apps).
accepted answer of: http://stackoverflow.com/q/25800401
type: Answer
answers question: http://stackoverflow.com/q/25800401
score: 0

http://stackoverflow.com/q/25822901
type: UnansweredQuestion
tagged with: jprogressbar
has body: Please help. This code isn't working. The progress bar is created and 0% is showing in it that's all. I don't know much about java.i'm looking for some help. Original code: jProgressBar1.setName(""); jProgressBar1.setValue(0); jProgressBar1.setStringPainted(true); jProgressBar1.addContainerListener(new java.awt.event.ContainerAdapter() { public void componentAdded(java.awt.event.ContainerEvent evt) { jProgressBar1ComponentAdded(evt); } }); private void jProgressBar1ComponentAdded(java.awt.event.ContainerEvent evt) { Task tk = new Task(); tk.run(); } class Task extends Thread { public Task(){} public void run(){ for(int i =0; i&lt;= 100; i++){ final int progress = i; SwingUtilities.invokeLater(new Runnable() { public void run() { jProgressBar1.setValue(progress); } }); }}} Latest code: import java.awt.event.ContainerAdapter; import java.awt.event.ContainerEvent; import javax.swing.*; public class ini extends JFrame { public ini() { initComponents(); } private void initComponents() { setResizable(false); jLabel1 = new JLabel(); jProgressBar1 = new JProgressBar(0,100); jProgressBar1.addContainerListener(new ContainerAdapter() { @Override public void componentAdded(ContainerEvent e) { if (jProgressBar1 == e.getChild()) { System.out.println("progressBar!"); new Thread(new Task()).start(); } } }); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("Criminal Records"); jLabel1.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel1.setText("Criminal Records"); jProgressBar1.setName(""); jProgressBar1.setValue(0); jProgressBar1.setStringPainted(true); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(204, 204, 204…
tagged with: swing
tagged with: java
has comment: http://stackoverflow.com/comment/40397056
type: Question
has comment: http://stackoverflow.com/comment/40397089
score: 0
answer count: 1
has title: Adding Container Listener for ProgressBar Java
has answer: http://stackoverflow.com/a/25822965

http://stackoverflow.com/comment/40260511
comment on: http://stackoverflow.com/a/25730971
type: AnswerComment
type: Comment
has text: @AlexVong Nope, java.lang classes were made final to prevent you from messing up their behavior (beware that the java compiler relies on them providing precisely specified behavior for autoboxing/unboxing). Make your own type, maybe extend java.lang.Number.
score: 0

http://stackoverflow.com/q/25745917
tagged with: spring-boot
has title: How to provide the classtype for generic classes in spring-boot?
has body: I'd like to create a little framework, and want to provide some default classes that should be loaded is the user does not provide an implementation class. This behviour shall be similar to the spring-boot. Problem: Many of the classes I'd like to create should be generic, and would just required the classtype to be defined by the user. Anyhow this forces the user to explicit implement each of these classes and provide the classtype. Is there any way I could word around this? How could the user provide the classtype that should be used on the generics, without having to explicit implement the generic class? Is that possible? framework: @Configuration public class AppConfig { @Bean @ConditionalOnMissingBean public BaseValidator&lt;T extends MyReq&gt; defaultValidator() { return new BaseValidator&lt;T extends MyReq&gt;(); } } custom app: @Configuration @EnableAutoConfiguration @Import(AppConfig.class) public CustomConfig { } //I'd like to prevent that the user has to implement each generic class as follows: @Component public class MyValidator extends BaseValidator&lt;CustomReq&gt; { } Is it possible that the user just provides the CustomReq.class, and the BaseValidator is automatically instaniated with that provided classtype?
score: 0
answer count: 1
tagged with: generics
accepted answer: http://stackoverflow.com/a/25747756
tagged with: spring
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25747756

http://stackoverflow.com/q/25730809
answer count: 1
has comment: http://stackoverflow.com/comment/40228502
tagged with: spring-security
favorite count: 0
has comment: http://stackoverflow.com/comment/40229375
tagged with: security
type: UnansweredQuestion
has title: Spring Security using java config doesn't submit the login page
tagged with: spring
has body: I am new to Java config feature of the spring. I am trying to use spring security using java config but my login page doesn't do anything when i submit the page. It looks like the request is not going anywhere. I am using Spring 4.0.6 RELEASE and Spring security 3.2.4.RELEASE. Please help. Thanks in advance. 1) Spring security Java Config class @Configuration @EnableWebSecurity public class AppSecurityConfig extends WebSecurityConfigurerAdapter { @Autowired private CustomUserDetailsService customUserDetailsService; @Override protected void configure(AuthenticationManagerBuilder registry) throws Exception { registry.userDetailsService(customUserDetailsService); } @Override public void configure(WebSecurity web) throws Exception { web.ignoring().antMatchers("/resources/**"); } protected void configure(HttpSecurity http) throws Exception { http .csrf().disable() .authorizeRequests() .antMatchers("/login","/login/form**","/register","/logout").permitAll() //any user can access a request if the URL starts with these URLs .antMatchers("/admin","/admin/**").hasRole("ADMIN") //Any URL that starts with "/admin/" will be resticted to users who have the role "ROLE_ADMIN" .anyRequest().authenticated() .and() .formLogin() .loginPage("/login/form") .loginProcessingUrl("/login") .failureUrl("/login/form?error") .permitAll(); } } 2) Login page using tiles so this is just one of the body page <%@ page pageEncoding="UTF-8"%> Locale is: <%=request.getLocale()%> <%-- this form-login-page form is also used as the form-error-page to ask for a login again. --%> <c:if test="${not empty param.login_error}"> Your login attempt was not successful, try again. Reason: <c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}" />. </c:if> <form name="adminLogin" action="<c:url value='/login'/>" method="POST"> Login User Name: <input type='text' name='username' value='<c:if test="${not empty param.login_error}"><c:out value="${SPRING_SECURITY_LAST_USERNAME}"/></c:if>' /> Password: Don't ask for my …
tagged with: spring-mvc
score: 0
upvote count: 1
downvote count: 1
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/25731895

http://stackoverflow.com/comment/40982508
score: 0
type: Comment
comment on: http://stackoverflow.com/q/25835904
type: QuestionComment
has text: Tried re-installing ..Didn't work

http://stackoverflow.com/a/25733670
accepted answer of: http://stackoverflow.com/q/25716711
has comment: http://stackoverflow.com/comment/40234608
type: Answer
has body: You could use a block cipher (e.g. AES) in counter mode. In this mode each block can be encrypted / decrypted separately if you know it's counter.
has comment: http://stackoverflow.com/comment/40235774
answers question: http://stackoverflow.com/q/25716711
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40286288
comment on: http://stackoverflow.com/q/25762424
has text: http://way2java.com/oops-concepts/specifiers-modifiers/access-specifier-vs-access-modifier-in-java/
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/40424392
score: 0
type: Comment
has text: @MarkoTopolnik thank you very much. perhaps its time to get a better textbook.
comment on: http://stackoverflow.com/a/25837689
type: AnswerComment

http://stackoverflow.com/a/25715065
answers question: http://stackoverflow.com/q/25714981
upvote count: 1
type: Answer
accepted answer of: http://stackoverflow.com/q/25714981
downvote count: 0
score: 1
has body: main() is the entry point of a program. You can't have 2 entry points. So, you need the main method of the first class to call the method of the second class, and give it x and y as arguments: public class Graph { public void render(double[] x, double[] y) { // create your PlotPanel (you can use it as a JPanel) Plot2DPanel plot = new Plot2DPanel(); // add a line plot to the PlotPanel plot.addLinePlot("Distance vs Time", x, y); // put the PlotPanel in a JFrame, as a JPanel JFrame frame = new JFrame("a plot panel"); frame.setContentPane(plot); frame.setVisible(true); } } and in the main method of Eight_c: // create a Graph object: Graph graph = new Graph(); // ask it to render x and y: graph.render(x, y); I find it quite strange to start using Swing if you don't know what methods and objects are, and how to pass arguments to methods. That's a bit like trying to fly an Airbus when you have not learnt how to walk yet. Read an introductory book about Java and programming in general. Exercise and practice with simple, console-based programs. Then only start using Swing.
has comment: http://stackoverflow.com/comment/40198945
type: AcceptedAnswer

http://stackoverflow.com/a/25827035
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25764169
has body: I've had this same issue myself over the last couple of years, but I've not found an ideal solution yet. Ultimately the problem is that mybatis does not allow you to specify the key of a hashmap - it uses the result property name as the key. The two approaches I've taken to work around this are far from perfect, but I'll outline them here in case they're useful for you: Use a result handler. I see you say you've tried this but are only getting the first value - any chance you could share your code? The result handler gets called once per row returned in the query, so you don't want to create a new object each time. You want to create an object only if you don't already have one that matches the ID in this row, and then iteratively build it up based on the following rows. Build the names and values as a list of hashmaps and then use a select interceptor (mybatis plugin) to call a method inside the object to construct your real hashmaps. To do this, in your result map you need to specify your name and value results under a association of type hashmap. Then Mybatis will turn this into a list that looks like: [List [Hashmap {"attributeName"=name1,"attributeValue"=value1}], [Hashmap {"attributeName"=name2,"attributeValue"=value2}]] Then you can call a method in the interceptor that iterates over this hashmap to build the hashmap you want. Neither solution is pretty. The first solution loses the elegance of result maps, and the second solution dirties your domain object. But if you are interested in further details let me know and I will add some code examples.
has comment: http://stackoverflow.com/comment/40410738
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/25764169
score: 6

http://stackoverflow.com/a/25829730
type: Answer
downvote count: 0
score: 1
has body: Here is a possible solution: Create a ParseObject from the type of your table: ParseObject time = new ParseObject("Date"); Then get the ParseObject from the result: time = result.getParseObject(pointer_field); Now you can pull from time any field that it has just as you would do it normally, for example: time.getString("some_field"). You may also need to include: query.include("pointer_field").
has comment: http://stackoverflow.com/comment/40620028
upvote count: 1
answers question: http://stackoverflow.com/q/25828732

http://stackoverflow.com/q/25870733
tagged with: garbage-collection
has body: I've found multiple posts stating when finalize() should NOT be used and that it shouldn't be used in general because nobody guarantees the the object will be garbage collected during the lifetime of the application (unless you actually need the object throughout the lifetime of the application, this is a memory leak in my book). But let's say I have a Java class that initializes something (does memory allocation and initialization) in native space through JNI. As far as I'm concerned, there two ways I can implement this: 1. Implement an init() and deinit() method in the class to do the native initialization and deinitialization. This has a down side that I have to take care of the object life cycle and can't leave that to the garbage collector (which is not very Java-like). 2. Do the initialization in the constructor and deinitialization in the finalize() method. This basically enables the objects to be automatically garbage collected like with any other Java class. What I'm asking is - is there a reason for me not to go with number 2? Thanks, Nenad
has title: In which cases is finalize() actually USED?
tagged with: java
has comment: http://stackoverflow.com/comment/40483945
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40487457
has comment: http://stackoverflow.com/comment/40483887
score: 0
has comment: http://stackoverflow.com/comment/40484298
has answer: http://stackoverflow.com/a/25883599
favorite count: 0
has comment: http://stackoverflow.com/comment/40484751
upvote count: 2
has answer: http://stackoverflow.com/a/25871398
type: UnansweredQuestion
tagged with: android
downvote count: 2

http://stackoverflow.com/comment/40383426
type: Comment
comment on: http://stackoverflow.com/q/25806350
has text: can you please post code of main activity of button click
score: 0
type: QuestionComment

http://stackoverflow.com/q/25802310
has comment: http://stackoverflow.com/comment/40359629
accepted answer: http://stackoverflow.com/a/25805358
has title: Using functions from JAR file
has body: Suppose I have a Project Calculator. It has one java class DMAS.java in package org.math; DMAS.java contains 4 basic mathematical operations (implemented as java functions) add,subtract,multiply,divide. Each takes two arguments and returns the required result. I have built a JAR for this project, let's name it calculator.JAR . Now let's switch to another project. Let's name it AdvancedCalculator. I include calculator.JAR in build path of AdvancedCalculator project. How do I call functions defined in class DMAS.java from AdvancedCalculator project? All Methods in DMAS.java are static.
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40359860
tagged with: jar
favorite count: 0
has comment: http://stackoverflow.com/comment/40359755
possible better answer: http://stackoverflow.com/a/25802373
has answer: http://stackoverflow.com/a/25805358
has answer: http://stackoverflow.com/a/25802373
type: AnsweredQuestion
upvote count: 2
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/25803756
type: Question

http://stackoverflow.com/q/25754414
downvote count: 0
has body: I'am making an android wallpaper app but whenever I restart my phone the wallpaper zooms so I tried using BootReciever but I failed nothing different has happened the wallpaper stills zoom after restarting the phone. So here is my MainActivity java: public class MainActivity extends Activity implements OnClickListener { public static final String KEY = "wallpaperapp"; private SharedPreferences sharedPreference; private int retrievedImageID; static int tophone; ImageView display; public static Integer[] tophone2 = { R.drawable.iv1,R.drawable.iv2,R.drawable.iv3,R.drawable.iv4,}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_main); tophone = R.drawable.iv1; display = (ImageView) findViewById(R.id.IView); ImageView image1 = (ImageView) findViewById(R.id.iv1); ImageView image2 = (ImageView) findViewById(R.id.iv2); ImageView image3 = (ImageView) findViewById(R.id.iv3); ImageView image4 = (ImageView) findViewById(R.id.iv4); Button setWp = (Button) findViewById(R.id.setWp); Picasso.with(MainActivity.this).load(R.drawable.iv1_s).into(image1); Picasso.with(MainActivity.this).load(R.drawable.iv2_s).into(image2); Picasso.with(MainActivity.this).load(R.drawable.iv3_s).into(image3); Picasso.with(MainActivity.this).load(R.drawable.iv4_s).into(image4); image1.setOnClickListener(this); image2.setOnClickListener(this); image3.setOnClickListener(this); image4.setOnClickListener(this); setWp.setOnClickListener(this); sharedPreference = getPreferences(MODE_PRIVATE); changeWallpaper(); } @Override public void onClick(View v) { // TODO Auto-generated method stub switch (v.getId()){ case R.id.iv1: display.setImageResource(R.drawable.iv1); tophone = R.drawable.iv1; break; case R.id.iv2: display.setImageResource(R.drawable.iv2); tophone = R.drawable.iv2…
has comment: http://stackoverflow.com/comment/40274178
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/40273827
has title: How to set wallpaper Image permently? (android, eclipse)
answer count: 0
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40274405
has comment: http://stackoverflow.com/comment/40288642
type: Question
has comment: http://stackoverflow.com/comment/40273737
tagged with: java
tagged with: eclipse
score: 2

http://stackoverflow.com/comment/40516732
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25863795
score: 0
has text: i debugged it, but there is no exceptions

http://stackoverflow.com/a/43761742
upvote count: 2
type: Answer
downvote count: 0
score: 2
answers question: http://stackoverflow.com/q/25862866
has body: I had a similar problem trying to connect to a server from Netbeans (v8.2). Here's what I did to resolve the issue: Right click on the project and select Properties. Go to the Run Configuration section and click the Manage button next to Remote Connection. In the dialog that comes up, make sure that the connection you are using is SFTP and not FTP (this is displayed next to the connection name on the left). If it's FTP, click the Add button to setup a new connection that uses SFTP. This worked for me. I imagine it has to do with the server being configured to only allow certain connection types.

http://stackoverflow.com/q/25735811
has comment: http://stackoverflow.com/comment/40238001
upvote count: 3
type: UnansweredQuestion
tagged with: encryption
has comment: http://stackoverflow.com/comment/40262527
has comment: http://stackoverflow.com/comment/40238139
type: Question
has title: How to encrypt large amounts of data using asymmetric cryptography?
score: 3
has answer: http://stackoverflow.com/a/25738820
tagged with: java
has comment: http://stackoverflow.com/comment/40238048
has body: In the client side of my application I want to encrypt text (that could be of any size) using a public key. After that I'll send this packet to a server. In the server side I want to decrypt this packet using my private key. I can't use RSA, because the packet size could be of any size, even bigger then the key. I can do that using OpenSSL, creating files and stuff with the results of Encrypt/Decrypt. The question is: is there another way to programmatic do that?
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/6262374
has comment: http://stackoverflow.com/comment/40252319
has comment: http://stackoverflow.com/comment/40261371
favorite count: 0
has comment: http://stackoverflow.com/comment/40238164
tagged with: public-key-encryption
tagged with: cryptography
has comment: http://stackoverflow.com/comment/40238463
has answer: http://stackoverflow.com/a/25747175
has comment: http://stackoverflow.com/comment/40238078

http://stackoverflow.com/comment/40288947
comment on: http://stackoverflow.com/q/25763717
type: Comment
type: QuestionComment
has text: Thank you very much this is what i got under my Path variable: C:\oraclexe\app\oracle\product\11.2.0\server\bin;;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\development\tools\maven\bin;C:\Program Files\Java\jdk1.6.0_30\bin and my JDK compliance is also 1.6 and the thing is that i am -for customer-related issues- required to use jdk 1.6 not 1.8
score: 0

http://stackoverflow.com/a/25832008
type: AcceptedAnswer
downvote count: 0
score: 4
has body: You can use semaphore as shown below:- // Grant access to only 5 permits Semaphore sp = new Semaphore(5); public void myMethod() { sp.acquire(); //... sp.release(); } Sempahore gives you the functionality of controlling how many threads can execute your method by specifying the number of permits in its constructor. Since you want not more than 5 threads to execute concurrently you can specify 5 in the constructor of Semaphore. Now when different threads call your myMethod , you restrict the access by using either sp.tryAcquire() if you dont want the thread to wait till it gets permit or you can call sp.acquire() to make the threads wait if already 5 other threads have got the permit . Calling release() does the release of the permit for a new thread to be able to access your method
type: Answer
has comment: http://stackoverflow.com/comment/40416554
has comment: http://stackoverflow.com/comment/40420221
accepted answer of: http://stackoverflow.com/q/25831964
upvote count: 4
answers question: http://stackoverflow.com/q/25831964

http://stackoverflow.com/comment/40306880
has text: @wckd I don't think that's correct. One of the terms used in computing f(4) is f(4-2), which basically counts all sequences beginning with 2 and followed by all sequences that add up to 2. Since his count for f(2) didn't include the sequence {2} twice, I don't see how the count for f(4) includes {2,2} twice.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25773380

http://stackoverflow.com/comment/40234305
has text: I have already used JMS for a project, I think JMS is very heavy for this simple project.
comment on: http://stackoverflow.com/q/25728775
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40394062
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25821020
has text: you are not appending ontouchlistener on any views. check your original activity (which this code is working on that), you will see an ontouchlistener or even extending ontouchlistener in top of activity (instead of `public class BulgarianSayings extends Activity`)
type: Comment

http://stackoverflow.com/q/25777733
has body: I am working with the Gimbal SDK in android and I am getting this error in the Gradle Build Messages: Error:duplicate files during packaging of APK D:\Kowshik\AndroidStudioProjects\SMSBlocker\app\build\outputs\apk\app-debug-unaligned.apk Path in archive: META-INF/notice.txt Origin 1: D:\Kowshik\AndroidStudioProjects\SMSBlocker\app\libs\spring-android-core-1.0.1.RELEASE.jar Origin 2: D:\Kowshik\AndroidStudioProjects\SMSBlocker\app\libs\spring-android-rest-template-1.0.1.RELEASE.jar You can ignore those files in your build.gradle: android { packagingOptions { exclude 'META-INF/notice.txt' } } Error:Execution failed for task ':app:packageDebug'. &gt; Duplicate files copied in APK META-INF/notice.txt File 1: D:\Kowshik\AndroidStudioProjects\SMSBlocker\app\libs\spring-android-core-1.0.1.RELEASE.jar File 2: D:\Kowshik\AndroidStudioProjects\SMSBlocker\app\libs\spring-android-core-1.0.1.RELEASE.jar Information:BUILD FAILED Information:Total time: 5.75 secs Information:2 errors Information:0 warnings Information:See complete output in console From with I can deduce, I can see that there is a duplicate of the spring-android-core-1.0.1.RELEASE.jar , right? But in my file structure, it is fine and their are no duplicates. Is there any solution to this?
favorite count: 0
has answer: http://stackoverflow.com/a/26239976
tagged with: gimbal
possible better answer: http://stackoverflow.com/a/29418983
upvote count: 1
has answer: http://stackoverflow.com/a/29418983
accepted answer: http://stackoverflow.com/a/26239976
type: AnsweredQuestion
score: 1
tagged with: java
has title: Working with the Gimbal SDK
tagged with: gradle
type: Question
answer count: 2
downvote count: 0
tagged with: android

http://stackoverflow.com/comment/43653906
has text: it work fine, but when i add a compte(exchange for example) , this exception apear. i guess the contacts are lucked by others applications. anyone have a solution?
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25744486

http://stackoverflow.com/a/25758704
upvote count: 2
answers question: http://stackoverflow.com/q/25758458
type: Answer
has body: My 2 cents for a large data store. Firstly, it's inadequate for a file based data store solution. That basically says your data is disk IO bounded and it's hard for you to be able to achieve the optimization that any commercial DB like Oracle has done to its disk IO access, even if you are sort of "object based file structure". My past experience of caching such data uses in-memory caching techniques like Coherence cache. Basically you build up a cluster of servers, each with high amount of memory (say 48GB) and you cache all your objects in memory. Think it like a large hash map with redundancy factor which you could configure. You could define your key in custom way. Secondly, it looks obvious that your solution is space bounded and you could think of shifting some pressure to CPU bounded - by either compress the JSON format; or store binary data and convert to JSON in real time. That should be able to shrink your data to a large ratio. You need to choose a proper format so that the CPU won't be overloaded though but I guess that's very unlikely. The above is based on the assumption that the queries are single i.e. to query single combination of (date, station). If you have other frequent queries then some supporting data structure like indices needs to be used.
score: 2
downvote count: 0

http://stackoverflow.com/a/25725143
has body: As a suggestion: Maybe you have an encoding problem with/in your URL. Try to use following: URLEncoder.encode(queryString, "UTF-8") Note: Maybe you just need to encode the Query-String, not the entire URL! Not tested see here for simmilar problem: https://stackoverflow.com/a/12476622/3887073 EDIT: Maybe this is a server problem. see HTTP Error 502 Service Temporarily Overloaded
has comment: http://stackoverflow.com/comment/40218487
has comment: http://stackoverflow.com/comment/40217952
type: Answer
answers question: http://stackoverflow.com/q/25724551
accepted answer of: http://stackoverflow.com/q/25724551
score: 0
type: AcceptedAnswer

http://stackoverflow.com/q/25744472
tagged with: jira-plugin
linked to: http://stackoverflow.com/q/11961749
has body: When i use library(com.sun.jersey.client.apache.config.DefaultApacheHttpClientConfig or another ) returns status 500 with massage "java.lang.NoClassDefFoundError: com/sun/jersey/client/apache/config/DefaultApacheHttpClientConfig...", which means that program don't see this library at runtime(program is a jira plugin which runs on localhost). How i can add this library dynamically to runtime, cause when i build classes at my PC its OK. I tried to configure pom.xml and atlassian-plugin.xml files.
score: -1
has answer: http://stackoverflow.com/a/25744536
tagged with: classloader
has comment: http://stackoverflow.com/comment/40253554
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/11961749
tagged with: maven
downvote count: 1
type: Question
tagged with: java
tagged with: jira
upvote count: 0
answer count: 1
has title: how to resolve HTTP Status 500: java.lang.NoClassDefFoundError
favorite count: 0

http://stackoverflow.com/comment/40342494
type: Comment
score: 1
has text: If you are using Sybase ASE, you may also want to look at Component Integration Services (CIS). It allows you to interact with a remote DB through your local Sybase ASE instance. It's similar to mounting a remote hard drive to your local system.
comment on: http://stackoverflow.com/q/25779593
type: QuestionComment

http://stackoverflow.com/comment/40231094
comment on: http://stackoverflow.com/a/25731507
score: 0
type: AnswerComment
type: Comment
has text: Sorry If this is totally going over my head but, should the new method be "public static boolean areAllDivisorsPalindromic (int number, List al)"? so it should have two constructors? and it will have an ArrayList variable in it? And it also cannot be a prime number so it should remain !=.

http://stackoverflow.com/a/25819187
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The general documentation applies to all driver implementations in this case: "After execution, you cannot re-execute the Bulk() object without reinitializing." So the .execute() method effectively "drains" the current list of operations that have been sent to it and now contains state information about how the commands were actually sent. So you cannot add more entries or call .execute() again on the same instance without reinitializing . So after you call execute on each "Bulk" object, you need to call the intialize again: bulkEvent = eventsCollection.initializeOrderedBulkOperation(); bulkSession = sessionsCollection.initializeOrderedBulkOperation(); Each of those lines placed again repectively after each .execute() call in your function. Then further calls to those instances can add operations and call execute again continuing the cycle. Note that "Bulk" operations objects will store as many items as you want to put into them but will break up requests to the server into maximum amounts of 1000 items. After execution the state of the operations list will reflect exactly how this is done should you want to inspect that.
answers question: http://stackoverflow.com/q/25814729
score: 4
has comment: http://stackoverflow.com/comment/40400577
upvote count: 4
accepted answer of: http://stackoverflow.com/q/25814729

http://stackoverflow.com/a/25832867
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40415735
has comment: http://stackoverflow.com/comment/40415476
has comment: http://stackoverflow.com/comment/40415531
type: Answer
has comment: http://stackoverflow.com/comment/40416483
score: 1
has comment: http://stackoverflow.com/comment/40416386
upvote count: 1
has comment: http://stackoverflow.com/comment/40415662
answers question: http://stackoverflow.com/q/25832379
accepted answer of: http://stackoverflow.com/q/25832379
has body: Personally, I hate the default config so I never use it. Take a look at YamlConfiguration. See a tutorial. File fileConfig = new File(Plugin.getDataFolder().getPath(), "config.yml"); YamlConfiguration config = YamlConfiguration.loadConfiguration(fileConfig); // Setting Location spawn = Player.getLocation(); config.set("spawn.world", spawn.getWorld().getName()); config.set("spawn.x", spawn.getX()); config.set("spawn.y", spawn.getY()); config.set("spawn.z", spawn.getZ()); config.set("spawn.yaw", spawn.getYaw()); config.set("spawn.pitch", spawn.getPitch()); try { config.save(fileConfig); } catch (IOException io) { // Unable to save data } // Getting String world = config.getString("spawn.world"); double x = config.getDouble("spawn.x"); double y = config.getDouble("spawn.y"); double z = config.getDouble("spawn.z"); double yaw = config.getDouble("spawn.yaw"); double pitch = config.getDouble("spawn.pitch"); Location spawn = new Location(Server.getWorld(world), x, y, z, (float) yaw, (float) pitch); Player.teleport(spawn);
has comment: http://stackoverflow.com/comment/40415055
has comment: http://stackoverflow.com/comment/40415229

http://stackoverflow.com/q/25760269
tagged with: java
has body: I have been trying to figure out how to make a regular java application reopen on close, or simply make it not be able to close. I realize this is possible with a swing application by using DO_NOTHING_ON_CLOSE but my application does not use swing. Say I have the following program running: public static void main(String[] args) { new MyThread(); } And MyThread runs constantly. Say the user closes the program, is there anyway to detect that a java program is being closed and reopen it, or even better is it possible to make it DO_NOTHING_ON_CLOSE without swing?
linked to: http://stackoverflow.com/q/2541597
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/25761097
favorite count: 0
has answer: http://stackoverflow.com/a/25760339
has comment: http://stackoverflow.com/comment/40283119
has comment: http://stackoverflow.com/comment/40285115
has comment: http://stackoverflow.com/comment/40282755
possible better answer: http://stackoverflow.com/a/25760339
score: 1
accepted answer: http://stackoverflow.com/a/25761097
upvote count: 1
type: AnsweredQuestion
has title: How to restart a Java application when closed programmatically

http://stackoverflow.com/comment/40295659
comment on: http://stackoverflow.com/q/25766671
score: 0
has text: @venu I would expect that it's being decoded when you get the value.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40289427
type: QuestionComment
score: 0
has text: I Used 4 GB RAM and I think so its sufficient for Android .
comment on: http://stackoverflow.com/q/25763834
type: Comment

http://stackoverflow.com/a/25860337
downvote count: 1
has body: Did not know about the java dissassembler, javap. Running $ javap -s JavaTest.class shows that the correct signature is (I)V. Change: jmethodID constructor_method_id = env-&gt;GetMethodID( cls, "&lt;init&gt;", "V(I)" ); To: jmethodID constructor_method_id = env-&gt;GetMethodID( cls, "&lt;init&gt;", "(I)V" );
upvote count: 9
type: AcceptedAnswer
score: 8
type: Answer
accepted answer of: http://stackoverflow.com/q/25860251
has comment: http://stackoverflow.com/comment/40465633
answers question: http://stackoverflow.com/q/25860251

http://stackoverflow.com/comment/40206905
has text: this is amINODATE() method I was reffering to. +1 for the better name.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25718481

http://stackoverflow.com/a/25749610
answers question: http://stackoverflow.com/q/25749592
score: 2
downvote count: 0
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25749592
has body: You need to escape the backslash (it's a special character) - String str = "test string"; str = str.replace(" ", "\\ "); System.out.println(str); Output is (the requested) test\ string
type: Answer

http://stackoverflow.com/comment/40443446
type: Comment
comment on: http://stackoverflow.com/q/25848242
has text: Please do check the following post, http://stackoverflow.com/questions/12847247/not-displaying-images-in-spring-mvc
score: 0
type: QuestionComment

http://stackoverflow.com/a/25811826
downvote count: 0
upvote count: 3
type: AcceptedAnswer
has body: You have to implement an HttpSessionListener, put your logging code on the sessionDestroyed method, and register it on your web.xml file. Here's an example: http://www.mkyong.com/servlet/a-simple-httpsessionlistener-example-active-sessions-counter/
accepted answer of: http://stackoverflow.com/q/25811788
type: Answer
answers question: http://stackoverflow.com/q/25811788
has comment: http://stackoverflow.com/comment/40377062
score: 3

http://stackoverflow.com/comment/40220572
has text: You can find the lowest mark without ordering the array.
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/25726803

http://stackoverflow.com/comment/40277758
has text: Just FYI : The above code works only if you have a sorted array.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25757448

http://stackoverflow.com/a/25823054
score: 2
accepted answer of: http://stackoverflow.com/q/25821874
answers question: http://stackoverflow.com/q/25821874
type: AcceptedAnswer
downvote count: 0
has body: Suggestions: It sounds like your GUI code is geared towards making JFrames, and if so, you will want to avoid this. You are painting yourself in a corner by having your class extend JFrame, forcing you to create and display JFrames, when often more flexibility is called for. In fact, I would venture that most of the Swing GUI code that I've created and that I've seen does not extend JFrame, and in fact it is rare that you'll ever want to do this. More commonly your GUI classes will be geared towards creating JPanels, which can then be placed into JFrames or JDialogs, or JTabbedPanes, or swapped via CardLayouts, wherever needed. This will greatly increase the flexibility of your GUI coding. This question has direct bearing on your problem. I will guess that your main problem isn't how to give classes getter methods, and how to have other classes call the getter methods. More often then not, when faced with the issue of extracting information from one GUI view to another, the issue is one of when to extract the information. If you displayed your second window as a non-modal JFrame, and then had the calling class immediately extract the data from that second JFrame, you'd get nonsense data, because you'd be extracting data before the user would have time to interact with the 2nd window and enter data. One possible solution to this when using non-modal windows to get information from the user is to use a WindowListener so you can be notified when the user has completed his dealing with the second window, and so now data can be safely extracted. Often better is for the 2nd window not be non-modal, as JFrames are, but instead to be a modal window such as a modal JDialog. When the calling code displays a modal dialog, all code flow in the calling code stops until the dialog is no longer visible. In this situation, no WindowListener is needed since you will know exactly when the dialog has been dealt with -- on the code line immediately after you set it visible -- and so ca…
type: Answer
upvote count: 2

http://stackoverflow.com/a/25776125
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/25776058
has body: Forget Swing, forget GUI's. The easiest way for one object to change the state of another is for the first object to call a method of the 2nd, passing information into it. You should have one class hold an instance of the other, and then have the first one call methods on the 2nd passing information in as needed. This can all be set up in your FractalFrame constructor, by passing in an instance of one class into the other. You can even pass both in to each other if needed, but this will tighten coupling quite a bit. i.e., FractalzGUI gui = new FractalzGUI(); FractalJPanel panel = new FractalJPanel(gui.kol, gui.zoom, gui.radio); // obviously these classes need setter methods gui.setFractalJPanel(panel); this.add(panel); this.add(gui, BorderLayout.EAST); Edit Called out by a professional and a purist ... Better still, use a separate non-GUI model class that holds the logic that underlies your GUI. Allow the view classes (the GUI classes) to register listeners on the model, and then when one class changes the model, all listeners are notified and can query the model as to its state, and then adjust their views accordingly.
has comment: http://stackoverflow.com/comment/40312137
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40312217

http://stackoverflow.com/q/25816897
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
tagged with: jboss
type: Question
tagged with: jpa
answer count: 1
downvote count: 0
favorite count: 0
has title: Jboss 7 Deployment / Conflict Issues
type: UnansweredQuestion
has body: I am working on an application that is using JPA, Hibernate. I can deploy fine on Tomcat but on jBoss it will not deploy. I get the following error. JBAS011466: PersistenceProvider 'org.hibernate.jpa.HibernatePersistenceProvider' not found After doing some Googling I found some articles that suggested I'm getting conflicts because I have my own JPA, Hibernate, Persistence API jars packaged into my WAR. I want to tell jBoss to use my version of those files. I found a article suggesting putting the following in WEB-INF/jboss-classloading.xml. I did this but it did not resolve the issue. Any suggestions?
has answer: http://stackoverflow.com/a/25817002

http://stackoverflow.com/q/25761034
tagged with: spring
has body: We are using a spring MVC project with jackson to marshal (json to pojo). Problem is whenever we try to call a controller with an invalid object there is an error that is not presented in our default log level ("INFO"). is it possible to set jackson errors to a different log level? Thanks!
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: jackson
favorite count: 0
type: Question
has title: Jackson - Errors are being displayed in "Trace"\"Debug" log level
has answer: http://stackoverflow.com/a/25761159
has answer: http://stackoverflow.com/a/37742948
upvote count: 2
answer count: 2

http://stackoverflow.com/comment/40201467
type: AnswerComment
type: Comment
has text: I know that it's something very unusual, but I have other, normal buttons, that simply take ActionListener and I manage their calls in actionPerformed method. I was looking for some consistent way of collecting events. Dispatching event from mouse listener is an option, but takes time and extends complexity. And, as you mentioned, I will probably have to provide same listener for all components inside my new JPanel if I decide to go that way.
comment on: http://stackoverflow.com/a/25716405
score: 0

http://stackoverflow.com/q/25733587
duplicate of: http://stackoverflow.com/q/19896870
has body: Im trying to load properties in Spring from a properties file. But I keep getting a null value. Here's my program: public class App { @Value("${jdbc.url}") private String jdbcUrl; public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext( "Spring-All-Modules.xml");// load super configuration file. App app= new App(); System.out.println("URL"+ app.jdbcUrl);// always print null . Im loading the properties file in the application context as follows: &lt;context:property-placeholder location="/databaseconfig.properties"/&gt; And this is my database properties file : jdbc.driverClassName=com.cassandra.datastax.Driver jdbc.url=jdbc:url How do I fix this? EDIT: The question is not a duplicate. The other question uses autowired and a configuration class. This uses neither. My example prints null the other throws a null pointer exception. Please open this question.
has title: why is @Value returning null?
has comment: http://stackoverflow.com/comment/40234925
score: 0
linked to: http://stackoverflow.com/q/19896870
has comment: http://stackoverflow.com/comment/40234649
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40234901
linked to: http://stackoverflow.com/q/4130486
tagged with: spring
has comment: http://stackoverflow.com/comment/40235005
tagged with: java
type: Question

http://stackoverflow.com/a/25757130
score: 1
answers question: http://stackoverflow.com/q/25756494
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25756494
type: AcceptedAnswer
has body: You are getting Runtime Exception for multipliers.put(e, 1.0) which is a java.lang.NullPointerException because you din't initialize multipliers Map. If you don't initialize any object ,by default they initialized with a null value. Initialize it- HashMap&lt;Element, Double&gt; multipliers =new HashMap&lt;Element, Double&gt;();
has comment: http://stackoverflow.com/comment/40277294
type: Answer
downvote count: 0

http://stackoverflow.com/q/25846931
type: Question
tagged with: java
has body: I am using VMwareExsi APIs that is vijava sdk for accessing some of the VMs which are running in the hypervisor. I am trying to get list of all processes running in one of the Vms. I have GuestProcessManager instance with me, and I am calling GuestProcessManager .listProcessesInGuest(GuestAuthentication gauth,pids). As evident ,gauth is mandatory parameter for the method.But I am unable to get GuestAuthentication object . How can I retrieve it? I tried following approach: Folder rootFolder = si.getRootFolder(); ManagedEntity[] mes = new InventoryNavigator(rootFolder) .searchManagedEntities("VirtualMachine"); NamePasswordAuthentication auth = null; auth = new NamePasswordAuthentication(); String username = "xxx"; String password = "xxxxxxx"; long[] pids=null; auth.setUsername(username); auth.setPassword(password); auth.setInteractiveSession(true); GuestProcessInfo[] processInfo=si.getGuestOperationsManager().getProcessManager((VirtualMachine)mes[1]).listProcessesInGuest(auth,pids); What am I getting is :Exception caused:::VI SDK invoke exception:com.vmware.vim25.GuestOperationsUnavailable. If I set interactivesession to false , exception message changes to Exception caused:::VI SDK invoke exception:com.vmware.vim25.GuestComponentsOutOfDate . I am using vijava5.5 .jar for development . System on host &amp; EXSI version : vmnix-x86VMware ESXi 5.5.0 . I am attaching below the some of the informations I am fetching from my VM, this information shows VM is in running state . CPU Allocation Shares ::2000 Memory Allocation Shares ::20480 RunTime Max CPU Usage::5799 RunTime Max Memory Usage::2048 Runtime memory overhead::36024320 Average CPU utilization 1.375237150741635E-4 Listing process for VmVirtualMachine:2 @ 10.126.77.45 Exception caused:::VI SDK invoke exception:com.vmware.vim25.GuestOperationsUnavailable Guest OS:Red Hat Enterprise Linux 5 (64-bit) VM Version:vmx-10 CPU:4 vCPU Memory:12288 MB Memory Overhead:373.0514 MB VMware Tools:guestToolsRunning IP Addresses:10.…
has comment: http://stackoverflow.com/comment/41273641
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/41311030
has answer: http://stackoverflow.com/a/26336655
type: UnansweredQuestion
has title: accessing GuestAuthentication object for getting list of processes in guest for Vmware Java API

http://stackoverflow.com/q/25811823
type: AnsweredQuestion
tagged with: svn
tagged with: java
accepted answer: http://stackoverflow.com/a/25816620
type: Question
tagged with: continuous-integration
answer count: 1
score: 0
has body: I have an Jenkins build machine with the follow situation: 1. MY_MAVEN_PROJECT 2. MY_MAVEN_PROJECT_BRANCH_1.0 3. MY_MAVEN_PROJECT_ nightly_build All of these task use a common maven repository located in ~/m2./repository The problem is that the all builds use the same maven repository, when I execute the nightly build I’d like to remove also the maven repository, in order to have a very clean situation. So I was wondering if it is possible to have an situation like this: 1. MY_MAVEN_PROJECT |_ workspace maven repository (workspace/MY_MAVEN_PROJECT/m2./repository) 2. MY_MAVEN_PROJECT_BRANCH_1.0 |_ workspace maven repository (workspace/ MY_MAVEN_PROJECT_BRANCH_1.0/ m2./repository) 3.MY_MAVEN_PROJECT_ nightly_build |_ workspace maven repository(workspace/MY_MAVEN_PROJECT_ nightly_build/m2./repository) Any help is appreciated
has answer: http://stackoverflow.com/a/25816620
tagged with: jenkins
tagged with: maven
has title: Jenkins build with differents maven repository

http://stackoverflow.com/a/25858574
upvote count: 1
has body: There are semicolons (;) after your if statements. This doesn't work. It's basically saying if condition is true, do nothing. And then it executes the code in the {}s. (Java allows for random {}s like this). To correct your code: import java.util.Scanner; public class FantahunKeburAlmostIsoscelesRightTriangle{ public static void main (String []args){ Scanner s = new Scanner(System.in); System.out.println("Enter the longest side: "); double longest = s.nextDouble(); System.out.println("Enter 2nd side: "); double second = s.nextDouble(); System.out.println("Enter 3rd side: "); double third = s.nextDouble(); double longsq = longest*longest; double secondsq = second*second; double thirdsq = third*third; double secthirdsq = secondsq*thirdsq; if (secthirdsq==longsq) { System.out.println("This triangle is an almost-Isosceles right triangle. "); } else if (secthirdsq!=longsq) { System.out.println("This triangle is not a right triangle. "); } } } As a side note, I recommend (though this is a personal preference) that you put the {s for if statements on the same line. It will make errors like this more obvious - if (condition); { looks wrong at first glance.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40463606
type: Answer
has comment: http://stackoverflow.com/comment/40464899
has comment: http://stackoverflow.com/comment/40464464
answers question: http://stackoverflow.com/q/25858516
has comment: http://stackoverflow.com/comment/40463134
has comment: http://stackoverflow.com/comment/40463037

http://stackoverflow.com/comment/40303893
comment on: http://stackoverflow.com/q/25771848
score: 0
has text: You say you're using jackson, but this is just using a plain old Java `ObjectInputStream`.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25765691
accepted answer: http://stackoverflow.com/a/25772146
type: Question
tagged with: search
score: 0
answer count: 1
tagged with: elasticsearch
has body: I'm having trouble creating a query which should search for any documents with a certain search term in the fields title and text, and should match a state field which could be zero or more values where atleast one must match. Given the following query: "bool" : { "must" : { "multi_match" : { "query" : "test", "fields" : [ "title", "text" ] } }, "should" : { "terms" : { "state" : [ "NEW" ] } }, "minimum_should_match" : "1" } Should not the following data be returned as a result? { "_shards": { "failed": 0, "successful": 5, "total": 5 }, "hits": { "hits": [ { "_id": "JXnEkYFDQp2feATMzp2LTA", "_index": "tips", "_score": 1.0, "_source": { "state": "NEW", "text": "This is a test", "title": "Test" }, "_type": "tip" } ], "max_score": 1.0, "total": 1 }, "timed_out": false, "took": 1 } In my test this is not the case. What am i doing wrong? the following is the java code producing the outputted query. SearchRequestBuilder builder = client.prepareSearch("tips").setTypes("tip"); BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); if(searchTermIsNotEmpty(searchTerm)){ MultiMatchQueryBuilder qb = QueryBuilders.multiMatchQuery( searchTerm, "title", "text" ); boolQuery.must(qb); } if(filters.size() &gt; 0){ boolQuery.should(QueryBuilders.termsQuery("state",filters)); boolQuery.minimumNumberShouldMatch(1); } if(boolQuery.hasClauses()){ builder.setQuery(boolQuery); } logger.info(boolQuery.toString()); SearchResponse result = builder.execute().actionGet(); return result.toString(); Any help on this is greatly appreciated!
has answer: http://stackoverflow.com/a/25772146
has title: Elasticsearch query doesn't produce expected result
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/25824762
has answer: http://stackoverflow.com/a/25824839
type: Question
downvote count: 0
answer count: 1
tagged with: number-formatting
favorite count: 0
accepted answer: http://stackoverflow.com/a/25824839
upvote count: 1
has title: Planets exceed the Number Box
type: AnsweredQuestion
tagged with: numbers
has body: I'm having a issue with the code below: public class Stargazing { public static void main(String args[]) { double planets = 840000; double numofsun = 2.5; double total = 0; System.out.println("Galaxy #"+"\t"+"Planets"); for(int i=1;i&lt;12;i++){ double siSky= planets * numofsun; total+=siSky; System.out.println(i+"\t"+total); } } } The program is meant to calculate the number of planets within a given galaxy, but the issue seems to be once the number of planets end up in the millions and billions its starts to outputs numbers like this: 5 1.05E7 6 1.26E7 7 1.47E7 8 1.68E7 9 1.89E7 10 2.1E7 11 2.31E7 I do not know what I should place in place of double to achieve this. Also to make a comma appear for example: 1,200,000,000 I'll end up putting more columns, but its imperative I get these columns right so that the numbers in the others don't show up so funky.
score: 1
tagged with: java

http://stackoverflow.com/q/25777652
tagged with: while-loop
has answer: http://stackoverflow.com/a/25784237
accepted answer: http://stackoverflow.com/a/25784237
has title: Need help writing a string to multiple lines in a text file
has comment: http://stackoverflow.com/comment/40316006
has comment: http://stackoverflow.com/comment/40314864
has answer: http://stackoverflow.com/a/25783719
has body: I have an array of strings toFile[] that I am attempting to write to a text file. While testing, I was reminded that if the sting reaches the bounds of the window, notepad does not wrap the string to the next line. Being a bit of a perfectionist, I want to split the string into substrings that are 250 characters in length and write each of those to the file, breaking into a new line after each substring. While testing, the problem I have run into, and can't seem to solve, is that my program will run through the loop once and then fails with an error. An example of the output and error: toFile[2].length = 2432 temp.length = 250 split = 250 iLength = 2182 temp.length = 0 split = 500 iLength = 1932 java.lang.StringIndexOutOfBoundsException: String index out of range: -250 My code: System.out.println("toFile[2].length = "+Integer.toString(toFile[2].length())); System.out.println(""); if(toFile[2].length()&gt;250){ int iLength=toFile[2].length(), split = 0; while(iLength&gt;250){ String temp = toFile[2]; temp = temp.substring(split, 250); System.out.println("temp.length = "+Integer.toString(temp.length())); bw.write(temp);bw.newLine(); split=split+250; System.out.println("split = "+Integer.toString(split)); iLength=iLength-250; System.out.println("iLength = "+Integer.toString(iLength)); System.out.println(""); } bw.write(toFile[2].substring(split)); }else{bw.write(toFile[2]);bw.newLine();} bw.newLine(); I have also tried this while loop which runs through the entire string but still only writes the string to one line: int iLength=toFile[2].length(), start = 0; String temp = toFile[2]; while(iLength&gt;250){ bw.write(temp,start,250); start=start+250; System.out.println("start = "+Integer.toString(start)); iLength=iLength-250; System.out.println("iLength = "+Integer.toString(iLength)); System.out.println(""); }
tagged with: text
type: AnsweredQuestion
tagged with: bufferedwriter
tagged with: java
possible better answer: http://stackoverflow.com/a/25783719
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/40315120
tagged with: string
score: 0

http://stackoverflow.com/a/25868184
downvote count: 0
has comment: http://stackoverflow.com/comment/40480748
has comment: http://stackoverflow.com/comment/40479261
type: Answer
upvote count: 9
accepted answer of: http://stackoverflow.com/q/25867608
answers question: http://stackoverflow.com/q/25867608
has body: According to ejb3-1 specification: 4.9.2 Session Bean Class The following are the requirements for the session bean class: • The class must be defined as public, must not be final, and must not be abstract. The class must be a top level class
score: 9
type: AcceptedAnswer

http://stackoverflow.com/a/25810546
downvote count: 0
type: Answer
has body: You shouldn't be calling table.addRow() from individualTask. You do background tasks in doInBackground and then publish the results. See: http://docs.oracle.com/javase/8/docs/api/javax/swing/SwingWorker.html
answers question: http://stackoverflow.com/q/25810444
score: 4
upvote count: 4

http://stackoverflow.com/q/25836984
answer count: 2
has title: Using processing and getting this error
has answer: http://stackoverflow.com/a/25837492
score: 0
has answer: http://stackoverflow.com/a/25965722
type: UnansweredQuestion
has body: Have this processing basic game I've been working on and I keep getting this "expecting EOF, found 'YoshiXDX'" error. Can anyone spot the error in my code? Am new to this whole processing ordeal and I know I should place all my variables first so that they're in the scope of draw and setup but I guess I must have screwed up elsewhere. Many thanks, /* @pjs preload="peach-castle.jpg","Yoshi.png","Fireball.png"; */ int FireballX, FireballY; int YoshiX, YoshiY; int YoshiXdX, YoshiYdY; YoshiXdX= 5; YoshiYdY = 5; int FireballXdX, FireballYdY; FireballXDX = 8; FireballYdY = 8; Pimage Fireball, background, Yoshi; int randompos; float timeStarted; int FireballPoints, YoshiPoints; FireballPoints = 0; YoshiPoints = 0; boolean spawn1 = true; float distance = dist(FireballX, FireballY, YoshiX, YoshiY); void setup() { size(500, 500); noCursor(); background(0); timeStarted = millis(); Fireball = loadImage("Fireball.png"); Yoshi = loadImage("Yoshi.png"); background = loadImage("peach-castle.jpg"); imageMode(CENTER); //image(background, 0, 0, width, height); } void draw() { long currentTime = millis(); long elapsedTime = (currentTime - timeStarted)/1000; text("# of Yoshi's points: " YoshiPoints, 20, 15); text("# of Fireball's points: " FireballPoints, 20, 30); text("Time played: "+ elapsedTime, 20, 45); if (spawn1 == true){ Respawn(); image(Fireball, FireballX, FireballY); image(Yoshi, YoshiX, YoshiY); spawn1 == false;} Main(); } void Wrapcheck() { if (FireballX&gt; width) { FireballX = FireballX - width; } if (FireballX &lt; 0 ) { FireballX = height+ FireballX ; } if (FireballY &gt; height) { FireballY = FireballY - height; } if (FireballY &lt; 0 ) { FireballY = height - FireballY; } } void Yoshimoves() { if ((FireballX - YoshiX)&gt; 0) { YoshiX -= YoshiXdX; } else if ((FireballX - YoshiX)&lt;0) { YoshiX += YoshiXdX; } else if ((FireballY - YoshiY)&gt;0) { YoshiY += YoshiYdY; } else if ((FireballY - YoshiY)&lt;0) { YoshiY -= YoshiYdY; } } void keyPressed() { if (key == 'w') { Fireb…
has comment: http://stackoverflow.com/comment/40423372
tagged with: processing
tagged with: java
type: Question

http://stackoverflow.com/q/25860502
accepted answer: http://stackoverflow.com/a/25860533
has body: i'm getting StackOverflowError to my recursive call: Exception in thread "main" java.lang.StackOverflowError at Test.trailMngr(Test.java:112) at Test.trailMngr(Test.java:115) at Test.trailMngr(Test.java:115) at Test.trailMngr(Test.java:115) at Test.trailMngr(Test.java:115) ... Java Result: 1 Is there a way to fix this without changing the code? The only way i can think of is making it a non-recursive method. Everything else in the code is working fine in smaller input sizes-- i'll avoid the change if possible (although i'm not hopeful). Not well-familiar with how Java behaves on these things. TIA.
score: 1
linked to: http://stackoverflow.com/q/15460779
tagged with: java
has comment: http://stackoverflow.com/comment/40465817
has comment: http://stackoverflow.com/comment/40465789
upvote count: 1
has comment: http://stackoverflow.com/comment/40465900
has title: StackOverflowError to my recursive calls in Java
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3700459
has comment: http://stackoverflow.com/comment/40466071
answer count: 1
has answer: http://stackoverflow.com/a/25860533
downvote count: 0
tagged with: stack-overflow
tagged with: jvm
favorite count: 0
linked to: http://stackoverflow.com/q/20030120

http://stackoverflow.com/a/25755104
has comment: http://stackoverflow.com/comment/40273872
has comment: http://stackoverflow.com/comment/40273741
type: AcceptedAnswer
downvote count: 0
has body: Problems: Remove all invalid modifiers. That is, change: public float height; public float width; public float length; public float radius; public float degrees; To: float height; float width; float length; float radius; float degrees; Maybe not a direct answer to your question but you need to put your input received option = in.nextInt(); inside the loop. Otherwise you will end up with an infinite loop. For example, if the user chooses '1', option becomes 1 and is never updated inside the loop so your loop will run forever. EDIT: Just to clarify since I see you didn't understand. You don't put int option = in.nextInt(); inside the loop, you put everything but the int. (so option = in.nextInt(); inside the loop). You say int option; outside the loop. So: int option; // created outside the loop do { System.out.print(menu); option = in.nextInt(); // used inside the loop switch(option) { // CASES AND CODE } } while(option != 0); That is why you are getting an error because your variable option isn't visible to the while loop so the loop cannot compare something with 0 if it cannot find it. In general, try not to create anything inside loops, and create outside of them to prevent unnecessary object creation. Another example, your Scanner object should be created outside of your loop. Put the statement Scanner in = new Scanner(System.in); outside the loop then use it with option = in.nextInt(); the way I described above.
type: Answer
has comment: http://stackoverflow.com/comment/40273713
accepted answer of: http://stackoverflow.com/q/25755048
answers question: http://stackoverflow.com/q/25755048
upvote count: 3
has comment: http://stackoverflow.com/comment/40273968
has comment: http://stackoverflow.com/comment/40273779
score: 3
has comment: http://stackoverflow.com/comment/40273842

http://stackoverflow.com/a/25873098
has body: Short answer: No! Long answer: The UML composition just means that the life time of the composite instance is tightly coupled to its superior instance. So there is no constraint which doesn't allow to exchange or modify the composite instance. But kep the difference between aggregation and composition in mind! Aggregation: Supervisor -> Student (If the supervisor quits his job, the sudent may finish his education anyway) Company -> Staff Composition: Building -> Room (If the building gets destroyed, the room is destroyed as well) Company -> Department
has comment: http://stackoverflow.com/comment/40489444
score: 3
has comment: http://stackoverflow.com/comment/40489222
has comment: http://stackoverflow.com/comment/40488928
answers question: http://stackoverflow.com/q/25872973
upvote count: 4
has comment: http://stackoverflow.com/comment/40591078
type: Answer
has comment: http://stackoverflow.com/comment/40488598
has comment: http://stackoverflow.com/comment/40489116
has comment: http://stackoverflow.com/comment/40644446
has comment: http://stackoverflow.com/comment/40580723
downvote count: 1

http://stackoverflow.com/a/25854229
has comment: http://stackoverflow.com/comment/40454456
score: 15
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25853988
has comment: http://stackoverflow.com/comment/40454115
answers question: http://stackoverflow.com/q/25853988
type: Answer
upvote count: 15
has body: First, correcting your terminology: when you say syntax sugar, what you really are asking about is type inference, that when asked to infer a type for j in the inner lambda, that the compiler fails to come up with the right type. Second, correcting your data: The error messages you cite are not coming from the JDK compiler; they're coming from Eclipse. This is just an Eclipse bug. The reference compiler (javac from Oracle JDK) handles your first example just fine.
downvote count: 0
has comment: http://stackoverflow.com/comment/50350535

http://stackoverflow.com/comment/40326718
comment on: http://stackoverflow.com/a/25784588
has text: The OP specifically mentioned that he does not want to re create the Activity.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25769789
has body: I have a service method annotated with @PostAuthorize @PostAuthorize("hasPermission(returnObject, new ReadUserPermission())") public Optional&lt;User&gt; find(String email) { // implementation } As soon as the method gets called, spring throws the following exceptions: Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1003E:(pos 28): A problem occurred whilst attempting to construct an object of type 'ReadUserPermission' using arguments '()' at org.springframework.expression.spel.ast.ConstructorReference.findExecutorForConstructor(ConstructorReference.java:190) ~[spring-expression-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.expression.spel.ast.ConstructorReference.createNewInstance(ConstructorReference.java:151) ~[spring-expression-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.expression.spel.ast.ConstructorReference.getValueInternal(ConstructorReference.java:94) ~[spring-expression-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.expression.spel.ast.MethodReference.getArguments(MethodReference.java:147) ~[spring-expression-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:79) ~[spring-expression-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:113) ~[spring-expression-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:105) ~[spring-expression-4.0.0.RELEASE.jar:4.0.0.RELEASE] at org.springframework.security.access.expression.ExpressionUtils.evaluateAsBoolean(ExpressionUtils.java:11) ~[spring-security-core-3.1.2.RELEASE.jar:3.1.2.RELEASE] ... 86 common frames omitted Caused by: org.springframework.expression.AccessException: Failed to resolve constructor at org.springframework.expression.spel.support.ReflectiveConstructorResolver.resolve(ReflectiveConstructorResolver.java:121) ~[spring-express…
type: Question
has answer: http://stackoverflow.com/a/25785069
tagged with: spring-el
score: 2
has title: Spring expression cannot resolve type
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
accepted answer: http://stackoverflow.com/a/25785069
tagged with: spring
type: AnsweredQuestion
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/40334181
has text: You said, that "nothing happens", once you press the button. Now you say it "just crashes".... does this mean that your first problem ("nothing happens when the button is being pressed") has been solved?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25786077
type: Comment

http://stackoverflow.com/a/25870166
type: Answer
answers question: http://stackoverflow.com/q/25868613
has body: Solved my own problem - it looks like the stop-jetty execution from the maven jetty plugin was causing strange behaviour with exit codes. Removing the stop-jetty execution fixes the error (and my CI will kill Jetty anyway)
score: 0

http://stackoverflow.com/comment/40320912
has text: i dont want to use any logging framework can any one suggest how i can capture using buffered writer bw = new BufferedWriter(new FileWriter(new File(path)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25781140

http://stackoverflow.com/comment/40312037
type: Comment
type: QuestionComment
has text: As I said, call setVisible last, AFTER you've added the panel to the frame
score: 0
comment on: http://stackoverflow.com/q/25775510

http://stackoverflow.com/a/25818494
accepted answer of: http://stackoverflow.com/q/25818488
answers question: http://stackoverflow.com/q/25818488
has body: Do not compare strings with ==, say equals: str1.equals(str2)
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/comment/40236029
has text: That will not be necessary, as I figured out the problem.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25734716
type: Comment

http://stackoverflow.com/comment/40368440
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25807154
has text: @user2138639 `javaw`? are you sure there is nothing call `cache` with that.

http://stackoverflow.com/comment/40201220
comment on: http://stackoverflow.com/q/25716110
has text: Thanks! it's not what's i'm looking for, i have a drawing app, i have colors icons at action bar, and a menu with icons, which i want to keep independent from action bar.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/comment/40226744
comment on: http://stackoverflow.com/a/25729639
score: 0
type: AnswerComment
has text: The type of `a` is known but the type of object being referenced to is not. That's the reason the DMD is made for. Am I not right?
type: Comment

http://stackoverflow.com/comment/40489701
comment on: http://stackoverflow.com/q/25873406
score: 0
type: QuestionComment
type: Comment
has text: @Makoto do you mean redirecting?

http://stackoverflow.com/comment/102693159
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/36548873
has text: It can be anywhere in classpath.

http://stackoverflow.com/a/35322067
score: 3
answers question: http://stackoverflow.com/q/25772908
upvote count: 3
type: Answer
downvote count: 0
has body: I had the same problem with pure git, and this answer helped me: git config core.protectNTFS false

http://stackoverflow.com/q/25758686
has title: My app start automatically after I cancel it
tagged with: alarm
tagged with: service
tagged with: java
has comment: http://stackoverflow.com/comment/40358587
type: Question
accepted answer: http://stackoverflow.com/a/25758900
type: AnsweredQuestion
has body: I design alarm manager with repeated in specific time. But when I cancel it on on click method after seconds(time Interval) service start automatically itself. I want activate service on button click and repeat in interval. and after restaring phone wants to start service too. any Idea? here its my manifest code : <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <action android:name="android.intent.action.BOOT_COMPLETED"/> <service android:name=".AlarmService" /> My AlarmReceiver : public class AlarmReceiver extends BroadcastReceiver { private static final String TAG = "BANANEALARM"; private static final int NOTIFICATION_ID = 1; Intent intent; PendingIntent pendingIntent; NotificationManager notificationManager; @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, "starttt", Toast.LENGTH_LONG).show(); // if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) { Log.d(TAG, "in onreceive"); Intent service1 = new Intent(context, AlarmService.class); context.startService(service1); // } } } My BootCompleteReceiver public class BootCompleteReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if ("android.intent.action.BOOT_COMPLETED".equals(intent.getAction())) { Toast.makeText(context, "Boot", Toast.LENGTH_LONG).show(); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); this.scheduleAlarms(context, calendar); } } private void scheduleAlarms(Context ctxt, Calendar c) { AlarmManager alarManager = (AlarmManager) ctxt.getSystemService(Context.ALARM_SERVICE); Intent i = new Intent(ctxt, AlarmService.class); PendingIntent pi = PendingIntent.getService(ctxt, 0, i, PendingIntent.FLAG_UPDATE_CURRENT); alarManager.setRepeating(AlarmManager.RTC,c.getTimeInMillis(),getInterval(), pi); } private int getIn…
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40357214
has comment: http://stackoverflow.com/comment/40279854
has answer: http://stackoverflow.com/a/25758900
tagged with: android

http://stackoverflow.com/q/25786467
has body: I am having trouble finding the most and least used String in an ArrayList. The program should go through a file of Strings and count how many multiple strings there are in the list. Then print the least and most used name in the list. The ArrayList Part is finished. It is just finding the most and least common name I am having trouble with. I have no idea how to even start with it. I have tried asking but I got it in HashMap form. I kind of tried to figure it out but this is all I could think of. for (int i = 0; i&lt; dogs.size(); i++) if dogs.get(0).getName().equals dogs.get(i).getName(); { dogs.get(i).getName()++; }
score: 0
tagged with: java
answer count: 3
upvote count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/25786564
has comment: http://stackoverflow.com/comment/40330188
has answer: http://stackoverflow.com/a/25787858
tagged with: arraylist
has answer: http://stackoverflow.com/a/25786589
type: AnsweredQuestion
has title: find the most and least used string in an ArrayList (without using Hashmap)
possible better answer: http://stackoverflow.com/a/25786589
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/40329903
has answer: http://stackoverflow.com/a/25786564

http://stackoverflow.com/comment/106038064
has text: image url is broken
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/33800496

http://stackoverflow.com/comment/40478274
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25867369
has text: The hack (`inta - intb`) is never a valid way of sorting integers. The fact that the OP provided no critera does not mean that you should post a subtly broken approach.
type: AnswerComment

http://stackoverflow.com/comment/88522315
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25871646
score: 0
has text: Care should be taken to never call `setItems(...)` or `itemsProperty().set(...)` if you only put the listener on the `ObservableList`. Make sure to call `getItems().setAll(...)` instead.

http://stackoverflow.com/comment/40214667
has text: but i have to use one to one here
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25723646
type: Comment

http://stackoverflow.com/a/25775219
has body: inspect the value of fileNameExtractedFromCSVFile before using it. seems like its not getting populated properly. If you are using an IDE, try to run the code in DEBUG mode and put a break point on this line to see what the value of the variables are.
has comment: http://stackoverflow.com/comment/40310479
score: 0
has comment: http://stackoverflow.com/comment/40310480
answers question: http://stackoverflow.com/q/25775182
type: Answer
has comment: http://stackoverflow.com/comment/40310349

http://stackoverflow.com/comment/40475577
score: 0
comment on: http://stackoverflow.com/a/25865735
type: AnswerComment
type: Comment
has text: thank you for your notice. I have a little confused. 115 seconds.

http://stackoverflow.com/comment/111321891
has text: @GiovanCruz Well, the question was "What is the correct usage of this (the trimDirectiveWhitespaces directive) ?" For removing other white space, a new question should be opened.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/43188063

http://stackoverflow.com/a/25780867
answers question: http://stackoverflow.com/q/25780604
score: 0
has body: Use ASCII,unicode values to replace single quotes.. test = test.replaceAll((char)145,""); otherwise test = test.replaceAll(\u0091,""); for more information http://www.fileformat.info/info/unicode/char/0091/index.htm done enjoy....
type: Answer

eclipse-luna
tags question: http://stackoverflow.com/q/25745578
tag name: eclipse-luna
tags question: http://stackoverflow.com/q/25843149
tags question: http://stackoverflow.com/q/25824902
type: Tag
tags question: http://stackoverflow.com/q/25793526

http://stackoverflow.com/comment/40442900
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25848195
has text: try creating a queue structure
score: 0

http://stackoverflow.com/comment/44452088
type: Comment
comment on: http://stackoverflow.com/a/26146406
type: AnswerComment
has text: This solution is insecure! Anyone could reverse engineer the APK and get your P12 key. Your Google Could Storage account could be compromised. Here is the unanswered Question I posed, since I am looking for a solution too! http://stackoverflow.com/q/28001476/3216207
score: 0

http://stackoverflow.com/comment/40268166
type: QuestionComment
has text: What Oracle server and driver version?
comment on: http://stackoverflow.com/q/25751434
score: 0
type: Comment

http://stackoverflow.com/comment/40351037
type: QuestionComment
comment on: http://stackoverflow.com/q/25796777
score: 0
has text: I've modified my eclipse.ini to increase the amount of memory but the server is still erroring out rather quickly. I know how to increase the memory of a tomcat instance but not a local app engine server instance. I believe that's where the error is occuring.
type: Comment

http://stackoverflow.com/a/25869925
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25869837
has body: You cannot update a local variable X from a static context. static void degitir(String s){ //Only here can be written } public static void main(String[] args) { String X = "ahmet"; System.out.println("X = " + X); degitir(X); // &lt;-- cannot modify the X, it's local to main. System.out.println("X = " + X); } But, you could move X - static void degitir(){ X = "Like so"; } private static String X = "ahmet"; public static void main(String[] args) { System.out.println("X = " + X); degitir(); // &lt;-- can modify the static X. System.out.println("X = " + X); }
downvote count: 0

error-code
tags question: http://stackoverflow.com/q/25730006
tag name: error-code
type: Tag

http://stackoverflow.com/comment/40268147
score: 1
comment on: http://stackoverflow.com/q/25751993
type: Comment
type: QuestionComment
has text: in your example your `main` would be the service ;) ... the layer that makes business logic is. So open your session there.. and close when you finish to call all of your daos..

http://stackoverflow.com/a/25867545
score: 0
type: Answer
has body: I think you need to do something like the following in the printForestInfo method: forestOwner.printOwnerInfo(); ... as your code prints to the console from within that method. The 'out' field of the System class is declared static and public, thus it is "available" globally.
answers question: http://stackoverflow.com/q/25867436

http://stackoverflow.com/comment/40340468
has text: Dude I have done that. As you can see above the first answer has been checked.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25792162
type: Comment

http://stackoverflow.com/a/25858869
answers question: http://stackoverflow.com/q/25858224
score: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/40498585
type: AcceptedAnswer
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/25858224
has body: There are some surefile plugin settings (eg maven-surefire-plugin useFile parameter set to false) that control this, refer to this

http://stackoverflow.com/a/25772753
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/25772669
score: 1
has body: CompareTo will loop over each character in the strings. If the character is bigger/smaller (based on alphabetical order) it will return a positive/negative number. Therefore when string1.compareTo(reverseString)==0 the two strings are the same. (no single letter is smaller/bigger than the one in the other string) Since you didn't provide a recursive implementation its hard to say anything about performance characteristics.

http://stackoverflow.com/q/25731127
answer count: 2
has body: I'm looking to utilize Spring Integration's Resequencer and am trying to create a message store to back it. We're using SQL Server as our DB solution. When looking at the documentation, I don't have a good understanding about what my message store table should (or could) look like: 17.4 JDBC Message Store In the snippet from the documentation below, it looks like there are options with the ":" syntax to insert and/or query on message attributes. &lt;int-jdbc:outbound-gateway update="insert into foos (id, status, name) values (:headers[id], 0, :payload[foo])" request-channel="input" reply-channel="output" data-source="dataSource" /&gt; &lt;int-jdbc:outbound-gateway update="insert into foos (status, name) values (0, :payload[foo])" request-channel="input" reply-channel="output" data-source="dataSource" keys-generated="true"/&gt; So is there a comprehensive list of token names? Is "id" acting as a hash into a headers map? Does it correspond to a message header called "id"? For ":payload[foo]", what is "foo" representing? Are there recommended column types that align with the different message attributes? I'm really looking for guidance on: What my database schema should be? (what are my options) How do I map into and out of this schema in my SI configuration? (i.e., how to tell SI which parts of the message go to what columns)
accepted answer: http://stackoverflow.com/a/25731874
downvote count: 0
favorite count: 0
has title: What is the recommended database schema of a table backing a message store?
possible better answer: http://stackoverflow.com/a/25731892
upvote count: 1
has answer: http://stackoverflow.com/a/25731892
tagged with: spring
type: AnsweredQuestion
tagged with: spring-integration
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25731874
type: Question

http://stackoverflow.com/q/25823582
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/40398324
has answer: http://stackoverflow.com/a/25823623
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40398288
upvote count: 1
has body: Could somebody explain me the differences between these two resource definitions? Why the jar files are excluded but in the second resource included? I don't understand these two declarations: src/main/resources true **/*.jar myDummyPath/war/l10n/*.* src/main/resources false **/*.jar
type: Question
has answer: http://stackoverflow.com/a/25823627
has comment: http://stackoverflow.com/comment/40398258
answer count: 2
has comment: http://stackoverflow.com/comment/40399559
downvote count: 0
has title: What are the differences between these two Maven resource definitions?
favorite count: 0

http://stackoverflow.com/comment/40222065
score: 0
type: Comment
type: QuestionComment
has text: It is the first time using Threads and the Thread.join() was the first option I have found and after making a small example it seemed to work. I will check AsyncTask option, thank you. Still, I will like to know why is not working with Thread.join()?
comment on: http://stackoverflow.com/q/25727011

http://stackoverflow.com/a/25739250
has comment: http://stackoverflow.com/comment/40244514
has comment: http://stackoverflow.com/comment/40244411
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25739102
upvote count: 1
has body: In Activity Bundle bundle=new Bundle(); bundle.putString("name", "From Activity"); //set Fragmentclass Arguments Fragmentclass fragobj=new Fragmentclass(); fragobj.setArguments(bundle); Fragment onCreateView @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String strtext=getArguments().getString("name"); return inflater.inflate(R.layout.fragment, container, false); }
answers question: http://stackoverflow.com/q/25739102
score: 1

http://stackoverflow.com/a/25714959
answers question: http://stackoverflow.com/q/25714919
score: 0
has comment: http://stackoverflow.com/comment/40199416
accepted answer of: http://stackoverflow.com/q/25714919
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40198977
type: Answer
has comment: http://stackoverflow.com/comment/40199204
has comment: http://stackoverflow.com/comment/40199065
has body: You need to serialize an object in order to save it onto the file . here's a tutorial on how to do it, its really simple. When you serialize an object you can write it onto a file and then load it as it is from there . EDIT : example on how you could use this here , i guess the ObjectClass is the thing u want to save so : class ObjectClass implements Serializable { String name; String number; //constructor , setters , getters and w.e functions . public static void main (String args[]){ try{ ObjectClass test = new ObjectClass("test",2); File f = new File("path to file"); ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(f)); out.writeObject(test); // this will write the object as it is onto the file out.close(); }catch(Exception ex){} } } you wont be able to read the data cuz its serialised , but u can load them as objects like so : ObjectInputStream in = new ObjectInputStream(new File("path to file")); ObjectClass test =(ObjectClass) in.readObject(); // u have to cast from Object to Objectclass
has comment: http://stackoverflow.com/comment/40199159

http://stackoverflow.com/a/25736306
downvote count: 0
has body: Yes you can do the same with MongoDB, and Couchbase/CouchDB using proper approach. First of all in MongoDB you have unique index, this will help you to ensure a part of the problem: - http://docs.mongodb.org/manual/tutorial/create-a-unique-index/ You also have some pattern to implement sequence properly: - http://docs.mongodb.org/manual/tutorial/create-an-auto-incrementing-field/ You have many options to implement a cross document/collection transactions, you can find some good information about this on this blog post: http://edgystuff.tumblr.com/post/93523827905/how-to-implement-robust-and-scalable-transactions (the 2 phase commit is documented in detail here: http://docs.mongodb.org/manual/tutorial/perform-two-phase-commits/ ) Since you are talking about Couchbase, you can find some pattern here too: http://docs.couchbase.com/couchbase-devguide-2.5/#providing-transactional-logic
answers question: http://stackoverflow.com/q/25735979
type: Answer
has comment: http://stackoverflow.com/comment/40275970
upvote count: 2
score: 2

http://stackoverflow.com/a/25773380
has comment: http://stackoverflow.com/comment/40308772
has comment: http://stackoverflow.com/comment/40330810
has comment: http://stackoverflow.com/comment/40341059
has comment: http://stackoverflow.com/comment/40306797
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40360137
has comment: http://stackoverflow.com/comment/40342775
has comment: http://stackoverflow.com/comment/40308863
upvote count: 9
has comment: http://stackoverflow.com/comment/40341426
has comment: http://stackoverflow.com/comment/40309572
has comment: http://stackoverflow.com/comment/40309207
has comment: http://stackoverflow.com/comment/40306877
has comment: http://stackoverflow.com/comment/40306919
has comment: http://stackoverflow.com/comment/40306950
type: Answer
has comment: http://stackoverflow.com/comment/40344647
has comment: http://stackoverflow.com/comment/40310876
has comment: http://stackoverflow.com/comment/40309001
has comment: http://stackoverflow.com/comment/40307023
answers question: http://stackoverflow.com/q/25773103
has comment: http://stackoverflow.com/comment/40306880
downvote count: 0
has comment: http://stackoverflow.com/comment/40309575
has comment: http://stackoverflow.com/comment/40309708
has comment: http://stackoverflow.com/comment/40358768
has comment: http://stackoverflow.com/comment/40349646
has comment: http://stackoverflow.com/comment/40309624
accepted answer of: http://stackoverflow.com/q/25773103
score: 9
has comment: http://stackoverflow.com/comment/40309351
has comment: http://stackoverflow.com/comment/40309502
has comment: http://stackoverflow.com/comment/40348406
has comment: http://stackoverflow.com/comment/40306739
has comment: http://stackoverflow.com/comment/40307115
has comment: http://stackoverflow.com/comment/40308609
has body: Calculating just the number of solutions is much less effort than enumerating them all. Lets take the example of S={1,2,3}, and call f(n) the number of solutions for amount n. Then we have: f(n) = 0 if n &lt; 0 f(0) = 1 f(n) = f(n-1) + f(n-2) + f(n-3) if n > 0 (where the numbers 1,2,3 are the elements of S) It is not too difficult to write a program performing these calculations. You could start with the low numbers and work your way up: f(0) = 1 f(1) = 1 f(2) = 2 f(3) = 4 f(4) = 7 f(5) = 13 ... For this specific S it turns out each number is just the sum of the preceding three numbers. How to arrive at this formula? I take again the specific set S={1,2,3} as example, the general case is likewise easy. To count the number of solutions for n look at the first element. It can be 1, 2, or 3. If it is 1, there are f(n-1) ways to arrange the remaining elements. If it is 2 there are f(n-2) ways for the remaining elements and finally if it is 3 there are f(n-3) ways for the remaining elements. The total number must therefore be the sum of the three.

http://stackoverflow.com/q/25798810
has title: Remove jtoolbars floating indicator
tagged with: floating
type: Question
score: 0
answer count: 1
tagged with: indicator
has answer: http://stackoverflow.com/a/25806211
has body: im trying to remove/edit the floating indicator from a jtoolbar while still being able to float the jtoolbar. Unfortunately i cant find the method in the jtoolbarui that creates the border. does anybody know how its called?
tagged with: jtoolbar
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/40314133
score: 0
type: AnswerComment
has text: @Sash_KP...NVM...It did solve my problem...However, I ran into one more problem..and the problem is that my image appear to be cut under the frame..Is there a way so that my image fits the frame instead of cut...
type: Comment
comment on: http://stackoverflow.com/a/25776762

http://stackoverflow.com/q/25793098
type: Question
has answer: http://stackoverflow.com/a/42525299
has answer: http://stackoverflow.com/a/25793191
tagged with: arrays
has comment: http://stackoverflow.com/comment/139824895
has answer: http://stackoverflow.com/a/25793193
score: 35
has title: How to generate random array of ints using Stream API Java 8?
answer count: 4
has body: I am trying to generate random array of integers using new Stream API in Java 8. But I haven't understood this API clearly yet. So I need help. Here is my code. Random random = new Random(); IntStream intStream = random.ints(low, high); int[] array = intStream.limit(limit) // Limit amount of elements .boxed() // cast to Integer .toArray(); But this code returns array of objects. What is wrong with it?
favorite count: 0
linked to: http://stackoverflow.com/q/73031937
tagged with: java-8
has answer: http://stackoverflow.com/a/44495458
type: AnsweredQuestion
upvote count: 35
linked to: http://stackoverflow.com/q/20266422
downvote count: 0
tagged with: java-stream
accepted answer: http://stackoverflow.com/a/25793191
tagged with: java
possible better answer: http://stackoverflow.com/a/44495458

http://stackoverflow.com/comment/40200383
type: Comment
comment on: http://stackoverflow.com/a/25715922
score: 0
has text: Thank you :) I've never dealt with c++ but I guess this scenario hasn't crossed my mind
type: AnswerComment

http://stackoverflow.com/comment/40198271
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25714689
has text: I calculated you couldnt reach more than 743
score: 0

http://stackoverflow.com/comment/40368561
type: QuestionComment
has text: What is the primary key? and what is the generation strategy for it?
comment on: http://stackoverflow.com/q/25807418
score: 0
type: Comment

http://stackoverflow.com/a/25718403
has body: You try to put in the map as a value string but you map expect as a value AllItem, so you must modify your code in this way: for(AllItem cn : allItems) { String item_name = cn.getItem_name(); all_Items.put(item_name , cn ); } This code will add your class object to the map with the key which equals to your object name.
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25718340
type: Answer

http://stackoverflow.com/a/25726053
score: 4
has comment: http://stackoverflow.com/comment/40219777
upvote count: 4
has body: How we can change the jtable column , on the selection of the checkbox .Suppose i have two checkbox date, age and on the selection of date the jtable must show column date and on the selection of age it must show age . JTable has interface to TableColumnModel. Add an ItemListener or ActionListener to JCheckBox. On SELECTED event from ItemListener call JTable#addColumn(), on DESELECTED event call JTable#removeColumn() Colums are removed only from table's view, value is still present in the TableModel
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25725871
type: Answer
answers question: http://stackoverflow.com/q/25725871

http://stackoverflow.com/comment/40437564
has text: The App just freezes. Not valuable information in the logcat
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25844862

http://stackoverflow.com/a/36594351
score: 8
upvote count: 9
answers question: http://stackoverflow.com/q/25784050
has body: Why you don't use java.util.Optional if you are using Java 1.8. To take your later example, you can avert a 400 response with put a Optional&lt;String&gt; instead of String representing your eventualy path like this: @RequestMapping(method=RequestMethod.GET, value={"/campaigns","/campaigns/{id}"}) @ResponseBody public String getCampaignDetails( @PathVariable("id") Optional&lt;String&gt; id) { if(id.isPresent()){ model.addAttribute("id", id.get());//id.get() return your String path } }
type: AcceptedAnswer
type: Answer
downvote count: 1
accepted answer of: http://stackoverflow.com/q/25784050

http://stackoverflow.com/comment/40254721
has text: The correct thing to do to maintain decoupling would be to get the upstream people using queues for priorities to use the built-in JMS priorities , then you would not have to change a thing. There is no reason to split up queues based on priority.
comment on: http://stackoverflow.com/q/25742914
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40416760
type: Comment
has text: @ShirgillAnsari I wrote that it's *free* memory! The whole area including garbage gets overwritten when memory gets allocated. You clean up the landfill and can build a house or whatever on the area. This sounds unreal, but the garbage is nothing but free memory.
comment on: http://stackoverflow.com/a/25830727
score: 0
type: AnswerComment

http://stackoverflow.com/q/25722453
type: Question
has answer: http://stackoverflow.com/a/25723436
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/25722631
has title: Java renaming files in directory doesn't work properly
has answer: http://stackoverflow.com/a/25723585
upvote count: 1
has comment: http://stackoverflow.com/comment/40212517
has answer: http://stackoverflow.com/a/25722631
favorite count: 0
has body: I am trying to rename to upper case all the files in a given directory. It does the whole thing but it doesn't do anything in the folder file names are still the same . import java.io.File; import java.io.IOException; public class FileOps { public static void main(String[] argv) throws IOException { File folder = new File( "C:\\Users\\N\\Desktop\\New folder\\RenamingFiles\\src\\renaming\\Files"); File[] listOfFiles = folder.listFiles(); for (int i = 0; i &lt; listOfFiles.length; i++) { if (listOfFiles[i].isFile()) { File f = new File( "C:\\Users\\N\\Desktop\\New folder\\RenamingFiles\\src\\renaming\\Files" + listOfFiles[i].getName()); f.renameTo(new File( "C:\\Users\\N\\Desktop\\New folder\\RenamingFiles\\src\\renaming\\Files" + listOfFiles[i].getName().toUpperCase() + ".txt")); } } System.out.println("Done"); } } It prints "Done" in the console but nothing is really done
answer count: 3
tagged with: file-io
linked to: http://stackoverflow.com/q/17895557
has comment: http://stackoverflow.com/comment/40212610
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/40212545
possible better answer: http://stackoverflow.com/a/25723436

ternary-operator
tags question: http://stackoverflow.com/q/25799249
tag name: ternary-operator
tags question: http://stackoverflow.com/q/25801706
type: Tag

http://stackoverflow.com/a/25723413
score: 4
has comment: http://stackoverflow.com/comment/40216175
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40216807
type: Answer
has comment: http://stackoverflow.com/comment/40217049
has comment: http://stackoverflow.com/comment/40218013
accepted answer of: http://stackoverflow.com/q/25723331
has body: @Override public void onUserInteraction() { // TODO Auto-generated method stub super.onUserInteraction(); new Handler().postDelayed(new Runnable() { @Override public void run() { // TODO Auto-generated method stub View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN|View.SYSTEM_UI_FLAG_HIDE_NAVIGATION ; decorView.setSystemUiVisibility(uiOptions); // Remember that you should never show the action bar if the // status bar is hidden, so hide that too if necessary. ActionBar actionBar = getActionBar(); actionBar.hide(); } }, 1000); } //--------------------------------------------------- //add following code View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); // Remember that you should never show the action bar if the // status bar is hidden, so hide that too if necessary. ActionBar actionBar = getActionBar(); actionBar.hide(); //------------------------------- View decorView = getWindow().getDecorView(); // Hide both the navigation bar and the status bar. // SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as // a general rule, you should design your app to hide the status bar whenever you // hide the navigation bar. int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions);
answers question: http://stackoverflow.com/q/25723331

http://stackoverflow.com/q/25806313
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40368938
type: Question
has answer: http://stackoverflow.com/a/25806530
accepted answer: http://stackoverflow.com/a/25806530
has title: Not able to execute the query in java
score: 0
has comment: http://stackoverflow.com/comment/40366324
has comment: http://stackoverflow.com/comment/40366561
tagged with: sql
answer count: 1
has body: I'm executing the query, SELECT UNIQUE PXCID,SNCID,FREQUENCY FROM AFFECTEDXCS WHERE PTPNAME IN ('AM2125A-1-14-LINEIN','AM2125A-1-15-LINEOUT','CWR-7-14-CLS2') AND FREQUENCY='9170' and NENAME='CP0MP1-121-N2-SITE3' ORDER BY SNCID; from SQL Developer, it gives me row of value? Same query i'm trying to execute it from java with the code. String query = DBStatements.PXCID_LIST; Object[] param = new Object[3]; param[0]="AM2125A-1-14-LINEIN,AM2125A-1-15-LINEOUT,CWR-7-14-CLS2"; param[1]=frequency; param[2]=nodelabel; List&lt;Map&lt;String,Object&gt;&gt; returnList = eqmqueryexec.executeQuery(EQMDataSource.OTN, "0", query, param); Iterator&lt;Map&lt;String,Object&gt;&gt; iter = returnList.iterator(); logger.debug("iterator bolean length"+iter.hasNext()); I'm getting the "iterator bolean length" as false. That's means the query as not executed properly?

http://stackoverflow.com/q/25811129
score: 2
has comment: http://stackoverflow.com/comment/40377793
tagged with: connection-pooling
linked to: http://stackoverflow.com/q/16932846
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40375448
has answer: http://stackoverflow.com/a/26169758
has title: Tomcat using c3p0 Datasource, maxPoolSize exceeded
type: Question
has comment: http://stackoverflow.com/comment/40375359
linked to: http://stackoverflow.com/q/13942540
tagged with: datasource
upvote count: 2
answer count: 1
tagged with: c3p0
tagged with: tomcat
has comment: http://stackoverflow.com/comment/40374944
favorite count: 0
type: UnansweredQuestion
has body: I have configured Tomcat to use a ComboPooledDataSource, by adding the following in my context.xml. &lt;Resource name="jdbc/abcdatasource" auth="Container" type="com.mchange.v2.c3p0.ComboPooledDataSource" factory="org.apache.naming.factory.BeanFactory" maxPoolSize="20" minPoolSize="5" maxIdleTime="3000" acquireIncrement="1" user="abc" password="pw_here" driverClass="oracle.jdbc.driver.OracleDriver" jdbcUrl="jdbc:oracle:thin:@abc.def.ghi.net:1521:BLAH" /&gt; I want to limit the db connections to 20, as defined in the maxPoolSize, but my open connections are exceeding this number. Yesterday, for example, I had 35 open connections. My logs are capturing the following. 2014-09-11 00:37:47,077 INFO [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] NewPooledConnection:725 - - [c3p0] Exceptions occurred while trying to close a PooledConnection's resources normally. 2014-09-11 00:37:47,077 INFO [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#2] NewPooledConnection:735 - - [c3p0] NewPooledConnection close Exception. java.sql.SQLException: Io exception: Connection timed out at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:146) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:255) at oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:481) at oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:1203) at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:549) at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470) at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964) at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.ja…

io
tags question: http://stackoverflow.com/q/25778839
tags question: http://stackoverflow.com/q/25830046
tag name: io
tags question: http://stackoverflow.com/q/25746207
tags question: http://stackoverflow.com/q/25827173
type: Tag
tags question: http://stackoverflow.com/q/25770561
tags question: http://stackoverflow.com/q/25774920
tags question: http://stackoverflow.com/q/25742248
tags question: http://stackoverflow.com/q/25788992
tags question: http://stackoverflow.com/q/25829716
tags question: http://stackoverflow.com/q/25726174

http://stackoverflow.com/a/25858207
has comment: http://stackoverflow.com/comment/40484035
score: 0
answers question: http://stackoverflow.com/q/25840262
has body: The reason you are getting the 401 is the Authorization header needs a scheme prefix, in your case Basic So currently you are sending Authorization: &lt;base64(username:password)&gt; But the web server expects Authorization: Basic &lt;base64(username:password)&gt; as described here this change should work: conn.setRequestProperty("Authorization", "Basic " + userNamePassword);
type: Answer

http://stackoverflow.com/q/25787499
answer count: 0
tagged with: java
tagged with: swt
type: Question
has body: I have researched for several hours with no luck. I know that I can implement the same functionality with a context menu but I wanted to ask if it is possible. (This is an eclipse plugin using jface and swt components, eclipse luna, openjdk 7) This is what I try to accomplish: In ctabfolder ctf, I have several ctabitems ctis. Each cti has a treeviewer. I want to allow the user to drag any branch of a treeviewer and drop it in another treeviewer that is in another cti. I was hoping to determine where the cursor is on the ctf while dragging but no events are delivered after dragging started. The following bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=328396 states that is fixed. Thanks a lot!!
has title: MouseMove Events not delivered while dragging from TreeViewer (SWT/Mac 10.6.8)
score: 0
has comment: http://stackoverflow.com/comment/40347796
has comment: http://stackoverflow.com/comment/40341741
type: UnansweredQuestion
tagged with: jface

http://stackoverflow.com/comment/40231751
type: QuestionComment
has text: Yes... there's Java 8 ! Are you using it or no ?
score: 0
comment on: http://stackoverflow.com/q/25732649
type: Comment

http://stackoverflow.com/q/25853333
has title: How can I use WebDriverWait for various methods in Selenium JUnit?
has answer: http://stackoverflow.com/a/25865036
type: UnansweredQuestion
downvote count: 2
tagged with: selenium
upvote count: 1
linked to: http://stackoverflow.com/q/2543912
type: Question
tagged with: junit4
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/20903231
has body: I have various methods in my code in which I need to use WebDriverWait. Usually we declare it in the main method like: WebDriverWait mywait = new WebDriverWait(driver, 25) While using JUnit in Selenium, there isn't any main method. How can I use WebDriverWait for webelements in various methods in my code?
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/40254557
comment on: http://stackoverflow.com/a/25744064
score: 0
type: AnswerComment
has text: But i am not able to view the request page itself (i.e) index.html
type: Comment

http://stackoverflow.com/comment/40343850
type: AnswerComment
score: 0
type: Comment
has text: I'm not sure how exactly to go about this. `if (currentType instanceof Number){` Doesn't recognize `int` or `Integer`. Additionally `else if (currentType instanceof String) {` Won't even compile as it give me a compiler error. Can you elaborate or point me in the direction of some documentation to help me better understand?
comment on: http://stackoverflow.com/a/25793650

http://stackoverflow.com/comment/40425421
score: 0
has text: What language are you using?
type: QuestionComment
comment on: http://stackoverflow.com/q/25838341
type: Comment

http://stackoverflow.com/comment/40412800
has text: I guess now you liked it.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25831611
score: 0

http://stackoverflow.com/q/25775182
has comment: http://stackoverflow.com/comment/40328522
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40310261
has comment: http://stackoverflow.com/comment/40310530
has answer: http://stackoverflow.com/a/25787068
type: Question
has title: Adding an ImageIcon to a JPanel using a variable as the file path
has comment: http://stackoverflow.com/comment/40310369
has comment: http://stackoverflow.com/comment/40311167
answer count: 2
tagged with: imageicon
has body: I have a csv file containing the file names of all my images. I want to extract the file names from that file and use them to add the corresponding image to my GUI. I have a lot of images so I can't just type out all the file paths. It works if I use img = new ImageIcon("resources/imagename.jpg"); but not if I use String fileName = "resources/" + fileNameExtractedFromCSVFile; img = new ImageIcon(fileName); It's extracting the file name just fine, it just won't use it to locate the image. I would appreciate any help.
upvote count: 1
tagged with: user-interface
has answer: http://stackoverflow.com/a/25775219
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40310272
tagged with: embedded-resource
tagged with: swing

http://stackoverflow.com/comment/40436217
score: 0
type: AnswerComment
type: Comment
has text: AppPreferences appPref; appPref = new AppPreferences(getApplicationContext(), "PREFS"); if(appPref.getData("state").equals("true")) { //set ur switch button to checked state } else if(appPref.getData("state").equals("false")) { //set ur switch button to unchecked state } and in you listener chage the preference accordingly
comment on: http://stackoverflow.com/a/25843684

http://stackoverflow.com/comment/40202435
score: 1
has text: If you look carefully, instance of a concrete implementation of Enumeration is retrieved at line: `this.files = files.elements();` the elements() method of Vector return Enumeration which has the "hasMoreElements" method.
comment on: http://stackoverflow.com/q/25717053
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40276102
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25756453
type: Comment
has text: I thought this was formatted just fine

http://stackoverflow.com/comment/40369546
comment on: http://stackoverflow.com/q/25808133
has text: Already I tried with SwingWorker also.But,It results same.That's why I asked question again.Thank you for reply.Please try it.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40289499
score: 0
type: AnswerComment
has text: No pb with $ADMIN_HOME. All properties are loaded. The pb is for config test file. I succeed to execute my test if i set ignore-unresolvable = true in my applicationContext-test.xml. But i don't understand why, and if it is the good thing to do.
type: Comment
comment on: http://stackoverflow.com/a/25760747

http://stackoverflow.com/comment/40391389
score: 0
has text: @fish748 As long as other threads are accessing that instance and not the old instance, which is your basic concurrency issue. However you implement, their needs to be a semaphore or something to lock and release so that other operations are not trying to "queue" to the same thing that is "draining".
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25804383

http://stackoverflow.com/comment/40217203
score: 1
comment on: http://stackoverflow.com/a/25724467
type: AnswerComment
has text: so basically, if my web app is deployed on tomcat. and I have MySQL, then I don't really need to worry if two people access the app at the very same instant (and assuming both of them are changing the same value in database).
type: Comment

http://stackoverflow.com/q/25721664
has comment: http://stackoverflow.com/comment/40245781
linked to: http://stackoverflow.com/q/2770877
tagged with: jdbc
has answer: http://stackoverflow.com/a/25763093
linked to: http://stackoverflow.com/q/10946849
has comment: http://stackoverflow.com/comment/40231653
type: AnsweredQuestion
has title: Blob information modified when retrieving image from DB using plain JDBC
score: 0
linked to: http://stackoverflow.com/q/18311648
type: Question
tagged with: blob
linked to: http://stackoverflow.com/q/8112197
tagged with: java
tagged with: db2
accepted answer: http://stackoverflow.com/a/25763093
tagged with: image-processing
has body: I am working on a small POC (which will be integrated into a bigger application) which consists of Problem Context reading an image in a simple java application program, Convert image into a byte array byte[] imageEncodedBytes = baos.toByteArray() storing it into a remote DB2 database (technology used was not imp, so I am using plain jdbc for now) Reading it back from the DB and converting it back to ensure that the re-creation of the image works. ( I am able to open the new re-created image in any image viewer) Issues The issues occur at step 5. I read the image using a select query into a Result Set. use the rs.getBlob("ColumnName") to get the blob value. Fetch the byte array from the blob value using byte[] decodedArray = myBlob.getBytes(1, (int)myBlob.length()) Create the image from the obtained byte array. At Step 3 the byte array decodedArray obtained from the blob differs from the byte array 'imageEncodedBytes' that I get when I read the image. As a consequence, the following code to create the image from the byte array decodedArray fails. ByteArrayInputStream bais = new ByteArrayInputStream(decodedArray); //Writing to image BufferedImage imag=ImageIO.read(bais); // Line of failure. No registered provider able to read bais ImageIO.write(imag, "jpg", new File(dirName,"snap.jpg")); References and Other data for issue investigation I have referred the following links for verification 1. Inserting image in DB2 2. This Link here offers insight, but yet I was not able to determine, how to register the ImageReader. 4. When inserting the image to DB2 I am using - the following query Statement st = conn.createStatement(); st.executeUpdate("INSERT INTO PHOTO (ID,PHOTO_NM,PHOTO_IM, THMBNL_IM) " + "VALUES (1,'blob("+bl+")',blob('"+bl+"')") As an alternative to fetching blob value from the result set I have also used binaryStream = rs.getBinaryStream("PHOTO_IM") to get the binary stream and then get byte array from the binary stream. even in this case, the decodedArray is…
answer count: 1

http://stackoverflow.com/q/25753525
has answer: http://stackoverflow.com/a/25754063
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/25753874
downvote count: 0
has comment: http://stackoverflow.com/comment/40271126
linked to: http://stackoverflow.com/q/13275525
favorite count: 0
possible better answer: http://stackoverflow.com/a/25753874
answer count: 3
has title: Parsing a Java class for replace
has answer: http://stackoverflow.com/a/25753774
tagged with: parsing
accepted answer: http://stackoverflow.com/a/25753774
has body: I must replace all off e.printStackTrace(); with logger. But there are about 2000 class. I can replace all in Eclipse but I have to define Logger for all class. Is there any solutions that you advice?
has comment: http://stackoverflow.com/comment/40271406
has comment: http://stackoverflow.com/comment/40271277
upvote count: 1

http://stackoverflow.com/a/25733675
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/25733427
has body: Just put a simple comment at the top of the java file. //Author: Your name //Date: mm/dd/yyy //Anything else: .f,lroifje
has comment: http://stackoverflow.com/comment/40235793
type: Answer
answers question: http://stackoverflow.com/q/25733427
has comment: http://stackoverflow.com/comment/40234387

http://stackoverflow.com/q/25775570
has answer: http://stackoverflow.com/a/25775630
tagged with: ssl-certificate
answer count: 1
downvote count: 0
has title: Java SSL certificate import
favorite count: 0
has body: When does one have to import the cert to the truststore ? Recently I tested an SSL connection to a server whose cert was signed by COMODO and the connection went through without having to import to truststore.
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/comment/40324100
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25782163
has text: I still didn't get what the problem in modifying it,, please elaborate

http://stackoverflow.com/q/25788174
has body: I'm pretty new to Java and I have a problem and I can't seem to find the answer to it. I'm trying to find out if the language I pass exists in my list. String lang = "fr, de, gb, nl, se, es"; List&lt;String&gt; result = new ArrayList&lt;String&gt;(); String[] languages = lang.split(","); result = Arrays.asList(languages); if (result.contains("de")) { return true; } else { System.exit(0); } And this returns false, i can't understand why.
has answer: http://stackoverflow.com/a/25788263
has answer: http://stackoverflow.com/a/25788549
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/25788549
accepted answer: http://stackoverflow.com/a/25788232
has comment: http://stackoverflow.com/comment/40332794
answer count: 7
has comment: http://stackoverflow.com/comment/40332900
has title: Some troubles with Java ArrayList.contains()
has answer: http://stackoverflow.com/a/25788256
has answer: http://stackoverflow.com/a/25788216
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25788206
tagged with: java
has answer: http://stackoverflow.com/a/25788232
has answer: http://stackoverflow.com/a/25788234
type: Question

http://stackoverflow.com/comment/40317437
has text: You've posted over 100 lines of code, but failed to say what the actual problem is. "For some reason it is having trouble allowing me to do an if statement for the random number" just tells us that you *have* a problem, not what the problem *is*. Please focus on making your question clearer, and provide a *short* but complete program demonstrating the problem. (The answer is to use ==, as Kostronor says - but you should pay attention to the art of writing a good question too.)
type: QuestionComment
type: Comment
score: 3
comment on: http://stackoverflow.com/q/25779208

http://stackoverflow.com/a/39569252
has body: Non-regex solution, just in case someone is more comfortable (?) not using regular expressions: private String justify(String s, int limit) { StringBuilder justifiedText = new StringBuilder(); StringBuilder justifiedLine = new StringBuilder(); String[] words = s.split(" "); for (int i = 0; i &lt; words.length; i++) { justifiedLine.append(words[i]).append(" "); if (i+1 == words.length || justifiedLine.length() + words[i+1].length() &gt; limit) { justifiedLine.deleteCharAt(justifiedLine.length() - 1); justifiedText.append(justifiedLine.toString()).append(System.lineSeparator()); justifiedLine = new StringBuilder(); } } return justifiedText.toString(); } Test: String text = "Long sentence with spaces, and punctuation too. And supercalifragilisticexpialidocious words. No carriage returns, tho -- since it would seem weird to count the words in a new line as part of the previous paragraph's length."; System.out.println(justify(text, 15)); Output: Long sentence with spaces, and punctuation too. And supercalifragilisticexpialidocious words. No carriage returns, tho -- since it would seem weird to count the words in a new line as part of the previous paragraph's length. It takes into account words that are longer than the set limit, so it doesn't skip them (unlike the regex version which just stops processing when it finds supercalifragilisticexpialidosus). PS: The comment about all input words being expected to be shorter than the set limit, was made after I came up with this solution ;)
score: 4
has comment: http://stackoverflow.com/comment/66838684
upvote count: 4
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25853393

http://stackoverflow.com/comment/40342089
type: QuestionComment
has text: side note: it's actually pretty dangerous to use `float` or `double` for money in most languages, including Java. these data types are prone to floating-point double rounding errors during division, and the errors are worse with bigger numbers (more money == more erratic math). it's recommended to store the money as cents rather than dollars, in a `long int`.
score: 1
comment on: http://stackoverflow.com/q/25792594
type: Comment

http://stackoverflow.com/comment/40320919
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25781054
has text: Check this. Looks similar. http://stackoverflow.com/questions/20250789/dynamically-change-the-number-of-nested-for-loops
score: 3

http://stackoverflow.com/comment/40462175
comment on: http://stackoverflow.com/q/25858487
score: 0
type: Comment
type: QuestionComment
has text: You pass the instance of B to the constructor of C. Can you post some code?

http://stackoverflow.com/a/47844026
has comment: http://stackoverflow.com/comment/82652396
has comment: http://stackoverflow.com/comment/82655713
has body: stmt.execute("insert into \"user\" values ( 'MyName' )"); stmt.execute("shutdown");
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25745532

http://stackoverflow.com/q/25866741
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/25888372
has answer: http://stackoverflow.com/a/25875378
type: UnansweredQuestion
tagged with: gridgain
has body: I've created a messaging system using GridGain for implementation. I have a MessageCenter class that is composed of a GridGain GridProjection,my setup looks like something like this Gateway-&gt; MessageCenter-&gt; GridProjection Now when I start up the gateway which in turn startup the grid, starting up another gateway I get serialization errors because GridGain is trying to serialize the Gateway, MessageCenter and all their dependencies which forces me to mark everything as Serializable. I don't understand why GridGain is trying to serialize its parent classes which should have nothing to do with the grid and is their a way to turn it off?
type: Question
answer count: 2
has title: GridGain Serialization issues

ejbca
type: Tag
tags question: http://stackoverflow.com/q/25806469
tag name: ejbca

http://stackoverflow.com/comment/40329274
type: QuestionComment
comment on: http://stackoverflow.com/q/25785724
has text: So if I understand correctly you want to store an html page to memory, and then parse out all the hrefs in it?
score: 0
type: Comment

http://stackoverflow.com/q/25808175
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/25808394
favorite count: 0
tagged with: android-framelayout
upvote count: 1
tagged with: fragment
type: AnsweredQuestion
tagged with: performance
accepted answer: http://stackoverflow.com/a/25808394
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40369504
type: Question
has body: I am creating an Android app right now and I have a Frame which shell contain fragments. Till now all works fine, but I have come to a question which I cannot fully understand. I have a Frame which is the entire screen (FrameLayout - should i use a FrameLayout as the main Frame?) and inside this Frame there are fragments that change, depending on the users interaction. These fragments are in the .xml files FrameLayouts. I am wondering now whether they can or should be FrameLayouts or fragments... I created a Google Maps frgment which is a fragment ideed and that made me thinking. So my question ist: Does it make a difference or has it any impact on the perfomance or can I simple use whatever serves it's purpose? To show what I mean, here are some code samples: (Inside the FrameLayout inside the Framelayout are all fragments put) MainFrame (activity_main.xml): <ImageButton android:id = "@+id/bottomButton_home" android:layout_height = "match_parent" android:layout_width = "0dp" android:layout_weight = "1.0" android:layout_marginLeft = "2dp" android:layout_marginRight = "2dp" android:background = "@drawable/ic_home_white" android:onClick = "openHome" /> [...] <ImageView android:id= "@+id/TopBarLogo" android:layout_width = "@dimen/top_Bar_Hight" android:layout_height = "@dimen/top_Bar_Hight" android:background="@drawable/ic_launcher" /> [...] One Fragment (FrameLayout:) <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="50dp" android:textSize="100sp" android:text="Home" /> Another Frament (fragment) <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/map" tools:context="com.domain.app.MapsActivity" android:name="com.google.android.gms.maps.MapFragment" tools:layout = "@layout/activity_main" /> Is too hae problems with the GoogleMaps implementation but I have not…
downvote count: 0
has title: Android Fragments: fragments inside a Frame or other layouts?

http://stackoverflow.com/q/25769531
tagged with: jersey
downvote count: 0
tagged with: servlets
has body: I am using Java/REST/Jersey webservice. I have a users service, ..../rest/users/get/username ..../rest/users/get/all ... I also want to do other things, like sports .../rest/sports/get/sport .../rest/sports/play.. I know I can map users to rest1 servlet and sports to rest2 servlet, in fact its what I have now. But, Is there a way to do both things (users and sports &amp; ...) all in one servlet? I just don't like the fact that I will have rest1,rest2,rest3,rest4... ..../rest/users/get/username ..../rest/sports/play ...
answer count: 1
favorite count: 0
has title: How to do multiple of operations in Java Webservice
tagged with: rest
has answer: http://stackoverflow.com/a/25794969
upvote count: 1
tagged with: web-services
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25794969

http://stackoverflow.com/comment/40248760
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25741822
type: AnswerComment
has text: Nope. JNI loading internally uses java.io.

http://stackoverflow.com/comment/40431924
comment on: http://stackoverflow.com/q/25840803
score: 0
type: QuestionComment
type: Comment
has text: Apache poi is always nice. Does it have to be doc or can it be odt?

http://stackoverflow.com/comment/40234940
comment on: http://stackoverflow.com/a/25733920
score: 0
type: Comment
has text: I know how to align the text view. but how can i programatically. load the listview with arrays that updates both textview.
type: AnswerComment

http://stackoverflow.com/comment/40701532
has text: Thank you for your comments. Ah I didn't realize the `login-config` element was required, but it does make sense now. I think I can get it to work by adding `login-config` and updating my deployment descriptors. I think it wouldn't be too hard to port your example to JBoss/WildFly (for example see [this](http://wildfly.org/news/2014/02/06/GlassFish-to-WildFly-migration/)). I will update here when I implemented a fully functional role-based security system for my Web application.
comment on: http://stackoverflow.com/a/25958049
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25757034
downvote count: 0
possible better answer: http://stackoverflow.com/a/49496144
favorite count: 0
has answer: http://stackoverflow.com/a/49496144
has answer: http://stackoverflow.com/a/38074646
has comment: http://stackoverflow.com/comment/40277152
has body: I am novice to Java or Selenium. I just need help to understand one basic question. Why we assign firefoxdriver instance to WebDriver? WebDriver driver=new FirefoxDriver() I know that this is kind of Late binding in Java, because we can assign IEDriver or some other instance to WebDriver at later point of time. Question1: But this applices to classes, right? Question2: WebDriver is an interface, then can we create an object instance of an interface?
accepted answer: http://stackoverflow.com/a/30605893
tagged with: selenium-webdriver
type: AnsweredQuestion
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/62388674
has comment: http://stackoverflow.com/comment/40277093
has answer: http://stackoverflow.com/a/25758025
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/25757104
has answer: http://stackoverflow.com/a/50907026
has title: why we assign firefoxdriver instance to webdriver
score: 4
has comment: http://stackoverflow.com/comment/40277166
upvote count: 4
has answer: http://stackoverflow.com/a/30605893
has answer: http://stackoverflow.com/a/46030837

http://stackoverflow.com/a/25779887
has body: You can simply use an ArrayList if you want to store your results first: Create one at the beginning: List myList = new ArrayList(); and store the value in this list instead of your new array: myList.add(intArray[i]); at the end you can get an array from the ArrayList if you want: return myList.toArray();
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25779818
downvote count: 0

http://stackoverflow.com/q/25755953
favorite count: 0
has title: JSTL/EL: Converting newline characters to tags
has body: I have a jsp page in which I am trying to print some DTOs from a list using their toString() method. Currently, my code looks like this: &lt;c:forEach items="${sessionScope.users}" var="user"&gt; &lt;li&gt;&lt;input type="radio" name="users" value="user"&gt; &lt;c:out value="${user}"/&gt; &lt;/input&gt;&lt;/li&gt; &lt;/c:forEach&gt; The problem is that toString() contains \n instead of &lt;br&gt; for newlines. (I even tried to hard-code the &lt;br&gt; tags, but they were printed as literals.) I am sure this would be much easier using scriptlets, but the powers that be don't want to see any Java code in our view. Has anyone successfully done this?
tagged with: el
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25758938
type: Question
tagged with: jstl
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/25758938
tagged with: jsp

http://stackoverflow.com/q/25797650
linked to: http://stackoverflow.com/q/1264709
downvote count: 0
tagged with: jax-rs
has answer: http://stackoverflow.com/a/25889454
has comment: http://stackoverflow.com/comment/58278601
has answer: http://stackoverflow.com/a/25913330
favorite count: 0
tagged with: rest
type: UnansweredQuestion
has body: I try to do file upload from a JavaScript client to a JAX-RS Java server. I use the following REST upload function on my server: @POST @Produces('application/json') UploadDto upload( @Context HttpServletRequest request, @QueryParam("cookie") String cookie) { def contentType byte [] fileBytes log.debug "upload - cookie: "+cookie try{ if (request instanceof MultipartHttpServletRequest) { log.debug "request instanceof MultipartHttpServletRequest" MultipartHttpServletRequest myrequest = request CommonsMultipartFile file = (CommonsMultipartFile) myrequest.getFile('file') fileBytes = file.bytes contentType = file.contentType log.debug "&gt;&gt;&gt;&gt;&gt; upload size of the file in byte: "+ file.size } else if (request instanceof SecurityContextHolderAwareRequestWrapper) { log.debug "request instanceof SecurityContextHolderAwareRequestWrapper" SecurityContextHolderAwareRequestWrapper myrequest = request //get uploaded file's inputStream InputStream inputStream = myrequest.inputStream fileBytes = IOUtils.toByteArray(inputStream); contentType = myrequest.getHeader("Content-Type") log.debug "&gt;&gt;&gt;&gt;&gt; upload size of the file in byte: "+ fileBytes.size() } else { log.error "request is not a MultipartHttpServletRequest or SecurityContextHolderAwareRequestWrapper" println "request: "+request.class } } catch (IOException e) { log.error("upload() failed to save file error: ", e) } } On the client side I send the file as follows: var str2ab_blobreader = function(str, callback) { var blob; BlobBuilder = window.MozBlobBuilder || window.WebKitBlobBuilder || window.BlobBuilder; if (typeof (BlobBuilder) !== 'undefined') { var bb = new BlobBuilder(); bb.append(str); blob = bb.getBlob(); } else { blob = new Blob([ str ]); } var f = new FileReader(); f.onload = function(e) { callback(e.target.result) } f.readAsArrayBuffer(blob); } var fileName = "fileName.jpg"; var contentType = "image/jpeg"; if (file.type.toString().toLowerCase().indexOf("png") &gt; -1) { fileName = "fileName…
upvote count: 31
has answer: http://stackoverflow.com/a/63104120
tagged with: java
has answer: http://stackoverflow.com/a/25818465
type: Question
score: 31
tagged with: jersey
has answer: http://stackoverflow.com/a/66588928
answer count: 6
has answer: http://stackoverflow.com/a/25927379
tagged with: grails
has title: FileUpload with JAX-RS

javafx-8
tags question: http://stackoverflow.com/q/25809412
tags question: http://stackoverflow.com/q/25761399
tags question: http://stackoverflow.com/q/25740177
tag name: javafx-8
tags question: http://stackoverflow.com/q/25751692
tags question: http://stackoverflow.com/q/25865454
tags question: http://stackoverflow.com/q/25745775
tags question: http://stackoverflow.com/q/25733847
tags question: http://stackoverflow.com/q/25742121
tags question: http://stackoverflow.com/q/25863480
tags question: http://stackoverflow.com/q/25800868
tags question: http://stackoverflow.com/q/25837095
tags question: http://stackoverflow.com/q/25818933
tags question: http://stackoverflow.com/q/25731664
type: Tag
tags question: http://stackoverflow.com/q/25834704
tags question: http://stackoverflow.com/q/25726678

http://stackoverflow.com/comment/40221595
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25726303
has text: Element is not currently visible and so may not be interacted with
score: 0

http://stackoverflow.com/a/25807412
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25806441
accepted answer of: http://stackoverflow.com/q/25806441
score: 2
type: AcceptedAnswer
downvote count: 0
has body: The problem that you are having is the very reason stream based IO exists, it is simply not viable to slurp huge amounts of data into memory before consuming it. Parse your stream as... a stream! See the Oracle tutorials for more information on stream based XML parsing using SAX. XMLReader xmlreader = SAXParserFactory.newInstance().newSAXParser().getXMLReader(); xmlreader.setContentHandler(new ContentHandler() { ... }); xmlreader.parse(new InputSource(myInputStream));

http://stackoverflow.com/comment/40411660
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25830971
has text: that is one hell of an answer deserve +1

http://stackoverflow.com/comment/40433173
comment on: http://stackoverflow.com/q/25842489
score: 1
type: Comment
type: QuestionComment
has text: Hibernate will not do that, it doesn't make any sense/circumvents the entire purpose of ORM. You can add a `@Where` restriction on the `Set<State>` on the actual Country model to restrict the contents of the collection.

http://stackoverflow.com/comment/40461641
type: AnswerComment
has text: @mosawi Have you tried typing it and compiling it in spite of eclipses errors? Eclipse doesn’t always do well on static imports.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25857611

http://stackoverflow.com/comment/40422940
comment on: http://stackoverflow.com/a/25836965
has text: That is C#. I am asking about Java
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25872769
tagged with: in-app-purchase
has comment: http://stackoverflow.com/comment/40489199
has comment: http://stackoverflow.com/comment/40489068
answer count: 0
has comment: http://stackoverflow.com/comment/40490436
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40489182
tagged with: google-play
has comment: http://stackoverflow.com/comment/40490390
has body: I want to create a section in my app for removing ads . But I have a question . What shall I write in my code instead of developerPayload ? ArrayList skuList = new ArrayList(); skuList.add(inappid); Bundle querySkus = new Bundle(); querySkus.putStringArrayList("ITEM_ID_LIST", skuList); Bundle skuDetails; try { skuDetails = mService.getSkuDetails(3, getPackageName(), "inapp", querySkus); int response = skuDetails.getInt("RESPONSE_CODE"); if (response == 0) { ArrayList&lt;String&gt; responseList = skuDetails .getStringArrayList("DETAILS_LIST"); for (String thisResponse : responseList) { JSONObject object = new JSONObject(thisResponse); String sku = object.getString("productId"); String price = object.getString("price"); if (sku.equals(inappid)) { System.out.println("price " + price); Bundle buyIntentBundle = mService .getBuyIntent(3, getPackageName(), sku, "inapp", "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ"); PendingIntent pendingIntent = buyIntentBundle .getParcelable("BUY_INTENT"); startIntentSenderForResult( pendingIntent.getIntentSender(), 1001, new Intent(), Integer.valueOf(0), Integer.valueOf(0), Integer.valueOf(0)); } } } } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (SendIntentException e) { // TODO Auto-generated catch block e.printStackTrace(); } Here is the part of code . I want to know what shall I write instead of bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ ?
has comment: http://stackoverflow.com/comment/40489329
tagged with: java
has title: Android . Google Play In app purchase
type: Question
has comment: http://stackoverflow.com/comment/40490011
has comment: http://stackoverflow.com/comment/40490089
score: 0
tagged with: android

http://stackoverflow.com/comment/40291858
type: QuestionComment
type: Comment
has text: The input contains an array, not an object.
score: 1
comment on: http://stackoverflow.com/q/25765488

http://stackoverflow.com/q/25839603
has comment: http://stackoverflow.com/comment/40428024
has title: Java Servlet dispatcher to another Java file
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40428108
linked to: http://stackoverflow.com/q/6206273
has comment: http://stackoverflow.com/comment/40430247
has answer: http://stackoverflow.com/a/25856137
has body: Java public class Forward extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); req.setAttribute("option", "forward"); RequestDispatcher dispatcher = req.getRequestDispatcher("/GotoHere"); dispatcher.forward(req, res); } } XML GotoHere examples.GotoHere GotoHere /GotoHere And I received this error message on the web page: HTTP Status 500 - Error instantiating servlet class examples.GotoHere I looked this question, Java servlet not dispatching to another servlet , which is really similar to mine, so I changed RequestDispatcher dispatcher = req.getRequestDispatcher("/GotoHere"); to ServletContext context = getServletContext(); RequestDispatcher dispatcher = context.getNamedDispatcher("GotoHere"); but it's still not working. any ideas?
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25839724
has comment: http://stackoverflow.com/comment/40428734
tagged with: servlets
score: 0

http://stackoverflow.com/a/25767563
accepted answer of: http://stackoverflow.com/q/25767495
has comment: http://stackoverflow.com/comment/40295773
has body: The interface org.hibernate.jdbc.util.Formatter is implemented by the classes org.hibernate.jdbc.util.BasicFormatterImpl and org.hibernate.jdbc.util.DDLFormatterImpl (at least in versions 3.3.0 through 4.3.6).
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25767495
score: 0
type: Answer

http://stackoverflow.com/a/26102833
upvote count: 2
has comment: http://stackoverflow.com/comment/40946628
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25730229
has body: Yes. You can use UiPath in order to automate flash (and also web and desktop) applications. Here's a flash automation example. You can use it from code (SDK) or create an workflow (visual) automation directly from UiPath Studio.
type: Answer
answers question: http://stackoverflow.com/q/25730229

http://stackoverflow.com/q/25859798
score: 0
has answer: http://stackoverflow.com/a/25859811
answer count: 3
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25859883
favorite count: 0
has body: I wrote this method to find the avarage lenght of tokens in a string. I'm having a hard time getting the decimas from this division (two doubles). public static double averageTokenLength (Scanner s) { String word=""; int words = 0; int length = 0; double average = 0; while (s.hasNext()) { word = s.next(); words++; length = length + word.length(); average = (length/ words); } return average; The test method I was given by the professor shows "expected; 3.66666666666667, but was 3.0. How can i get my code to show that result?
tagged with: double
has title: getting decimals when diving doubles
has answer: http://stackoverflow.com/a/25859810
accepted answer: http://stackoverflow.com/a/25859810
type: AnsweredQuestion
tagged with: java
tagged with: formatting
possible better answer: http://stackoverflow.com/a/25859883
type: Question

http://stackoverflow.com/comment/117626276
score: 1
type: AnswerComment
has text: As long as a post answered the question, even if you no longer work on it, remember to accept it so that future visitors benefit from finding it in web searches. "Unanswered" questions do not get pushed to the surface.
comment on: http://stackoverflow.com/a/25837569
type: Comment

http://stackoverflow.com/q/25870568
type: Question
has title: How to communicate Java and Labview through TCP/IP, and send data buffers of float point?
has body: I am working on a university project, where I require communicating Java with Labview, bidirectional, and send and receive data in floating point, in data buffers, because the application in Labview generates data at high speed, but I temporarily store and send when the array has a size of 100. One of my difucultades is to convert data sent from Labview to Java format and viceversa. Thanks!!
has comment: http://stackoverflow.com/comment/40575537
score: 0
has comment: http://stackoverflow.com/comment/40484055
answer count: 2
has answer: http://stackoverflow.com/a/25872316
tagged with: buffer
has answer: http://stackoverflow.com/a/25930021
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40534497
tagged with: labview
tagged with: tcp
tagged with: java
tagged with: floating-point

import
type: Tag
tags question: http://stackoverflow.com/q/25721805
tags question: http://stackoverflow.com/q/25842228
tags question: http://stackoverflow.com/q/25752970
tag name: import
tags question: http://stackoverflow.com/q/25730098
tags question: http://stackoverflow.com/q/25747699
tags question: http://stackoverflow.com/q/25839293
tags question: http://stackoverflow.com/q/25817035
tags question: http://stackoverflow.com/q/25847524
tags question: http://stackoverflow.com/q/25798162
tags question: http://stackoverflow.com/q/25821075

http://stackoverflow.com/q/25734960
has answer: http://stackoverflow.com/a/25734991
score: 0
answer count: 2
has body: I can't seem to find the error here. Apparently, an identifier is expected after "final" for all of the constants. Can somebody help? import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class Letter { private static final int 30G_PRICE = 40; private static final int 50G_PRICE = 55; private static final int 100G_PRICE = 70; private static final int ADDITIONAL_50G_PRICE = 25; public static void main (String[] args) throws IOException { BufferedReader console = new BufferedReader(new InputStreamReader(System.in)); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25734971
type: Question
tagged with: java
has title: Identifier expected issue

http://stackoverflow.com/comment/40365870
type: Comment
comment on: http://stackoverflow.com/a/25804635
type: AnswerComment
has text: when parsing Int make sure the format of the string by eight of 2 ways. Either you set the input format as Integer only or do a try catch while parsing the string.
score: 0

http://stackoverflow.com/comment/40385587
has text: @Sebas: Well, it's not doing *anything* -- it's not used
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25812699

http://stackoverflow.com/comment/42768583
comment on: http://stackoverflow.com/a/27120376
has text: HI Mohamed, I already visited this link. This will work for current window/tab. I want something through which I can notify the user that his session is going to expire even if he is not using the browser and working on some other windows application. I hope I cleared my question to you
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/40289646
comment on: http://stackoverflow.com/q/25764350
score: 0
type: Comment
type: QuestionComment
has text: its a simple object call. U can try it as well.

http://stackoverflow.com/a/25720797
has comment: http://stackoverflow.com/comment/40251220
has comment: http://stackoverflow.com/comment/40211526
has comment: http://stackoverflow.com/comment/40214038
has comment: http://stackoverflow.com/comment/40249209
has comment: http://stackoverflow.com/comment/40245197
upvote count: 3
has comment: http://stackoverflow.com/comment/40211483
type: AcceptedAnswer
has body: Check the doc: 7.2.3. Collections of basic types and embeddable objects 7.3.1. Sorted collections And the example from that source: <key column="person"/> <element column="name" type="string"/> So the answer is <element> Example 7.16. <element> tag for collection values using mapping files This <element> could be used in any type of colleciton mapping, like <bag> ... Also could be interesting: Understading the restrictions for collection of dependent objects in hibernate ... Based on more details, we could say, that the mapping here would be like: ... <key column="menuId" /> // not itemId <element column="itemName" type="string" />
has comment: http://stackoverflow.com/comment/40212810
type: Answer
accepted answer of: http://stackoverflow.com/q/25720369
score: 3
has comment: http://stackoverflow.com/comment/40213785
answers question: http://stackoverflow.com/q/25720369
downvote count: 0

http://stackoverflow.com/comment/40364464
comment on: http://stackoverflow.com/a/25797555
has text: i had to perform the task on a separate thread, in this case asynctask
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25762413
has title: Composing Spring test configuration instead of inheriting it?
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40286371
type: Question
has comment: http://stackoverflow.com/comment/40287149
has comment: http://stackoverflow.com/comment/40287198
favorite count: 0
score: 5
tagged with: spring
tagged with: spring-test
has body: I am writing integration tests for a Spring web application. To setup the configuration I am using the following annotations on the integration test class. // Super class @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = SpringBootRestApplication.class) @IntegrationTest @WebAppConfiguration @ActiveProfiles("test") public abstract class AbstractIT { // Integration test public class SampleResourceIT extends AbstractIT { To reduce the duplication, these are defined in an abstract base test class which every integration test inherits. I want to use composition to load the integration test instead of inheritance as it convolutes the inheritance hierarchy of my tests. I want to store all my test configuration in one configuration class without using inheritance. Is there a way to do it? I have tried the following but it does not work. @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = TestConfig.class) public abstract class AbstractIT { @SpringApplicationConfiguration(classes = SpringBootRestApplication.class) @IntegrationTest @WebAppConfiguration @ActiveProfiles("test") @Configuration public class TestConfig { }
upvote count: 5
tagged with: java
tagged with: testing

http://stackoverflow.com/comment/40500401
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25840191
has text: If you're inside the kernel you can get the physical address of course, but then you don't have Java or the MappedByteBuffer. You'll have to explain your problem in more detail.
score: 0

http://stackoverflow.com/comment/40225988
type: QuestionComment
comment on: http://stackoverflow.com/q/25728488
type: Comment
score: 0
has text: Overwrite `convertProperty` and return something sensitive. Feels like a hack though...

http://stackoverflow.com/a/25865905
downvote count: 1
answers question: http://stackoverflow.com/q/25865873
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/40475283
has body: Keeping as simple as it is, All Java Wrapper classes are Immutable. So you cannot seeing the change. If you want to see the change, just return from method (not main) and assign it back.
upvote count: 1

http://stackoverflow.com/comment/40408737
score: 1
comment on: http://stackoverflow.com/a/25829323
type: AnswerComment
type: Comment
has text: @Joffrey : What if `TaskManager.cancelTask(id);` is called before `r.uuid = id;` ? Doesn't it need a bit of synchronization ?

http://stackoverflow.com/q/25724810
has title: What's the de facto approach to implement Hibernate 4 database write operation?
linked to: http://stackoverflow.com/q/23877900
linked to: http://stackoverflow.com/q/25620303
score: 0
has comment: http://stackoverflow.com/comment/40245394
has comment: http://stackoverflow.com/comment/40217921
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13087928
tagged with: spring
has comment: http://stackoverflow.com/comment/40223069
tagged with: hibernate-4.x
answer count: 0
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/40223132
has body: I get the following exception when I upgrade my app from Hibernate 3.0.5 with Spring 1.0 to Hibernate 4.3.5.Final with Spring 4.0.6. Caused by: org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove 'readOnly' marker from transaction definition. at org.springframework.orm.hibernate4.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1135) at org.springframework.orm.hibernate4.HibernateTemplate$26.doInHibernate(HibernateTemplate.java:826) at org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:340) at org.springframework.orm.hibernate4.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:308) at org.springframework.orm.hibernate4.HibernateTemplate.deleteAll(HibernateTemplate.java:823) ... I have spent several days, done some reasearch, tried different things, and asked the question below: How can I globally set FlushMode for Hibernate 4.3.5.Final with Spring 4.0.6? Seems like there are 2 solotions I can go with, but I have still not found the recommended approach. Approach 1: Implement a custom version of OpenSessionInViewFilter to set the default FlushMode to AUTO. Approach 2: Use a TransactionManager, and add the @Transactional annotation to every method that has write access to the database. This can be done by following: Spring Hibernate transaction management Could anyone provide any suggestion, or point out any documentation related to "Starting from version x.x.x, this is how we should implement Hibernate now!" Thanks a lot

http://stackoverflow.com/a/25786490
score: 0
type: Answer
has body: MongoImport is the de-facto standard to import data into MongoDB. There is no point in re-inventing the wheel and write code which reads json\csv\tsv and imports it in an optimal way. Hence without a second though just make use of mongoimport. :)
answers question: http://stackoverflow.com/q/25786375

http://stackoverflow.com/a/25832934
has body: Add the following method to your Randoms class and call it to replace an object in the list with specified position: public Random set(int position, Random newObjectWithNewBadgeNumber){ return randoms.set(position,newObjectWithNewBadgeNumber); } Edit Random to the following: private static class Random{ public int position; public JsonObject randomData=null; public Integer badgeNumber=null; private Random(int position, JsonObject randomData,Integer badgeNumber) { this.position = position; this.randomData=randomData; this.badgeNumber=badgeNumber; } }
answers question: http://stackoverflow.com/q/25832878
type: Answer
has comment: http://stackoverflow.com/comment/40415680
has comment: http://stackoverflow.com/comment/40415724
has comment: http://stackoverflow.com/comment/40415420
has comment: http://stackoverflow.com/comment/40415825
has comment: http://stackoverflow.com/comment/40416073
score: 0
has comment: http://stackoverflow.com/comment/40415541

http://stackoverflow.com/comment/40271932
type: Comment
has text: @Fildor in that case eclipse tell me surround throw e; with try and catch :(
type: AnswerComment
comment on: http://stackoverflow.com/a/25753790
score: 0

http://stackoverflow.com/a/25736449
answers question: http://stackoverflow.com/q/25736410
downvote count: 0
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/40239275
has body: Set your start time at midnight. Then when you want the total number of minutes that have passed just grab the current time. Then grab the whole number of both times, subtract startTime_hour from currentTime_hour. Then grab the minutes component of the times, in your case only from currentTime minutes. Convert the minutes to decimal using this relation: 30mins/.50 Which is simply, 30 minutes = 0.50. In code it will look like this: currentTime_mins_decimal = .50 * currentTime_mins / 30; Now you want to add the result from the first subtraction to currentTime_mins_decimal and multiply the whole thing by 60. Then convert from decimal to minutes by using the same relation: 30mins/.50 The benefit of changing was that if your start time is not midnight but something with minutes, let's say 12:55 when you do your arithmetic you won't get accurate results.

http://stackoverflow.com/a/25761747
has comment: http://stackoverflow.com/comment/40285172
score: 0
answers question: http://stackoverflow.com/q/25761646
has body: ArrayList is a container, it's similar as Vector in C++, it can add and remove elements, but array can't change its size
type: Answer

http://stackoverflow.com/q/25763142
type: Question
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/40287648
has title: Android: ArrayIndexOutOfBounds Exception on addRule in LayoutParams
has comment: http://stackoverflow.com/comment/40288008
has answer: http://stackoverflow.com/a/31206384
favorite count: 0
tagged with: exception
tagged with: android
downvote count: 0
has comment: http://stackoverflow.com/comment/40287838
has comment: http://stackoverflow.com/comment/40287663
type: UnansweredQuestion
has body: I wrote this function: private void SetNewsBackButton(Boolean visible) { LinearLayout backButton = (LinearLayout)findViewById(R.id.backButton); TextView headerText = (TextView)findViewById(R.id.headerText); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)headerText.getLayoutParams(); if (visible) { backButton.setVisibility(View.VISIBLE); params.addRule(RelativeLayout.END_OF, R.id.backButton); } else { backButton.setVisibility(View.INVISIBLE); params.addRule(RelativeLayout.END_OF, 0); } } The function should make a LinearLayout visible or invisible and align the textfield to it if visible, not align when invisible. My Problem: The App crashes with 09-10 12:48:32.260 16663-16663/nidhoegger.org.nfansde W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41a9c600) 09-10 12:48:32.270 16663-16663/nidhoegger.org.nfansde E/AndroidRuntime﹕ FATAL EXCEPTION: main java.lang.ArrayIndexOutOfBoundsException: length=16; index=19 at android.widget.RelativeLayout$LayoutParams.addRule(RelativeLayout.java:1222) at nidhoegger.org.nfansde.NewsList.SetNewsBackButton(NewsList.java:147) at nidhoegger.org.nfansde.NewsList.ReadNews(NewsList.java:182) at nidhoegger.org.nfansde.NewsList$1.onItemClick(NewsList.java:103) at android.widget.AdapterView.performItemClick(AdapterView.java:298) at android.widget.AbsListView.performItemClick(AbsListView.java:1199) at android.widget.ListView.performItemClick(ListView.java:4444) at android.widget.AbsListView$PerformClick.run(AbsListView.java:3067) at android.widget.AbsListView$1.run(AbsListView.java:3753) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:155) at android.app.ActivityThread.main(ActivityThread.java:5536) 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:1074) at com.android…
has comment: http://stackoverflow.com/comment/40287565
has comment: http://stackoverflow.com/comment/40288285
score: 2
tagged with: java

cryptography
tag name: cryptography
type: Tag
tags question: http://stackoverflow.com/q/25844026
tags question: http://stackoverflow.com/q/25808003
tags question: http://stackoverflow.com/q/25735811

http://stackoverflow.com/a/25824214
has body: Your inner loop is starting from zero: for (int j = 0; j &lt; myArray1[i].length; j++) { You should have for (int j = 1; j &lt; myArray1[i].length; j++) { As for the closing brace, just print it after the inner loop, but still inside the outer loop: System.out.println("}"); } System.out.println("};");
type: Answer
has comment: http://stackoverflow.com/comment/40401032
has comment: http://stackoverflow.com/comment/40399409
answers question: http://stackoverflow.com/q/25824156
has comment: http://stackoverflow.com/comment/40400981
has comment: http://stackoverflow.com/comment/40401083
has comment: http://stackoverflow.com/comment/40399381
score: 0

http://stackoverflow.com/q/25861413
accepted answer: http://stackoverflow.com/a/25862966
upvote count: 3
has title: cron expression to execute a at current date time once
tagged with: quartz-scheduler
answer count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/48291000
has body: I need to build a Cron Expression to execute a Job now. I tried using the following : private String generateCronExpressionNow(final String seconds,final String minutes, final String hours, final String dayOfMonth, final String month, final String dayOfWeek, final String year) { return String.format("%1$s %2$s %3$s %4$s %5$s %6$s %7$s",seconds+"/2",minutes, hours, dayOfMonth, month, dayOfWeek,year); } Called the above method using: generateCronExpressionNow(Integer.toString(date.getSeconds()),Integer.toString(date.getMinutes()), Integer.toString(date.getHours()),Integer.toString(date.getDate()), Integer.toString(date.getMonth()+1), "?", Integer.toString(date.getYear()+1900) but this seems to be running the job repeatedly..many times. Please help. Also referred java.lang.RuntimeException: CronExpression '4 27 11 ? 8 ? 2014' is invalid,
has answer: http://stackoverflow.com/a/25862966
type: AnsweredQuestion
score: 3
tagged with: cronexpression
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/25841697
type: Question

http://stackoverflow.com/q/25717009
type: Question
tagged with: drools
has title: List validation in drools
linked to: http://stackoverflow.com/q/25735964
has body: A drools newbie here, Following is the java class structure. public class Person { List&lt;PersonAddress&gt; personAddress; } public enum AddressType { CURRENT, PREVIOUS; } public class PersonAddress{ Address address; AddressType type Integer timeAtAddress; } public class Address { String city; String country; String street; } I have to write some code to validate PersonAddress in drools. Rule 1. if person has list of PersonAddress instances, if one of them being AddressType == CURRENT and timeAtAddress &lt; 3, then i want to find whether that list contains a address where AddressType == PREVIOUS. Rule 2. If above condition is true, then i want to get the PersonAddress instance where AddressType == PREVIOUS, Drools version 5.5.0.Final, Java 1.7 Functions can be used This is something i tried, but it doesnt work function boolean isPreviousAddressExist(java.util.List list) { if(list.isEmpty()) { return false; } boolean validRecordFound = false; for(int addressIndex = 0; addressIndex &lt; list.size(); addressIndex++) { PersonAddress pa = (PersonAddress)list.get(addressIndex); if(AddressType.CURRENT.equals(pa.getAddressType()) &amp;&amp; pa.getTimeAtAddress() != null &amp;&amp; pa.getTimeAtAddress() &lt; 3) { validRecordFound = true; break; } } boolean previousRecordFound = false; if(validRecordFound) { for(int addressIndex = 0; addressIndex &lt; list.size(); addressIndex++) { PersonAddress pa = (PersonAddress)list.get(addressIndex); if(AddressType.PREVIOUS.equals(pa.getAddressType())) { previousRecordFound = true; break; } } } else { previousRecordFound = true; } return previousRecordFound; } rule "Previous-Physical-Home Address is required for Time at Current-Physical-Home" when $quotation:Quotation() eval(!isPreviousAddressExist($quotation.getApplicantList())) then runningResults.addRunningResult(new BusinessRuleRunningResult(null, " A Previous physical Home Address is required.", false)); end
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25718143
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25718143

http://stackoverflow.com/a/25833102
upvote count: 1
has body: The size of the thread pool is whatever you set it to be, either the number of cores that you have: public ForkJoinPool() Creates a ForkJoinPool with parallelism equal to Runtime.availableProcessors(), using the default thread factory, no UncaughtExceptionHandler, and non-async LIFO processing mode. Or some specific number: public ForkJoinPool(int parallelism) Creates a ForkJoinPool with the indicated parallelism level, the default thread factory, no UncaughtExceptionHandler, and non-async LIFO processing mode. Please read the JavaDoc for more information. The way a recursive action works is that it spawns multiple versions of itself. You always start with 1. The number of actions generated is somewhat immaterial, hundreds or thousands should be fine - as long as they don't "pile up".
accepted answer of: http://stackoverflow.com/q/25832996
answers question: http://stackoverflow.com/q/25832996
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 1

http://stackoverflow.com/q/25811351
tagged with: unmarshalling
has title: Force jaxb unmarshaller to ignore html Tags
tagged with: parsing
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/40376596
has answer: http://stackoverflow.com/a/25812332
has body: I am using JAXB to convert string xml data to POJO as follows. JAXBContext jaxbContext = JAXBContext.newInstance(Employee.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); StringReader reader = new StringReader(temp); Employee emp = (Employee) unmarshaller.unmarshal(reader); It goes fine, but it's always trying to validate text of each element during unmarshal and sometimes got failed. That I don't want, because in text there are lot of html tags and sometimes they are erroneous too. So, I want JAXB to skip the entire text and pass it as it is to form POJO data. Is there any way to achieve this. Any help will be appreciated.
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
has comment: http://stackoverflow.com/comment/40376301
type: Question
answer count: 1
has comment: http://stackoverflow.com/comment/40381066
accepted answer: http://stackoverflow.com/a/25812332
score: 0

http://stackoverflow.com/comment/40409248
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25829305
has text: @AdamWeesner So you don't need to subtract 1 after all. I will edit my answer to reflect this.

http://stackoverflow.com/q/25855106
linked to: http://stackoverflow.com/q/25852541
favorite count: 0
has comment: http://stackoverflow.com/comment/40455973
has body: I'm starting to get myself into algorithms and I need help solving this kind of problem. Task set: An array contains sheep and goats in random order. Write a possibly fast method to rearrange the array, so that all goats are at the beginning and all sheep are at the end of the array. Consider the case when all animals are the same kind. public class Sheep { enum Animal {sheep, goat}; public static void main (String[] param) { // for debugging } public static void reorder (Animal[] animals) { // TODO!!! Your program here } } Thank you for all your help!
has title: How to sort random elements of an array efficiently so that similar items appear together
duplicate of: http://stackoverflow.com/q/25852541
has answer: http://stackoverflow.com/a/25855188
answer count: 4
has answer: http://stackoverflow.com/a/25855306
type: AnsweredQuestion
upvote count: 2
has answer: http://stackoverflow.com/a/25856974
downvote count: 3
has answer: http://stackoverflow.com/a/25855227
type: Question
accepted answer: http://stackoverflow.com/a/25855188
tagged with: enums
tagged with: algorithm
possible better answer: http://stackoverflow.com/a/25855227
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/40455638
has comment: http://stackoverflow.com/comment/40455580
has comment: http://stackoverflow.com/comment/40456146
has comment: http://stackoverflow.com/comment/40456197
tagged with: arrays

http://stackoverflow.com/a/25832632
answers question: http://stackoverflow.com/q/25832616
score: 0
has body: it is possible to set timeout for http requests this way int timeoutConnection = 3000; HttpConnectionParams.setConnectionTimeout(httpParameters, timeoutConnection); int timeoutSocket = 5000; HttpConnectionParams.setSoTimeout(httpParameters, timeoutSocket);
type: Answer

http://stackoverflow.com/comment/40262044
type: QuestionComment
comment on: http://stackoverflow.com/q/25749032
has text: So it gets stuck on "Connecting to the target VM".. hmm, perhaps you could use VisualVM to connect to the JVM and take some thread dumps of the VisualVM process to troubleshoot the hanging issue. Just joking :D How about trying to connect to a JRE instead of the java.exe within your JDK folder? Also, did you define a JAVA_HOME environment variable? Usually the calibration starts without having to manually point to a local JRE/JDK.
type: Comment
score: 1

http://stackoverflow.com/q/25843319
has comment: http://stackoverflow.com/comment/40434906
upvote count: 1
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40434779
tagged with: eclipse
has title: AccessController.doPrivileged() Issue in Eclipse IDE
has comment: http://stackoverflow.com/comment/40435028
has answer: http://stackoverflow.com/a/25844473
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40434699
has comment: http://stackoverflow.com/comment/40434735
has body: I am new to java. I want to run a simple hello world application in eclipse IDE. public class Hello { public static void main( String[] args ) { System.out.println("hello"); } } I am getting errors in console: at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:323) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:268) Could not find the main class: com.tutorialspoint.demo.hr.model.Hello. Program will exit.
type: UnansweredQuestion

http://stackoverflow.com/q/25789059
has comment: http://stackoverflow.com/comment/40370968
has body: With XE21, my Glass constantly auto-dims the screen with a live card. I am trying out the Compass sample and simply want it to stay on screen always. I did find one possible fix which didn't work for me - adding to the FrameLayout the line: android:keepScreenOn="true" Am I actually adding this in the right place? Would be good to fix this issue. Not sure why auto-dimming the screen cant be a manual setting in Glass Settings. Thanks
tagged with: google-gdk
type: Question
has answer: http://stackoverflow.com/a/25789809
upvote count: 2
has title: Stopping auto-dim on Glass
tagged with: google-glass
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40353234
type: UnansweredQuestion
score: 2
downvote count: 0
tagged with: java

http://stackoverflow.com/a/25838983
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25838954
type: Answer
answers question: http://stackoverflow.com/q/25838954
has body: You can change your signature with public static void orderByName(ArrayList&lt;? extends Person&gt; pArray)
score: 0

http://stackoverflow.com/q/25808282
tagged with: java
has answer: http://stackoverflow.com/a/25808511
type: Question
tagged with: client-server
tagged with: protocols
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/25808511
tagged with: web-services
has body: I want to use a Java app for business logic, database management, user authentication, and a JavaScript MVC app to handle all things UI. I am in need of a standardized and/or normalized communication styleguide or design pattern for my client/server communication. The styleguide/pattern should be able to gracefully handle information pertaining to form fields, validation rules and errors, user profile information, and be extensible. I know about SOAP and other such protocols... I need help with the structure/patterns/lexicon that I should be using for the the messages themselves. So far I'm been defining the messages willy-nilly and it feels like I am reinventing the wheel. Thanks!
possible better answer: http://stackoverflow.com/a/25808493
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25808493
has title: A styleguide for a web app's client-server communication

http://stackoverflow.com/comment/40341458
comment on: http://stackoverflow.com/a/25792167
type: Comment
has text: @jordanpg JVM args are JVM args; similar to how you can define system variables, memory options, etc. for the process that runs your code. I guess I just don't see what the issue actually is here.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40294596
type: Comment
has text: Convert it to a `char[]` and compare each character? Odd design choice to do it without `.equals()`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25766817

http://stackoverflow.com/comment/40475848
type: AnswerComment
has text: I am curious: what are the advantages that you notice versus a custom solution for this? It seems like a **very** simple usecase.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25866354

http://stackoverflow.com/q/25803513
has title: How can I instantiate a JRuby class that implements a Java interface in Java
has answer: http://stackoverflow.com/a/25803778
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25804960
tagged with: jruby
has body: There is a Java interface Job: interface Job{ ... } and a JRuby class SimpleJob that implements it: class SimpleJob require org.quartz.Job ... end I need to (from a Java class) instantiate the SimpleJob class using the javax.script.ScriptEngine class, and get its class object. How do I do this?
tagged with: javax.script
type: AnsweredQuestion
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/25804960
possible better answer: http://stackoverflow.com/a/25803778

spongycastle
type: Tag
tags question: http://stackoverflow.com/q/25828216
tag name: spongycastle

http://stackoverflow.com/q/25798208
has answer: http://stackoverflow.com/a/25798343
has answer: http://stackoverflow.com/a/25798237
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25798235
has title: How does Main have access to class?
answer count: 4
favorite count: 0
type: Question
upvote count: 2
possible better answer: http://stackoverflow.com/a/25798232
has answer: http://stackoverflow.com/a/25798232
accepted answer: http://stackoverflow.com/a/25798237
tagged with: accessor
tagged with: java
tagged with: methods
tagged with: program-entry-point
has body: I'm new to coding and I made this program that allows someone to input the song name, artist, album, year released and I just print it out. So while I CAN write the program, I don't understand how main gains access to the the CD class. How did the computer know I was creating a CD from this other class I had? Why was I able to use the accessor methods from the CD class? Sorry if this sounds dumb but I'm trying to understand why it works! THANK YOU FOR ANSWERS. Thank you to all who answered! It makes sense now! package project1; public class CD { private String song; private String artist; private String album; private int year; public CD(String givenSong, String givenArtist, String givenAlbum, int givenYear) { song=givenSong; artist=givenArtist; album=givenAlbum; year=givenYear; } public String getSong(){ return song; } public int getYear(){ return year; } public String getArtist(){ return artist; } public String getAlbum(){ return album; } } and main.. package project1; public class CDTest { public static void main(String[] args){ CD cd1= new CD("Sad machine","Porter Robinson","Worlds",2014); System.out.print(cd1.getSong()+", "); System.out.print(cd1.getArtist()+", "); System.out.print(cd1.getAlbum()+", "); System.out.print(cd1.getYear()); } }
downvote count: 0
tagged with: class

http://stackoverflow.com/comment/40298892
comment on: http://stackoverflow.com/a/25768731
score: 0
type: AnswerComment
type: Comment
has text: ? What? Look at Joop's bytecode! The compiler clearly transforms `+` into `StringBuilder.append`. (It doesn't combine multiple adjacent expressions because it isn't allowed to).

http://stackoverflow.com/q/25854466
upvote count: 1
has answer: http://stackoverflow.com/a/25854878
favorite count: 0
downvote count: 0
tagged with: scala
type: UnansweredQuestion
tagged with: maven
has title: Is there a way to store launch configs from a POM file so they can be imported into Eclipse and Idea?
score: 1
tagged with: java
tagged with: eclipse
type: Question
has body: My team develops Java and Scala applications. Until recently the entire team has used Eclipse to develop. All projects (Scala included) use Maven to manage dependencies and builds and the POM is the defacto project definition. A few of our applications have a lot of VM and Program arguments necessary for launching the application. Until now these parameters were just recorded in a launch config in Eclipse. Some of the developers have started switching to IntelliJ Idea. We can import a Maven project easily enough in both IDEs and developers have the freedom to choose their preferred IDE without any difficult. However, the launch configurations are not stored in the POM file. An ideal solution would allow Eclipse and Idea to import these launch configurations from the POM file. Is there a way to do this?
tagged with: intellij-idea
answer count: 1

session-timeout
type: Tag
tags question: http://stackoverflow.com/q/25803917
tag name: session-timeout

http://stackoverflow.com/comment/40394060
type: Comment
has text: Consider using `SimpleGestureListener` and its `onFling()` to detect swipes. Working with raw `MotionEvent`s properly is often unnecessarily complex.
comment on: http://stackoverflow.com/q/25821020
score: 0
type: QuestionComment

http://stackoverflow.com/q/25810607
type: Question
answer count: 2
score: 5
downvote count: 0
favorite count: 0
tagged with: glob
has answer: http://stackoverflow.com/a/25844159
type: UnansweredQuestion
has body: I'm working on a large legacy project that I'm trying to componentize, starting with SonarQube. I'm configuring a multi-module project in sonar-project.properties. This works fine. However, I have an issue precisely identifying source folders. Unfortunately, our modules aren't neatly separated in the file system. The project is separated into many Eclipse projects, and several Eclipse projects together form one module. I can, of course, enumerate all the projects, but this is very cumbersome as there are a lot of them. Here's a (simplified) version of our directory structure: projects/ moduleAsubmodule1/ src/ com/mycompany/moduleA/submodule1/ moduleAsubmodule2/ src/ com/mycompany/moduleA/submodule2/ moduleBsubmodule1/ src/ com/mycompany/moduleB/submodule1/ moduleBsubmodule2/ src/ com/mycompany/moduleB/submodule2/ moduleBsubmodule3/ src/ com/mycompany/moduleB/submodule3/ Imagine many more modules and submodules, where the project name is concatenated, but the package names are nicely divided, making it much easier to differentiate on those. moduleA.sonar.projectBaseDir=. moduleA.sonar.sources=projects/**/src/com/mycompany/moduleA/**/* moduleA.sonar.test=projects/**/*.test/src/com/mycompany/moduleA/**/* According to the documentation, this should be possible for exclusions. However, I get the following error message: 16:10:44 ERROR: Unable to execute Sonar 16:10:44 ERROR: Caused by: The folder 'projects/**/src/com/mycompany/mymodule/**/*' does not exist for 'XXX:XXX:mymodule' (base directory = D:\XxxSonar\.) So I guess globs don't work for sources? If that's indeed the case, what can I do? We use SonarQube 4.1.2.
has answer: http://stackoverflow.com/a/41063615
upvote count: 5
tagged with: java
has title: Globs in sonar-project.properties
tagged with: sonarqube

http://stackoverflow.com/comment/40298678
has text: I can give them a try, link please?
comment on: http://stackoverflow.com/a/25768507
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25842228
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40432616
has comment: http://stackoverflow.com/comment/40432732
has answer: http://stackoverflow.com/a/25842378
type: AnsweredQuestion
downvote count: 2
tagged with: methods
has comment: http://stackoverflow.com/comment/40432670
type: Question
has comment: http://stackoverflow.com/comment/40432697
has body: So i have a class file that extends java.lang.object called powerfulS And i use this class file in my Testers.java as such import java.lang.object; public class Testers { public static powerfulS=new powerfuls(..); [..] } now i have a dilemma in which my class powerfulS has a method which needs to be modified. And the method in this class uses other methods within that class e.g public double method1() { return getPowerLvl()*getSystemCrasher(); } i want to change it so that it uses another method in that class as such e.g public double method1() { return getPowerLvl()*getSystemReviver(); } When i attempted to do this public class Testers { public double method1() { return super.getPowerLvl()*super.getSystemCrasher(); } public static powerfulS=new powerfuls(..); [..] } I get a 'cannot find symbol error'.... How do I modify the method in the imported class? Do I use @Override ?
score: -2
tagged with: java
accepted answer: http://stackoverflow.com/a/25842378
tagged with: import
tagged with: class
has title: modify a method from an extended class

http://stackoverflow.com/comment/40376034
type: Comment
has text: Ah thanks a lot bro! That finally got my code working!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25811411

http://stackoverflow.com/q/25749147
type: AnsweredQuestion
tagged with: weblogic
has comment: http://stackoverflow.com/comment/40264755
tagged with: java
accepted answer: http://stackoverflow.com/a/25840450
has title: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl cannot be cast to javax.xml.soap.MessageFactory
answer count: 1
has comment: http://stackoverflow.com/comment/40263556
has body: I'm using WebLgic have the following saaj soap message factory. I've tried leaving off the messageFactory and just the soapVersion and vice Versa. I've also tried the different messageFactory Impl beans that are commented out. I'm still getting the error in the title. Why is t trying to use version 1.1? <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOAP_12" /> Error: SAAJ MessageFactory: Unable to create message factory for SOAP: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl cannot be cast to javax.xml.soap.MessageFactory; nested exception is javax.xml.soap.SOAPException: Unable to create message factory for SOAP: com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl cannot be cast to javax.xml.soap.MessageFactory at org.springframework.ws.support.DefaultStrategiesHelper.instantiateBean(DefaultStrategiesHelper.java:188) at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategies(DefaultStrategiesHelper.java:134) at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategy(DefaultStrategiesHelper.java:219) at org.springframework.ws.support.DefaultStrategiesHelper.getDefaultStrategy(DefaultStrategiesHelper.java:203) at org.springframework.ws.client.core.WebServiceTemplate.initMessageFactory(WebServiceTemplate.java:310) pom file: javax javaee-api 7.0 com.sun.xml.messaging.saaj saaj-impl 1.3.15 javax.xml.soap saaj-api 1.3.5 Weblogic.xml: <prefer-application-packages> javax.xml.soap.* javax.xml.ws.* com.sun.xml.messsaging.saaj.* </prefer-application-packages> I should also add that I tried setting various this JVM argument with various options: -Djavax.xml.soap.MessageFactory=weblogic.xml.saaj.MessageFactoryImpl such as com.sun.xml.messaging.saaj.soap.ver1_2.SOAPMessageFactory1_2Impl. The error message now reflects the new Impl class, but I still can't get around the error.
score: 0
has comment: http://stackoverflow.com/comment/40262820
tagged with: soap
linked to: http://stackoverflow.com/q/25553202
has answer: http://stackoverflow.com/a/25840450
tagged with: spring
tagged with: saaj
type: Question

http://stackoverflow.com/q/25824269
answer count: 5
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25824322
tagged with: java
score: 16
tagged with: methods
type: Question
has body: I wrote a realy simple code based on another question and here it is: It throws me an error java.lang.NullPointerException line 5 and 17 I don't know what I'm doing wrong. public class Main { public static String bool(Boolean param){ if(param == true){ (line 5) return "a"; }else if(param == false){ return "b"; } return "c"; } public static void main(String[] args){ System.out.println(bool(true)); System.out.println(bool(null)); (line 17) System.out.println(bool(false)); } }
has answer: http://stackoverflow.com/a/25824320
has title: java.lang.NullPointerException with boolean
has answer: http://stackoverflow.com/a/25824276
accepted answer: http://stackoverflow.com/a/25824276
upvote count: 19
has comment: http://stackoverflow.com/comment/40399472
has comment: http://stackoverflow.com/comment/40410988
linked to: http://stackoverflow.com/q/3352791
downvote count: 3
has answer: http://stackoverflow.com/a/25824322
has answer: http://stackoverflow.com/a/25824471
has answer: http://stackoverflow.com/a/68464731
has comment: http://stackoverflow.com/comment/40399458
favorite count: 0
has comment: http://stackoverflow.com/comment/40399588

http://stackoverflow.com/a/25856761
has body: have you tried Scanner.nextByte()? make a new scanner with the file you want to parse as the input and use a for loop to create your array.
type: Answer
has comment: http://stackoverflow.com/comment/40459010
answers question: http://stackoverflow.com/q/25856620
score: 0

http://stackoverflow.com/comment/40414589
type: QuestionComment
has text: @Jim Garrison The field is enclosed with quotes. However inside the field there are characters as well as new lines. I am using the Weka machine learning tool and it is unable to understandf that the new-line inside the field does not finish the row.
score: 0
comment on: http://stackoverflow.com/q/25812976
type: Comment

http://stackoverflow.com/q/25717545
answer count: 1
downvote count: 0
has title: Why are in-range narrowed long values not implicitly converted?
favorite count: 0
has body: When we declare a static final, the Java compiler (or pre-compiler?) seems smart enough to detect out-of-range numbers: public class Test { // setup variables: public static final int i_max_byte = 127; public static final int i_max_byte_add1 = 128; public static final int i_max_short = 32767; public static final int i_max_short_add1 = 32768; public static final int i_max_char = 65535; public static final int i_max_char_add1 = 65536; public static final char c_max_byte = 127; public static final char c_max_byte_add1 = 128; public static final char c_max_short = 32767; public static final char c_max_short_add1 = 32768; public static final short s_min_char = 0; public static final short s_min_char_sub1 = -1; public static final short s_max_byte = 127; public static final short s_max_byte_add1 = 128; // all these are OK: public static final byte b1 = i_max_byte; public static final byte b2 = s_max_byte; public static final byte b3 = c_max_byte; public static final byte b4 = (short) i_max_byte; public static final byte b5 = (char) i_max_byte; public static final char c1 = i_max_char; public static final char c2 = s_min_char; public static final short s1 = i_max_short; public static final short s2 = c_max_short; // pre-compiler complains "type-mismatch": public static final byte _b1 = i_max_byte_add1; public static final byte _b2 = s_max_byte_add1; public static final byte _b3 = c_max_byte_add1; public static final byte _b4 = (short) i_max_byte_add1; public static final byte _b5 = (char) i_max_byte_add1; public static final char _c1 = i_max_char_add1; public static final char _c2 = s_min_char_min_us1; public static final short _s1 = i_max_short_add1; public static final short _s2 = c_max_short_add1; } The code above proves that for int, short, and char values, the compiler only complains when the value is out-of-range for the type of the assigned variable. However for long values, the compiler complains even when the numbers are within range: public class Test2 { public s…
tagged with: constants
score: 6
has comment: http://stackoverflow.com/comment/40203458
upvote count: 6
has answer: http://stackoverflow.com/a/25721132
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/25721132
tagged with: literals
type: Question
has comment: http://stackoverflow.com/comment/40203489

http://stackoverflow.com/comment/40474399
type: Comment
has text: So what i will have to change.....
type: QuestionComment
comment on: http://stackoverflow.com/q/25864979
score: 0

http://stackoverflow.com/q/25805036
tagged with: document-classification
type: Question
has answer: http://stackoverflow.com/a/25805833
score: 0
answer count: 3
has title: Machine Learning Library Specialized for documents
tagged with: nlp
has answer: http://stackoverflow.com/a/31132132
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25810091
tagged with: machine-learning
has body: I am doing a project and I need to find out a machine learning library written in java specialized for document classification. Can anyone please give me some examples?
tagged with: java

http://stackoverflow.com/a/25832448
accepted answer of: http://stackoverflow.com/q/25832423
has body: The AdapterView could be a ListView, GridView, Spinner, etc. This is called generics in Java. You can use parent in code to do something to the whole view. For example, if you were using a ListView you could hide the whole ListView by the following line of code: parent.setVisibility(View.GONE); The View refers to a specific item within the AdapterView. In a ListView it is the row. Thus, you can get a reference to a TextView within a row by saying something like this: TextView myTextView = (TextView) view.findViewById(R.id.textView1); String text = myTextView.getText().toString();
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40414396
has comment: http://stackoverflow.com/comment/40414458
has comment: http://stackoverflow.com/comment/40414376
has comment: http://stackoverflow.com/comment/40414327
downvote count: 0
answers question: http://stackoverflow.com/q/25832423
has comment: http://stackoverflow.com/comment/40414411
score: 6
type: Answer
has comment: http://stackoverflow.com/comment/40414431
upvote count: 6

http://stackoverflow.com/comment/40408723
comment on: http://stackoverflow.com/a/25829285
has text: Also its kind of crazy that the only three common numbers found in there are "539" i was really expecting more than just one sequence found.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40407526
has text: And this `BroadcastReceiver` would get fired just after I call `enableWifi()` right? So I check for this within my `AlarmReceiver` class?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25828381
type: Comment

http://stackoverflow.com/comment/40325847
type: Comment
has text: Thanks for this. I'm still having problems with implementation and getting the code to run when it is not from the main class.
comment on: http://stackoverflow.com/a/25768019
type: AnswerComment
score: 0

http://stackoverflow.com/q/25784218
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40326061
score: 1
tagged with: java
has title: Terminating a for loop in java
has answer: http://stackoverflow.com/a/25784371
tagged with: loops
has answer: http://stackoverflow.com/a/25784370
type: Question
tagged with: for-loop
possible better answer: http://stackoverflow.com/a/25784248
has answer: http://stackoverflow.com/a/25784287
accepted answer: http://stackoverflow.com/a/25784287
answer count: 6
has comment: http://stackoverflow.com/comment/40326149
has answer: http://stackoverflow.com/a/25784298
upvote count: 3
downvote count: 2
favorite count: 0
has comment: http://stackoverflow.com/comment/40326044
has body: Please explain this code and how the output came as 10? class L1 { public static void main(String args[]) { int i; for (i=0; i&lt;=9; i++); //termination { System.out.println(i); } } } output 10
has answer: http://stackoverflow.com/a/25784248
has answer: http://stackoverflow.com/a/25784251

http://stackoverflow.com/a/25816640
upvote count: 1
score: 0
answers question: http://stackoverflow.com/q/25816570
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/40386042
has comment: http://stackoverflow.com/comment/40386180
has comment: http://stackoverflow.com/comment/40386084
has body: Does it work if you validate the input before asking for the next line of input? (i.e. move the input scanning code inline with the logic flow)

http://stackoverflow.com/comment/40781764
score: 0
type: QuestionComment
type: Comment
has text: I have posted answer please mention in comments below answers if you are facing any problems
comment on: http://stackoverflow.com/q/25781789

http://stackoverflow.com/comment/40240845
type: Comment
type: QuestionComment
has text: No. I'v added this but it doesn't help
score: 0
comment on: http://stackoverflow.com/q/25736878

http://stackoverflow.com/comment/40219614
type: Comment
has text: That is not possible as far as i know. Why do you think that it is possible? What kind of technic is behind all this?
comment on: http://stackoverflow.com/q/25720414
score: 0
type: QuestionComment

http://stackoverflow.com/q/25822189
has comment: http://stackoverflow.com/comment/40400102
linked to: http://stackoverflow.com/q/1372991
downvote count: 1
has answer: http://stackoverflow.com/a/25823022
has body: I have a class which has only constant. Code snippets is : public class CommonConstant { public static final String DAY = "DAY"; public static final String WEEK = "WEEK"; public static final String MONTH = "MONTH"; public static final String YEAR = "YEAR"; public static final String ACCEPTED = "accepted"; public static final String REJECTED = "rejected"; public static final String ADDED = "added"; public static final String MODIFIED = "modified"; } Is it good practice to specify constants in class file or it should be in an interface ? What is good practice ?
upvote count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25822239
tagged with: class
has comment: http://stackoverflow.com/comment/40395745
favorite count: 0
has comment: http://stackoverflow.com/comment/40395732
type: Question
tagged with: interface
has title: Best Practice to define constant - inside class or inside interface?
score: 4
tagged with: constants
tagged with: java
answer count: 2

http://stackoverflow.com/q/25787717
has comment: http://stackoverflow.com/comment/40331977
type: AnsweredQuestion
favorite count: 0
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25787960
answer count: 2
has body: Or it depends? For example fictional class: public class Worker { private boolean paused; public boolean isPaused() { return paused; } public void onIteration() { if (!paused) { doIteration(); } } } Or would it be better if I use if isPaused() { } in the example above ? Is there any rule about what I always must use?
has answer: http://stackoverflow.com/a/25787879
has title: Should I use getters and setters inside a class implementation?
possible better answer: http://stackoverflow.com/a/25787960
tagged with: java
score: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/25787879
has comment: http://stackoverflow.com/comment/40332015

http://stackoverflow.com/a/25736724
has body: You can but your method should return a double array through all the logical exits of your method. So you need to have return s; outside of your top-level while loop also.
score: 2
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/25736706

http://stackoverflow.com/comment/40428419
type: QuestionComment
score: 1
has text: @nneonneo Is that ok? Because there's not java code here.
comment on: http://stackoverflow.com/q/25839843
type: Comment

regex
tags question: http://stackoverflow.com/q/25794908
tags question: http://stackoverflow.com/q/25720282
tags question: http://stackoverflow.com/q/25844060
tags question: http://stackoverflow.com/q/25730280
tags question: http://stackoverflow.com/q/25774173
tags question: http://stackoverflow.com/q/25738342
tags question: http://stackoverflow.com/q/25830373
tags question: http://stackoverflow.com/q/25716422
tags question: http://stackoverflow.com/q/25801247
tag name: regex
tags question: http://stackoverflow.com/q/25821446
tags question: http://stackoverflow.com/q/25808920
tags question: http://stackoverflow.com/q/25735613
tags question: http://stackoverflow.com/q/25845760
tags question: http://stackoverflow.com/q/25850899
tags question: http://stackoverflow.com/q/25843241
tags question: http://stackoverflow.com/q/25839344
tags question: http://stackoverflow.com/q/25748590
tags question: http://stackoverflow.com/q/25811478
tags question: http://stackoverflow.com/q/25844050
tags question: http://stackoverflow.com/q/25793400
tags question: http://stackoverflow.com/q/25850234
tags question: http://stackoverflow.com/q/25858862
tags question: http://stackoverflow.com/q/25715653
tags question: http://stackoverflow.com/q/25796709
tags question: http://stackoverflow.com/q/25718046
tags question: http://stackoverflow.com/q/25850366
tags question: http://stackoverflow.com/q/25784691
tags question: http://stackoverflow.com/q/25866915
tags question: http://stackoverflow.com/q/25715141
tags question: http://stackoverflow.com/q/25834744
tags question: http://stackoverflow.com/q/25738628
tags question: http://stackoverflow.com/q/25728367
tags question: http://stackoverflow.com/q/25765465
tags question: http://stackoverflow.com/q/25834428
tags question: http://stackoverflow.com/q/25817269
tags question: http://stackoverflow.com/q/25726637
tags question: http://stackoverflow.com/q/25851293
tags question: http://stackoverflow.com/q/25790448
tags question: http://stackoverflow.com/q/25734689
tags question: http://stackoverflow.com/q/25713003
tags question: http://stackoverflow.com/q/25761896
tags question: http://stackoverflow.com/q/25722948
tags question: http://stackoverflow.com/q/25858345
tags question: http://stackoverflow.com/q/25786996
tags question: http://stackoverflow.com/q/25789597
tags question: http://stackoverflow.com/q/25862727
tags question: http://stackoverflow.com/q/25823267
tags question: http://stackoverflow.com/q/25780463
tags question: http://stackoverflow.com/q/25733600
tags question: http://stackoverflow.com/q/25862888
tags question: http://stackoverflow.com/q/25756487
tags question: http://stackoverflow.com/q/25735255
tags question: http://stackoverflow.com/q/25828078
tags question: http://stackoverflow.com/q/25750239
tags question: http://stackoverflow.com/q/25841877
tags question: http://stackoverflow.com/q/25852961
tags question: http://stackoverflow.com/q/25818009
tags question: http://stackoverflow.com/q/25863249
tags question: http://stackoverflow.com/q/25832445
tags question: http://stackoverflow.com/q/25787073
tags question: http://stackoverflow.com/q/25830693
tags question: http://stackoverflow.com/q/25729160
tags question: http://stackoverflow.com/q/25760522
tags question: http://stackoverflow.com/q/25786009
tags question: http://stackoverflow.com/q/25726889
type: Tag
tags question: http://stackoverflow.com/q/25830036

http://stackoverflow.com/comment/40408125
type: AnswerComment
score: 0
type: Comment
has text: @Prog You can have a TreeMap with a custom comparator.
comment on: http://stackoverflow.com/a/25828898

http://stackoverflow.com/comment/40439373
score: 0
has text: Partly for using in a Maven plugin, I offer some cool new features in version 0.3 which is released some time this month. It will allow you to redefine methods of existing classes using the existing API. In general, you want to avoid the byte code API and use the high-level API. I am curious what your use case is that you need the byte code level?
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/25822181

http://stackoverflow.com/q/25817729
has comment: http://stackoverflow.com/comment/40388165
downvote count: 1
type: Question
has body: I have a 64 bit integer that I would like to interpret as a float. I don't mean I want to re-assign something like 4 to 4.0. I have the follow 8 bytes of data: Dec (int): 4619191942746344941 Dec (float): 6.6666000000000000 Hex: 401AAA9930BE0DED I have 4619191942746344941 stored in a variable in my java code. How do I convert this to 6.6666000000000000?
score: 1
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/25817764
has answer: http://stackoverflow.com/a/25817765
has comment: http://stackoverflow.com/comment/40400435
has comment: http://stackoverflow.com/comment/40394216
favorite count: 0
type: UnansweredQuestion
tagged with: double
has comment: http://stackoverflow.com/comment/40388522
has title: Java Interpret 64 bit Integer as a float
upvote count: 2

http://stackoverflow.com/q/25808705
accepted answer: http://stackoverflow.com/a/28876236
has title: How to change the text in the thread group display in CDT-based eclipse debugger?
has comment: http://stackoverflow.com/comment/46009588
type: AnsweredQuestion
upvote count: 5
tagged with: java
tagged with: eclipse
type: Question
tagged with: eclipse-cdt
score: 5
has body: I have a CDT-based debugger and want to add some information into the lettering in the thread node. I want the lettering surrounded by the red rectangle to display some additional information (see screenshot below). AFAIR, the format string for this label is set in the property ThreadVMNode_No_columns__text_format in file C:\Users\...\workspace\org.eclipse.cdt.dsf.gdb.ui\src\org\eclipse\cdt\dsf\gdb\internal\ui\viewmodel\launch\MessagesForGdbLaunchVM.properties. # {0} - name available, 0=not available/1=available # {1} - name # {2} - ID available, 0=not available/1=available # {3} - ID # {4} - OS Thread ID available, 0=not available/1=available # {5} - OS Thread ID # {6} - Core available, 0=not available/1=available # {7} - Core # {8} - 0=running/1=suspended # {9} - state change reason available, 0=not available/1=available # {10} - state change reason # {11} - state change details available, 0=not available/1=available # {12} - state change details ThreadVMNode_No_columns__text_format={0,choice,0#Thread|1#{1}}{2,choice,0#|1# [{3}]}{4,choice,0#|1# {5}}{6,choice,0#|1# [core: {7}]} ({8,choice,0#Running|1#Suspended}{9,choice,0#|1# : {10}}{11,choice,0#|1# : {12}}) This format string is used in method org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.ThreadVMNode.createLabelProvider(): public class ThreadVMNode extends AbstractThreadVMNode implements IElementLabelProvider, IElementMementoProvider { [...] @Override protected IElementLabelProvider createLabelProvider() { PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider(); provider.setColumnInfo( PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS, new LabelColumnInfo(new LabelAttribute[] { // Text is made of the thread name followed by its state and state change reason. new GdbExecutionContextLabelText( MessagesForGdbLaunchVM.ThreadVMNode_No_columns__text_format, new String[] { ExecutionContextLabelText.PROP_NAME_KNOWN, PROP_NAME, ExecutionContextLabelText.PROP_ID_KNOWN, ILaunchVMConstants.PROP_ID, …
has answer: http://stackoverflow.com/a/28876236
downvote count: 0
tagged with: eclipse-rcp
answer count: 1
favorite count: 0

http://stackoverflow.com/q/25814212
type: Question
has comment: http://stackoverflow.com/comment/40381639
has comment: http://stackoverflow.com/comment/40381575
has comment: http://stackoverflow.com/comment/40381500
has comment: http://stackoverflow.com/comment/40381817
has comment: http://stackoverflow.com/comment/40381098
answer count: 1
has answer: http://stackoverflow.com/a/25817563
has comment: http://stackoverflow.com/comment/40382157
has title: i am unable to convert String in date so that i can insert it into mysql database
has comment: http://stackoverflow.com/comment/40381107
has comment: http://stackoverflow.com/comment/40381319
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25817563
score: 0
tagged with: java
tagged with: mysql
has body: I have a String that is containing a date value in format "dd/MM/yyyy". how can i insert it in mysql database(i already made a date column in my table with input type date ). I tried following but it failed and give error(can not find symbol). SimpleDateFormat format=new SimpleDateFormat("dd/MM/yyyy"); java.sql.Date d=new java.sql.Date(format.parse(p_date).getTime()); my whole code is as follow: public int save_paper_rec(String a_id, String title, String p_code, String p_date, String p_time, String p_type, String s_p, String s_n,String m_p,String m_n,String p_ins) { int aid=Integer.parseInt(a_id); float sp=Float.parseFloat(s_p); float sn=Float.parseFloat(s_n); float mp=Float.parseFloat(m_p); float mn=Float.parseFloat(m_n); int i=0; SimpleDateFormat format=new SimpleDateFormat("dd/MM/yyyy"); java.sql.Date d=new java.sql.Date(format.parse(p_date).getTime()); try { Connection con=DriverManager.getConnection(url,"root",""); Statement s=con.createStatement(); i=s.executeUpdate("insert into paper_record(a_id,title,p_code,p_date,p_time,p_type,s_p,s_n,m_p,m_n,p_ins) values('"+aid+"','"+title+"','"+p_code+"','"+d+"','"+p_time+"','"+p_type+"','"+sp+"','"+sn+"','"+mp+"','"+mn+"','"+p_ins+"')"); s.close(); con.close(); } catch(SQLException se) { System.out.println(se); } return(i); }

http://stackoverflow.com/comment/40424642
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25837961
has text: Define long. What are you comparing against?
score: 0

http://stackoverflow.com/comment/40418925
score: 0
has text: From the javadoc: 0 Number Yes Digit # Number Yes Digit, zero shows as absent
comment on: http://stackoverflow.com/q/25835033
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25760251
has body: They might be different, note the constructor that accepts a parameter: public NewClass (long time) { this.time = time; } If you construct two objects: NewClass xObj = new NewClass(12345678910); NewClass yObj = new NewClass(12345678919); Now xObj.isGreaterThan(yObj) will return false. Why? Let's see what's happening there: isGreaterThan is applied on xObj object, which has the class member time that has the value 12345678910. You're passing yObj that has it's own time, which has the value 12345678919 - And they are different, GetAsMs will return two different results when applied on different objects.
upvote count: 2
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/40282606
answers question: http://stackoverflow.com/q/25760218
accepted answer of: http://stackoverflow.com/q/25760218
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/40475426
type: Comment
has text: so again my question is can I use one simple trigger and one cron trigger together? As explained I need to give two options to the user, either to schedule job now or to schedule it later
comment on: http://stackoverflow.com/a/25862966
type: AnswerComment
score: 0

http://stackoverflow.com/a/25718064
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40205617
has comment: http://stackoverflow.com/comment/40205282
downvote count: 0
has comment: http://stackoverflow.com/comment/40205681
type: Answer
answers question: http://stackoverflow.com/q/25718046
has comment: http://stackoverflow.com/comment/40205192
has comment: http://stackoverflow.com/comment/40204559
has body: Just use a lookbehind to lookafter the string q=http: and lookahead to look before the string &amp;amp (?&lt;=q=http:).*?(?=\\s*&amp;amp) DEMO String s = "q=http://ibnlive.in.com/news/noidas-nithari-killings-sc-stays-execution-of-convict-surinder-koli-for-a-week/497153-3-242.html &amp;amp 1 hour agoNoida's Nithari killings: SC stays execution of convict Surinder Koli for a weekIBNLive - 1 hour agoNew Delhi: The Supreme Court has stayed the execution of Noida's Nithari killings convict\n" + " Surinder Koli for one week.\n" + "q=http://www.hindustantimes.com/india-news/nithari-killer-surinder-koli-to-be-hanged-on-sept-12-jail-authorities/article1-1260116.aspx &amp;amp\n"; Pattern regex = Pattern.compile("(?&lt;=q=http:).*?(?=\\s*&amp;amp)", Pattern.MULTILINE); Matcher matcher = regex.matcher(s); while(matcher.find()){ System.out.println(matcher.group(0)); } Output: //ibnlive.in.com/news/noidas-nithari-killings-sc-stays-execution-of-convict-surinder-koli-for-a-week/497153-3-242.html //www.hindustantimes.com/india-news/nithari-killer-surinder-koli-to-be-hanged-on-sept-12-jail-authorities/article1-1260116.aspx OR, This would match only the links which are preceeded by q= and starts with http: String s = "q=http://ibnlive.in.com/news/noidas-nithari-killings-sc-stays-execution-of-convict-surinder-koli-for-a-week/497153-3-242.html &amp;amp 1 hour agoNoida's Nithari killings: SC stays execution of convict Surinder Koli for a weekIBNLive - 1 hour agoNew Delhi: The Supreme Court has stayed the execution of Noida's Nithari killings convict\n" + " Surinder Koli for one week.\n" + "q=http://www.hindustantimes.com/india-news/nithari-killer-surinder-koli-to-be-hanged-on-sept-12-jail-authorities/article1-1260116.aspx &amp;amp\n"; Pattern regex = Pattern.compile("(?&lt;=q=)http:.*?(?=\\s*&amp;amp)", Pattern.MULTILINE); Matcher matcher = regex.matcher(s); while(matcher.find()){ System.out.println(matcher.group(0)); } Output: http://ibnlive.in.com/news/noidas-nithari-killings-sc-stays-…
has comment: http://stackoverflow.com/comment/40205581

http://stackoverflow.com/comment/40377087
comment on: http://stackoverflow.com/a/25808760
has text: This code works but is as slow as waiting for the Exception of try catch block
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/132383563
comment on: http://stackoverflow.com/a/58786832
has text: what happens if you notify() or cancel() a notifcation without passing a TAG, where you have 2 visible notifications with the same ID, but different tags? All both of them gonna be cancelled or updated?
score: 1
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40464638
type: Comment
has text: it did the trick, so basically it is just to make sure that we divide 34.0/ words rather than 34/words? sorry I tried to tag you in the comment but I couldnt figure it out.
comment on: http://stackoverflow.com/a/25859810
type: AnswerComment
score: 0

filewriter
tag name: filewriter
tags question: http://stackoverflow.com/q/25819834
type: Tag

http://stackoverflow.com/comment/40300103
type: Comment
score: 0
type: AnswerComment
has text: @user1071777 That's a good point.
comment on: http://stackoverflow.com/a/25769889

http://stackoverflow.com/comment/40368409
has text: Did you try to set the hex value(s) of the instruction to `10 14` (two byte values with a space between them)? Are you sure you can’t simply enter “bipush 20” into the third column?
comment on: http://stackoverflow.com/q/25807311
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40399472
has text: @HovercraftFullOfEels This is our friend from a few minutes ago, testing out the solution to his assignment question :)
score: 0
comment on: http://stackoverflow.com/q/25824269
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40449003
type: AnswerComment
comment on: http://stackoverflow.com/a/25851247
score: 0
type: Comment
has text: @Renatinn JSR-310 which is based on this library is in Java 8. You could try a back port of JSR-310 which you can drop in Java 8.

http://stackoverflow.com/a/25788256
answers question: http://stackoverflow.com/q/25788174
type: Answer
upvote count: 1
has body: You get the spaces with your split, I would use split with \\s+ which will remove the white space for you. String lang = "fr, de, gb, nl, se, es"; String[] languages = lang.split(",\\s+"); List&lt;String&gt; result = Arrays.asList(languages); if (result.contains("de")) { System.out.println("Result contains de"); } else { System.out.println("Result does not contain de"); } Output is Result contains de
score: 1
downvote count: 0

http://stackoverflow.com/comment/79033154
has text: @MarkoTopolnik you are correct.. have I mentioned I don't like java? :)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25824276
score: 1

http://stackoverflow.com/a/25835230
score: 0
type: Answer
has body: In order to have an (easily) testable class, they need to have a high degree of cohesion, which may not be your case You may want to consider moving any business logic to specific services or to the domain layer so that you can more easily test them. As you mentioned the most import part of your application is the UI, I would try to mock the TabClient dependencies, simulate (say) the press of a button by calling its action methods and then checking the mocked objects to make sure the appropriate flow was invoked (ie, assert the right methods of the right objects were called). You may need to refactor your classes a bit to make possible to mock their dependencies. Likewise, I would write tests for all relevant UI objects. I have never tested Swing applications to be honest, nevertheless I found the following links that might shed some light on your question (though some of them might require UI creation): UISpec4J Java World Stack Overflow
answers question: http://stackoverflow.com/q/25813213

http://stackoverflow.com/a/25800117
has body: It is not an issue with eclipse but with your inheritance of Student class in Studenttest. Generally if a superclass doesnot have a default constructor then the child class should have a constructor which should explicitly call the parent class constructor. In your case, your parent Student class has only one constructor with arguments so any class which extends Student should have a constructor which explicitly calls this constructor of Student using super(firstName. lastName) else java wont allow you to extend your class. As a solution for your problem you need not extend Student class in your StudentTest class. Generally any test class which tests a functionality of any other class need not extend it.
type: Answer
upvote count: 3
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25800035

http://stackoverflow.com/q/25829061
has comment: http://stackoverflow.com/comment/40408226
has answer: http://stackoverflow.com/a/25829531
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/40410342
answer count: 2
has comment: http://stackoverflow.com/comment/40408233
has comment: http://stackoverflow.com/comment/40408202
favorite count: 0
has comment: http://stackoverflow.com/comment/40410610
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25829101
upvote count: 1
has comment: http://stackoverflow.com/comment/40410723
has comment: http://stackoverflow.com/comment/40409869
has body: Trying to print out a^n but i get the error that a and n aren't defined as variables. Here is what I have now. public class FermatsTheorem { public static void main(String[] args) { fermatsTheorem(a, n); } public static void fermatsTheorem(double a, double n){ double aToTheNthPower = Math.pow(a,n); System.out.println("Fermat's Last Theorem: " + aToTheNthPower); } }
score: 0
tagged with: math
tagged with: java
has title: Putting a letter the nth power

http://stackoverflow.com/q/25730412
has body: I'm running a java application from java application using this code: Process proc = Runtime.getRuntime().exec(System.getProperty("java.home") + "/bin/java -jar launcher.jar", null, new File(installDir)); Is there any way to ensure that application will use 64-bit version of JRE if both are installed?
tagged with: jvm
score: 0
has title: Ensure that application will launch on 64 bit JVM if exists
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40227424
has comment: http://stackoverflow.com/comment/40227899
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/40228041
has comment: http://stackoverflow.com/comment/40228187

http://stackoverflow.com/a/25849417
type: Answer
has body: You can use the BouncyCastle provider. Just prepend your code with java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); and change the line KeyFactory keyFac = KeyFactory.getInstance("RSA"); into KeyFactory keyFac = KeyFactory.getInstance("RSA", "BC");
accepted answer of: http://stackoverflow.com/q/25849076
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25849076
score: 0

http://stackoverflow.com/comment/40291411
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25759045
has text: @AntonNovopashin not exactly. The OP there doesn't use Maven.

http://stackoverflow.com/comment/40361388
score: 0
type: Comment
type: QuestionComment
has text: Of course, but nothing changed
comment on: http://stackoverflow.com/q/25803174

http://stackoverflow.com/comment/40338072
type: Comment
score: 0
has text: That makes sense. But if I switch it to nextLine() I am not able to input anything when asked about my lifestyle.
comment on: http://stackoverflow.com/a/25790880
type: AnswerComment

http://stackoverflow.com/a/25793838
accepted answer of: http://stackoverflow.com/q/25793751
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40344677
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/40344180
answers question: http://stackoverflow.com/q/25793751
has body: the problem is that in setComSci() you are using map.addMarker but map is in MapActivity class. markers = new MarkerClass(); //&lt;--- ADD THIS markers.setComSci(map); //&lt;-- Call using this statement public class MarkerClass extends MapActivity{ String itemtype; LatLng coordinates; String name; GoogleMap map; public void setComSci(GoogleMap map){ this.map = map; name = "Computer Science Building"; itemtype = "Building"; coordinates= new LatLng(-33.956812, 18.461021); Marker comscimark = map.addMarker(new MarkerOptions() .position(coordinates) .draggable(true) .title(name)); } }

http://stackoverflow.com/q/25778502
has answer: http://stackoverflow.com/a/25778574
accepted answer: http://stackoverflow.com/a/25778594
tagged with: recursion
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
downvote count: 0
has title: How to display where the new middle is in recursive binary search
tagged with: binary-search
has answer: http://stackoverflow.com/a/25778594
favorite count: 0
has body: so my assignment is to implement the recursive binary search to find a target value in an integer array. I have all the code down, but I'm having trouble with this part: In each recursive call, output the mid-value you are checking against your target value. If the mid-value does not match the target, indicate if the next round will examine the top or the bottom half of the search array. Here is my code: public class anArray { private long[] a; // reference to array a in anArray() private int nElems; // number of elements public anArray(int max) // constructor { a = new long[max]; // creates new array nElems = 0; } public int size() // this will return the size of the array, { // or number of elements return nElems; } public int find(long search) // constructor to find search { return recFind(search, 0, nElems - 1); } private int recFind(long search, int lowerBound, int upperBound) { int mid = (lowerBound + upperBound) / 2; if (search == a[mid]) { return mid; // value found at anArray[mid] } else if (lowerBound &gt; upperBound) { return nElems; // can't find it } else // divide range { if (a[mid] &lt; search) // it's in the upper half { return recFind(search, mid + 1, upperBound); } else // it's in the lower half { return recFind(search, lowerBound, mid - 1); } } } public void insert(long v) // put element into array { int j; for (j = 0; j &lt; nElems; j++) // find where it goes { if (a[j] &gt; v) // linear search { break; } } for (int k = nElems; k &gt; j; k--) // move bigger ones up { a[k] = a[k - 1]; } a[j] = v; // insert it nElems++; // increment size } public void display() // displays array elements { for (int j = 0; j &lt; nElems; j++) // for each element, { System.out.println(a[j] + " "); // display it. } System.out.println(" "); } } And my demo: public class BinarySearchDemo { public static void main(String[] args) { int maxSize = 21; // array size anArray arr; // reference to array arr = new anArray(maxSize); // create the array arr.insert(45); // insert e…
upvote count: 2
possible better answer: http://stackoverflow.com/a/25778574
has comment: http://stackoverflow.com/comment/40316203

http://stackoverflow.com/q/25834981
tagged with: memory-leaks
favorite count: 0
has comment: http://stackoverflow.com/comment/40451892
tagged with: scala
type: UnansweredQuestion
has body: I have a system in Scala, with a lot of simultaneous threads and system calls. This system has some problem, because memory usage is increasing over time. The image bellow shows the memory usage for one day. When it gets to the limit, the process shuts down and I put a watch-dog to recover it again. I periodically run the command jcmd &lt;pid&gt; GC.run And this makes the memory to increase slowly, but the leak still happens. I analysed with jvisualvm, comparing to distinct moments in time, with 40 minutes delta. The image bellow shows the comparison between these two moments in time. Notice that there is an increase for instances of some classes like ConcurrentHashMap$HashEntry, SNode, WeakReference, char[] and String and many classes in the package scala.collection.concurrent. What can be causing the memory leak? Edit 1: Investigating JVisualVM, I noticed object of CNode and INode classes that are in TriedMap, that is instanced inside sbt.TrapExit$App class. Here is the object hierarchy figure:
has comment: http://stackoverflow.com/comment/40424151
downvote count: 1
has comment: http://stackoverflow.com/comment/57556926
type: Question
has comment: http://stackoverflow.com/comment/40422196
has title: Memory leak in Scala and processes
linked to: http://stackoverflow.com/q/3871960
linked to: http://stackoverflow.com/q/1218872
tagged with: java
has answer: http://stackoverflow.com/a/26114417
tagged with: memory
upvote count: 15
answer count: 2
linked to: http://stackoverflow.com/q/7944148
has answer: http://stackoverflow.com/a/26173962
score: 14

mapstruct
type: Tag
tags question: http://stackoverflow.com/q/25840792
tag name: mapstruct

http://stackoverflow.com/a/25811399
has body: Your methodA prototype says that it takes two int parameters, but you are calling it with an int and an int[] (ie an array of ints) in the following line: row[cellNumber] = methodA(cellNumber, row); Either change your function call or its prototype then.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25811320

http://stackoverflow.com/comment/40243324
comment on: http://stackoverflow.com/a/25738632
type: Comment
has text: Thanks for your comment, but it's the API of a given Java library that provides this clone method. How can I convince the Scala compiler to use JavaAPI.clone() now?
score: 0
type: AnswerComment

http://stackoverflow.com/q/25789323
has title: Achartengine library for BarChart in Android
tagged with: android
score: 0
tagged with: java
tagged with: achartengine
type: Question
accepted answer: http://stackoverflow.com/a/26082191
type: AnsweredQuestion
tagged with: charts
has comment: http://stackoverflow.com/comment/40336154
answer count: 1
has body: I use achartengine library in Project and I want remove bottom title from BarChart, but I don't know, how to remove this. https://i.sstatic.net/dVWxn.png
has answer: http://stackoverflow.com/a/26082191

http://stackoverflow.com/q/25817571
has body: I have the following code public class test{ public static void main(String[] args){ String one = "x"; if(one.charAt(one.indexOf('x')+1)== 'p'){ System.out.println("test"); } } } This results in the following error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1 at java.lang.String.charAt(String.java:658) at test.main(test.java:4) I expect this to happen and my understanding is that it's happening because the String only has 1 index (0) so it is not possible to locate the character at index 1 one.charAt(one.indexOf('x')+1)== 'p' If my understanding is correct, I can't understand why this other program doesn't have the same problem class XClass{ boolean doubleX(String str){ boolean is = false; int indexes = str.length()-1; if(str.indexOf('x')== indexes){ is = false; }else if(str.charAt(str.indexOf('x')+1)=='x'){//same code as the program above is = true; } return is; } } public class ImplementXClass{ public static void main(String[] args){ XClass Xmen = new XClass(); boolean result = Xmen.doubleX("x"); System.out.println(result); } } This program compiles successfully even though the method parameter is a String with one index ("x"). How can the program run this line str.charAt(str.indexOf('x')+1)=='x' if there's no index 1. Shouldn't it fail to compile as the first program? What am I missing?
has answer: http://stackoverflow.com/a/25817619
score: 0
answer count: 3
has title: Java - not getting "StringIndexOutOfBoundsException" when expected
accepted answer: http://stackoverflow.com/a/25817617
has answer: http://stackoverflow.com/a/25817614
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25817614
tagged with: java
tagged with: indexoutofboundsexception
has comment: http://stackoverflow.com/comment/40387819
type: Question
has answer: http://stackoverflow.com/a/25817617

http://stackoverflow.com/a/25834459
has comment: http://stackoverflow.com/comment/40417980
answers question: http://stackoverflow.com/q/25834428
score: 0
type: Answer
has body: First remove all white spaces and then split string.replaceAll("\\s+", "").split("(?!^)")

http://stackoverflow.com/q/25833056
possible better answer: http://stackoverflow.com/a/25867930
has comment: http://stackoverflow.com/comment/40415339
upvote count: 1
has answer: http://stackoverflow.com/a/25867930
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25868767
tagged with: java
tagged with: dom
has comment: http://stackoverflow.com/comment/40418025
tagged with: jsoup
answer count: 2
downvote count: 0
score: 1
favorite count: 0
has title: Print a DOM tree with Java?
has body: I have constructed a parsing algorithm using the Jsoup library. Is there any way to print the DOM tree with Java? for example: &lt;HTML/&gt; &lt;HEAD/&gt; &lt;TITLE/&gt; &lt;BODY/&gt; &lt;H1/&gt; &lt;H2/&gt; &lt;P/&gt;
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/25868767

http://stackoverflow.com/comment/40420135
score: 0
type: Comment
type: QuestionComment
has text: Thanks I understand it now. I'm sorry I'm new to all of this. I feel so dumb now :)
comment on: http://stackoverflow.com/q/25835595

http://stackoverflow.com/a/25819329
has body: Please use this code instead of your code and realize your mistake. public void doInsert1() { try { //create sql query String val1=this.getUsername(); String val2=this.getPassword(); System.out.println(val1); System.out.println(`Val2); String query = "INSERT INTO tbl_user(user_name,pass_word) VALUES('"+val1+"','"+val2+"')"; }
has comment: http://stackoverflow.com/comment/40390959
answers question: http://stackoverflow.com/q/25819288
score: -2
downvote count: 3
type: Answer
upvote count: 1

http://stackoverflow.com/q/25713607
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/40241800
has comment: http://stackoverflow.com/comment/40241824
has comment: http://stackoverflow.com/comment/40241875
has comment: http://stackoverflow.com/comment/40241895
answer count: 2
tagged with: jstl
has comment: http://stackoverflow.com/comment/40195906
downvote count: 0
tagged with: jsp
has comment: http://stackoverflow.com/comment/40242262
accepted answer: http://stackoverflow.com/a/25738050
favorite count: 0
has body: One EL config issue is there: <%@ page isELIgnored="false" %> ${10 + 15} While using the above statements I am getting the perfect output i.e. 25. Now I want to isELIgnored="false" for the entire web application so I modified the web.xml as: <?xml version="1.0" encoding="UTF-8"?> *.jsp false But not getting the proper output. What is wrong over there? Some additional steps are required or what? Please help. Thanks in advance
has comment: http://stackoverflow.com/comment/40200329
has comment: http://stackoverflow.com/comment/40200267
has comment: http://stackoverflow.com/comment/40200254
type: AnsweredQuestion
tagged with: el
linked to: http://stackoverflow.com/q/9676636
possible better answer: http://stackoverflow.com/a/25738274
upvote count: 3
has comment: http://stackoverflow.com/comment/40198807
has answer: http://stackoverflow.com/a/25738274
has comment: http://stackoverflow.com/comment/40242136
has comment: http://stackoverflow.com/comment/40203600
has title: Some Error in Expression Language Configuration <jsp-config>
type: Question
has answer: http://stackoverflow.com/a/25738050

http://stackoverflow.com/comment/40249481
score: 0
type: AnswerComment
has text: Right, but you can take a look on the PersistenceExceptionTranslator to get an idea of how the exception translation might be implemented.
comment on: http://stackoverflow.com/a/25739480
type: Comment

jvm
tags question: http://stackoverflow.com/q/25759740
tags question: http://stackoverflow.com/q/25793688
tags question: http://stackoverflow.com/q/25869884
tags question: http://stackoverflow.com/q/25842702
type: Tag
tags question: http://stackoverflow.com/q/25818068
tags question: http://stackoverflow.com/q/25860502
tags question: http://stackoverflow.com/q/25828623
tags question: http://stackoverflow.com/q/25828842
tags question: http://stackoverflow.com/q/25794653
tags question: http://stackoverflow.com/q/25867989
tag name: jvm
tags question: http://stackoverflow.com/q/25797359
tags question: http://stackoverflow.com/q/25839843
tags question: http://stackoverflow.com/q/25854603
tags question: http://stackoverflow.com/q/25728402
tags question: http://stackoverflow.com/q/25744720
tags question: http://stackoverflow.com/q/25810548
tags question: http://stackoverflow.com/q/25799913
tags question: http://stackoverflow.com/q/25823378
tags question: http://stackoverflow.com/q/25730412
tags question: http://stackoverflow.com/q/25753966
tags question: http://stackoverflow.com/q/25859418
tags question: http://stackoverflow.com/q/25833208

http://stackoverflow.com/comment/40441197
score: 0
comment on: http://stackoverflow.com/a/25841907
has text: I need to give both options, thats run now and schedule later..As for now.. I am running the job with a 2 seconds gap, but it seems the job is running again and again and again ! :(
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40347681
comment on: http://stackoverflow.com/a/25795483
has text: JSP method seems suitable to me for now. I will try that. Thanks
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/25862153
has body: There is search history menu in the search window. show previous searches is the button you are looking for.
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25862084
answers question: http://stackoverflow.com/q/25862084

http://stackoverflow.com/a/25869156
has body: TL;DR Recast your task as testing an implementation of an API. As the algorithm is expressed in terms of concepts (hypothesis, translation option) that are themselves quite complicated, program it bottom-up by first developing (using TDD) classes that encapsulate those concepts. As the algorithm is not language specific, but abstracts language specific operations (all translation options, if applicable), encapsulate the language specific parts in a separate object, use dependency injection for that object, and test using simple fake implementations of that object. Use your knowledge of the algorithm to suggest good test cases. Test the API By focusing on the implementation (the algorithm), you are making a mistake. Instead, first imagine you had a magic class which did the job that the algorithm performs. What would its API be? What would its inputs be, what would its outputs be? And what would the required connections between the inputs and outputs be. You want to encapsulate your algorithm in this class, and recast your problem as generating this class. In this case, its seems the input is a sentence that has been tokenized (split into words), and the output is a tokenized sentence , which has been translated into a different language. So I guess the API is something like this: interface Translator { /** * Translate a tokenized sentence from one language to another. * * @param original * The sentence to translate, split into words, * in the language of the {@linkplain #getTranslatesFrom() locale this * translates from}. * @return The translated sentence, split into words, * in the language of the {@linkplain #getTranslatesTo() locale this * translates to}. Not null; containing no null or empty elements. * An empty list indicates that the translator was unable to translate the * given sentence. * * @throws NullPointerException * If {@code original} is null, or contains a null element. * @throws IllegalArgumentException * If {@code original} is empty or has any empt…
type: Answer
has comment: http://stackoverflow.com/comment/40579279
has comment: http://stackoverflow.com/comment/40539432
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25868255
downvote count: 0

http://stackoverflow.com/a/26835901
score: 0
has body: I am not exactly sure if this is what fixed the problem or not, on Chrome, but fixing the:ViewExpiredException exception problem here, using BalusC's answer, also appeared to fix this one as well. Either that or Google's guys have fixed it in the last day or so and it is just coincidence. Because the problem cookies have been cleared, I have been unable to reproduce the error to check if that was actually the cause of the null pointer problem in Chrome. Why it is only affecting Chrome is any ones guess.
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/25760433
answers question: http://stackoverflow.com/q/25760433

http://stackoverflow.com/a/25845300
score: 0
type: Answer
has body: No. There is no need to. Local variables aka method variables which places on stack vanishes when we exit the local scope.
answers question: http://stackoverflow.com/q/25845280

http://stackoverflow.com/comment/40239708
type: Comment
comment on: http://stackoverflow.com/a/25724808
score: 0
type: AnswerComment
has text: Please read the question properly. I have to do it with the help of an InsertBuilder.

http://stackoverflow.com/comment/40304231
has text: Is the glashfish registry available using JNDI from a client? It could be a matter of having camel-cdi fallback to use JNDi if its not found in the CDI registry.
score: 0
comment on: http://stackoverflow.com/q/25741585
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25845318
answer count: 1
tagged with: jpa
has comment: http://stackoverflow.com/comment/40442831
has comment: http://stackoverflow.com/comment/40478194
tagged with: spring
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40445365
tagged with: java
accepted answer: http://stackoverflow.com/a/25849982
type: Question
has body: I have one question related to JPA relations. Is it possible to define one relation to different classes? Ej: Foo has a one-to-one relation (or many-to-one) with Boo or Too class (both can extend the same abstract class) but not a relation with both at the same time. Thanks! More details It will be something like: @Entity class Foo { @Id int id; @OneToOne(fetch=FetchType.LAZY) @JoinColumn(name="MOO_ID") Moo moo; } Interface Moo{} @Entity class Too implements Moo{} @Entity class Boo implements Moo{} And my database needs only one reference to the correct table Too or Boo.
has comment: http://stackoverflow.com/comment/40446126
has answer: http://stackoverflow.com/a/25849982
score: 0
has title: JPA map relations related to different classes

http://stackoverflow.com/comment/40268915
type: QuestionComment
comment on: http://stackoverflow.com/q/25751917
has text: You're going to want to try a regex match to see if the string "can be parsed" (i.e., it has numbers and slashes in the correct places, and no characters, etc). Then if it fails to match it's "not parseable". After that you can attempt to DateFormat it. If it fails at that time it will be because the date wasn't "valid"
score: 0
type: Comment

http://stackoverflow.com/a/25803773
has comment: http://stackoverflow.com/comment/40371177
score: 0
has body: How does your "Mohammad Omar" query look like in terms of code? If you need just this exact phrase, feed this string into a PhraseQuery or if you use QueryParser, wrap this phrase into quotes to produce PhraseQuery. If you need both this phrase as well as documents containing both terms separately in the search results, you could include "Mohammad Omar" both as a phrase (as specified above) and as separate terms, something like this: some_field:"Mohammad Omar" some_field:Mohammad some_field:Omar. You can also add boosting for the phrase element so that phrase results rank higher.
type: Answer
has comment: http://stackoverflow.com/comment/40370323
answers question: http://stackoverflow.com/q/25798832

http://stackoverflow.com/a/39205848
has comment: http://stackoverflow.com/comment/113256941
has comment: http://stackoverflow.com/comment/116263607
has comment: http://stackoverflow.com/comment/73743529
has comment: http://stackoverflow.com/comment/73791046
has comment: http://stackoverflow.com/comment/70097046
has comment: http://stackoverflow.com/comment/112906205
has comment: http://stackoverflow.com/comment/70098359
score: 38
upvote count: 41
has comment: http://stackoverflow.com/comment/70092408
type: Answer
answers question: http://stackoverflow.com/q/25713157
has comment: http://stackoverflow.com/comment/69446891
has body: For anyone still looking around. I generated a timestamp and used it as the id. import java.util.Date; import java.util.Locale; public int createID(){ Date now = new Date(); int id = Integer.parseInt(new SimpleDateFormat("ddHHmmss", Locale.US).format(now)); return id; } Use it like so int id = createID(); mNotifyManager.notify(id, mBuilder.build());
downvote count: 3
has comment: http://stackoverflow.com/comment/70139473

http://stackoverflow.com/comment/40455338
has text: I do get the logic in it and understand the code. Think it will be some time before I come up with the simplest solutions like this one though, but practice should take me there. Thank you
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25854742

http://stackoverflow.com/comment/40293334
type: QuestionComment
has text: I have solved by reference of [http://examples.javacodegeeks.com/java-basics/arrays-java-basics/java-string-array-example/] WHAT I DID I JUST CREATE String[] SearchElements=new String[4]; AND RETURN SearchElements and then used the following String [] namelist=DocBuilderClass.username(); for(int i=0;i<namelist.length;i++) { String abc=namelist[i]; googlebox.sendKeys(abc); googlebox.clear(); googlebox.sendKeys(namelist[i]); }
comment on: http://stackoverflow.com/q/25746375
score: 0
type: Comment

http://stackoverflow.com/comment/40484793
has text: Aha, thanks. How would I go about initialising jim and bob outside of the main method then? I tried initialising them on the same line as I declared them, but then I can't reference them from inside main().
comment on: http://stackoverflow.com/a/25870995
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/25728280
has answer: http://stackoverflow.com/a/25728525
tagged with: concurrency
has comment: http://stackoverflow.com/comment/40223422
has comment: http://stackoverflow.com/comment/40223546
score: 0
has comment: http://stackoverflow.com/comment/40223553
answer count: 1
has body: I have build a java application which is copying a folder to a USB pen drive. I have done it nicely with, org.apache.commons.io.FileUtils.copyDirectory(source, destination); But now I need to make the application to copy that folder to 10-20 USB pen drives in parallel.I know java concurrency a little.but as the file is about 125MB ,and reading from the same location.i have some doubts.and I need a way to start.Please give me some Ideas. Thank you EXPERTS. Edit I have completed the Project successfully.I've used the Runnable to each USB device And for the issue "reading from the same location" I've used the RAMDISC.It is working fine. Thank you for your help.
has comment: http://stackoverflow.com/comment/40223584
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40223478
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/40223555
has title: Java File Copying - same file to 10/20 USB devices parallely
type: Question

http://stackoverflow.com/q/25715067
has answer: http://stackoverflow.com/a/42100002
tagged with: java
has answer: http://stackoverflow.com/a/34288711
has comment: http://stackoverflow.com/comment/124986089
has title: jmap command not found
type: Question
has answer: http://stackoverflow.com/a/60776563
score: 28
has body: I'm trying to use the jmap command on my CentOS server but it keeps telling me that the command was not found even though I have the JDK installed. Here is the output of command java -version: java version "1.7.0_25" OpenJDK Runtime Environment (rhel-2.3.10.4.el6_4-x86_64) OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode) How can I fix this issue?
has comment: http://stackoverflow.com/comment/40203354
has answer: http://stackoverflow.com/a/61256442
tagged with: centos
has answer: http://stackoverflow.com/a/25715142
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/38002156
favorite count: 0
upvote count: 28
tagged with: linux
has answer: http://stackoverflow.com/a/57010038
type: UnansweredQuestion

http://stackoverflow.com/a/25807490
upvote count: 3
has comment: http://stackoverflow.com/comment/40369946
answers question: http://stackoverflow.com/q/25807386
type: AcceptedAnswer
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/40370618
downvote count: 0
has comment: http://stackoverflow.com/comment/40368303
has comment: http://stackoverflow.com/comment/40370747
has comment: http://stackoverflow.com/comment/40370363
accepted answer of: http://stackoverflow.com/q/25807386
has comment: http://stackoverflow.com/comment/40438526
has body: maybe this helps? public enum MyEnum { Emails("mail1", "mail2", "mail3"), Usernames("username1", "username2"), CategoryN("a", "b", "c"); private String[] strings; private MyEnum(String... strings) { this.strings = strings; } @Override public String toString() { return Arrays.toString(strings); } public String getString(int index) { return strings[index]; } } Main public static void main(String[] args) { System.out.println(MyEnum.Emails); //[mail1, mail2, mail3] System.out.println(MyEnum.Emails.getString(1)); //mail2 }

http://stackoverflow.com/a/25870473
type: Answer
answers question: http://stackoverflow.com/q/25857329
score: 0
has body: The solution is to use compound comparators: books.stream().sorted(Comparator .comparing(b-&gt;b.type) .thenComparing(b-&gt;b.availableUntilDate)) .limit(4).forEach(b-&gt;{ //whatever you want to do with them }); This will give you a stream of the books

http://stackoverflow.com/a/76762682
type: Answer
answers question: http://stackoverflow.com/q/25737269
has body: Follow this steps, Step1: If you are using Windows OS, Use gitbash tool . If you are using MAC OS, use terminal. Step2: Go to your git project location using #cd &lt;patch_of_project&gt; Step3: #git stash Step4: #git pull Step5: #git stash apply Step6 : resolve conflict manually by this , Changes mentioned as Head(&lt;&lt;&lt;&lt;&lt;&lt; HEAD) is your change, Changes mentioned in branch(&gt;&gt;&gt;&gt;&gt;&gt;&gt; branch) is other person change, you can update file accordingly.
score: 0

http://stackoverflow.com/comment/40224221
has text: It can take two or three minutes to compute the hierarchy when I use "F4" or something similar. I'd like to have Eclipse pre-compute hierarchies before then; presumably as some kind of batch job.
comment on: http://stackoverflow.com/q/25716897
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40243776
type: Comment
has text: How. I dont see a way to Do this without amending Function interface by adding one more generic parameter which will represent real derived interface. It will look ugly
comment on: http://stackoverflow.com/a/25727462
score: 0
type: AnswerComment

http://stackoverflow.com/q/25789137
has body: I imported project and when i run project got this Launch configuration ANSIBuffer (1) references non-existing project ooo. and when i run class as java application got this Selection doesn't contain main type I'm on Eclipse Kepler
answer count: 1
score: 0
type: UnansweredQuestion
has title: Launch configuration ANSIBuffer (1) references non-existing project ooo
has answer: http://stackoverflow.com/a/25789443
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/q/25862727
type: Question
downvote count: 2
has title: Converting integer to float datatype in string
score: -2
tagged with: types
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40469720
has comment: http://stackoverflow.com/comment/40469757
tagged with: regex
has comment: http://stackoverflow.com/comment/40469900
upvote count: 0
accepted answer: http://stackoverflow.com/a/25862755
has body: I'm using Beanshell interpreter to evaluate simple math expressions like 5*3*(2+4)/2.2 the problem is to convert for example the above expressions in Java into 5.0*3.0*(2.0+4.0)/2.2 This is because I want floating-point result. What regexp can be used to achieve this?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25862755

http://stackoverflow.com/a/44117808
has body: I could not find a way to configure this in the pom.xml or settings.xml There is a good solution on unix systems, edit your .bashrc and add an alias. alias mvnp='mvn -T 4' now from the terminal run maven using mvnp mvnp clean install
score: 3
upvote count: 3
downvote count: 0
answers question: http://stackoverflow.com/q/25720014
type: Answer

http://stackoverflow.com/comment/40233106
comment on: http://stackoverflow.com/a/25733054
score: 0
type: Comment
has text: :D yeah, but it's bad practice, isn't it?
type: AnswerComment

http://stackoverflow.com/comment/40218162
type: QuestionComment
has text: @zero_dev This is my first ever GUI, so I'm obviously naive about a few things. I think I'd need the JLabel because when the action is performed, it would need to do things like check legal moves and attributes of the piece, all instance variables of elements at coords (i, j).
type: Comment
comment on: http://stackoverflow.com/q/25725085
score: 0

http://stackoverflow.com/comment/40403866
type: Comment
score: 1
has text: No,unless you perform a kind of splitting using some regex techniques!
comment on: http://stackoverflow.com/a/25826655
type: AnswerComment

http://stackoverflow.com/a/25829297
type: Answer
has body: You need to initialize a variable before you use it ... By doing this you will get an null pointer public Button button; public int buttonX = button.x; Because button is not initialized yet. button is null and you get a null pointer when you try to perform some action on an object which is null.
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/25829281

http://stackoverflow.com/a/25810729
score: 0
type: Answer
has body: I changed my return slightly to read &lt;script type="text/javascript"&gt; function beforeDelete() { var n = $('input:checked').length; return n &gt; 0 &amp;&amp; confirm('Are you sure you want to delete this item?'); } &lt;/script&gt;
answers question: http://stackoverflow.com/q/25796736

http://stackoverflow.com/comment/40236267
score: 0
type: AnswerComment
has text: Thanks a lot, this is what i exactly wanted. As i said, iam a newbie to drools, Our application is full j2ee application, One of our client requested us to do some validation using drools
type: Comment
comment on: http://stackoverflow.com/a/25718143

http://stackoverflow.com/comment/40253154
type: Comment
has text: For example in my application every entity(Hibernate entity) is Serializable.Because my web application exist in different server and my database is in different server.That is the reason we have implemented Serializable.In this case can u explain how serialization is working?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25744283

http://stackoverflow.com/a/25785468
accepted answer of: http://stackoverflow.com/q/25766931
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25766931
type: Answer
upvote count: 1
score: 1
has body: I found the answer here in the tomcat docs at /docs/config/context.html The syntax in context.xml should be (I was correct from the beginnig here): &lt;Context&gt; &lt;Parameter name="hostname" value="&lt;some-ip-address&gt;" override="false"/&gt; &lt;/Context&gt; and the call to read it should be: getServletConfig().getServletContext().getInitParameter("hostname"); OR getServletContext().getInitParameter("hostname"); I'm sure I have a lot more to learn (for example to have separat params for separate web applications in Tomcat, but this is good for now).

http://stackoverflow.com/q/25789047
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40341415
has answer: http://stackoverflow.com/a/25793253
has comment: http://stackoverflow.com/comment/40343720
downvote count: 0
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/40334671
has comment: http://stackoverflow.com/comment/40334890
answer count: 3
possible better answer: http://stackoverflow.com/a/25789240
has answer: http://stackoverflow.com/a/25789240
has answer: http://stackoverflow.com/a/25789483
accepted answer: http://stackoverflow.com/a/25793253
has body: I have code which creates a chessboard. It was working recently but I'm not sure what I changed. When I run it an empty window appears. import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.util.Scanner; public class Chess extends JFrame implements ActionListener { JButton[][] a = new JButton[8][8]; //This is the individual squares of the game board JPanel board = new JPanel(); //The first instance of the game board int lineCounter = 0; //Records the current horizontal row String[][] pieceList = new String[8][8]; //This list has the game pieces recorded in it public Chess() { //Create the board setTitle("CHESS"); setSize(600,600); //Sets the window size to 600x600 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new GridLayout(8,8)); //Sets the game board to an 8x8 grid for (int i = 0; i &lt; 8; i++) { /*This nested loop determines the colour of the the board squares, and which colour pieces should go onton which tiles.*/ for (int j = 0; j &lt; 8; j++){ if((i+j)%2 == 0 &amp;&amp; lineCounter &lt; 3) { //This if statement sets the top part of the game board, and sets the red pieces pieceList[i][j] = "RedPiece"; a[i][j] = new JButton(); a[i][j].setBackground(Color.black); board.add(a[i][j]); } else if ((i+j)%2 == 0 &amp;&amp; lineCounter &gt;= 5) { //This if statement sets the bottom of the board, and the blue pieces pieceList[i][j] = "BluePiece"; a[i][j] = new JButton(); a[i][j].setBackground(Color.black); board.add(a[i][j]); } else if ((i+j)%2 == 0 &amp;&amp; 3 &lt;= lineCounter &amp;&amp; lineCounter &lt; 5) { //This if statement sets the middle of the game board pieceList[i][j] = null; a[i][j] = new JButton(); a[i][j].setBackground(Color.black); board.add(a[i][j]); } else { pieceList[i][j] = null; a[i][j] = new JButton(); a[i][j].setBackground(Color.gray); board.add(a[i][j]); } } lineCounter++; } } A for loop follows that adds the new JButtons and sets the background colours. The setVisible(true) is in a separate class. I'll be hap…
has title: JPanel chessboard not displaying
tagged with: jframe
has comment: http://stackoverflow.com/comment/40334717
has comment: http://stackoverflow.com/comment/40337945
linked to: http://stackoverflow.com/q/21142686
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/40359479
has comment: http://stackoverflow.com/comment/40334868

http://stackoverflow.com/comment/40445440
type: AnswerComment
has text: that would make a lot of sense. thanks. didn't think about that :)
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25812674

http://stackoverflow.com/comment/40231857
comment on: http://stackoverflow.com/a/25731252
has text: how can i make so that its T[]?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/25771713
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25771575
answers question: http://stackoverflow.com/q/25771575
type: Answer
has body: This is not a good way of checking for success or failure. You should instead rewrite myTest.jar to use System.exit(0) on success and System.exit(1) (or higher) on error. If the program is well written, it will already do this. You can then check for success or failure in bash using e.g. if java -jar mytest.jar then echo "The command succeeded :D" else echo "The command failed :(" fi All UNIX programs work this way, and you should make sure that myTest.jar is no exception.
has comment: http://stackoverflow.com/comment/40345375
score: 7
upvote count: 7

http://stackoverflow.com/a/25852283
has comment: http://stackoverflow.com/comment/40450912
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40454944
has body: Use a static variable and increment it: public class Cls { private static int count = 0; private int id; public Cls() { id = count; count++; } } The first object will have id = 0, the second one will have id = 1, etc. Limitation: This method is the simplest one, but it won't work if you want to have an application that uses many threads. Multithreading If you are in a multithreading context, you'll need to be sure that you have some expected results. Some possible methods: 1) Use a class from java.util.concurrent.atomic ( E.g. AtomicInteger ) (according to OldCurmudgeon) 2) Instead of count++, call a synchronized method that has the following structure: public static synchronized void incrementCount() { count++; } 3) Use an additional object for synchronization: private static final Object lock = new Object(); and then use it to synchronize the increment operation: public void increment() { synchronized(lock) { count++; } }
answers question: http://stackoverflow.com/q/25852227
downvote count: 0

http://stackoverflow.com/q/25778570
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25778790
tagged with: java
accepted answer: http://stackoverflow.com/a/25778790
has comment: http://stackoverflow.com/comment/40316291
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40316226
tagged with: console
type: Question
has body: I have this situation: I have a base class public class Vehicle { private String atrb1; private String atrb2; } And some classes that inherit from it public class Car extends Vehicle { private String anotheratrb1; } public class Bus extends Vehicle { ... } public class Truck extends Vehicle { ... } I'm doing a Java Console Application, and the user can choose the type of vehicle he wants to register, is there any way to get the type of vehicle he typed and through a method decide which class that inherit from vehicle I will persist the bank? Without any switch-cases and ifs, using something like generics, because in the future the user will have the option to add new types, and this can break a switch-case or if-else for example. I did a lot of research and found reflection. There's another way to do it? Thanks!
has comment: http://stackoverflow.com/comment/40316305
has comment: http://stackoverflow.com/comment/40316346
tagged with: generics
has title: There's a way to make a generic persist? [Java Console]

http://stackoverflow.com/comment/137360723
score: 1
comment on: http://stackoverflow.com/a/25856905
type: AnswerComment
type: Comment
has text: Since Java 9, there is now `InputStream.readAllBytes()`

http://stackoverflow.com/comment/40478330
type: Comment
has text: Working with the hidden window... that's what I was missing... I got to make some changes for integration but hidden window concept was all I need. Thanks for your answer.
comment on: http://stackoverflow.com/a/25824639
score: 0
type: AnswerComment

installation
tags question: http://stackoverflow.com/q/25837505
tag name: installation
type: Tag
tags question: http://stackoverflow.com/q/25858243
tags question: http://stackoverflow.com/q/25832501

http://stackoverflow.com/comment/40409085
type: Comment
score: 0
comment on: http://stackoverflow.com/q/25829484
type: QuestionComment
has text: Also, why does your loop start at 11 instead of 18? `2darray[18][1]` would be glad to be a candidate too! :D

http://stackoverflow.com/a/25854786
has body: First of all, when doing file I/O in Java, you should properly handle all exceptions and errors that can occur. In general, you need to open streams and resources in a try block, catch all exceptions that happen in a catch block and then close all resources in a finally block. You should read up more on these here as well. For using a Scanner object, this would look something like: String token = null; File file = null; Scanner in = null; try { file = new File("/path/to/file.txt"); in = new Scanner(file); while(in.hasNext()) { token = in.next(); // ... } } catch (FileNotFoundException e) { // if File with that pathname doesn't exist e.printStackTrace(); } finally { if(in != null) { // pay attention to NullPointerException possibility here in.close(); } } You can also use a BufferedReader to read a file line by line. BufferedReader reader = new BufferedReader(new FileReader("/path/to/file.txt")); String line = null; while ((line = reader.readLine()) != null) { // ... } With added exception handling: String line = null; FileReader fReader = null; BufferedReader bReader = null; try { fReader = new FileReader("/path/to/file.txt"); bReader = new BufferedReader(fReader); while ((line = bReader.readLine()) != null) { // ... } } catch (FileNotFoundException e) { // Missing file for the FileReader e.printStackTrace(); } catch (IOException e) { // I/O Exception for the BufferedReader e.printStackTrace(); } finally { if(fReader != null) { // pay attention to NullPointerException possibility here try { fReader.close(); } catch (IOException e) { e.printStackTrace(); } } if(bReader != null) { // pay attention to NullPointerException possibility here try { bReader.close(); } catch (IOException e) { e.printStackTrace(); } } } In general, use the Scanner for parsing a file, and use the BufferedReader for reading the file line by line. There are other more advanced ways to perform reading/writing operations in Java. Check out some of them here
downvote count: 0
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25854729

http://stackoverflow.com/comment/40282123
type: QuestionComment
has text: The app shouldn't crash when you call empty methods. You still get those ClassCastException errors ? You're saying openRecommended is empty but it's not the case in the above code. Could you update the question with the new errors you're getting and the updated code (use pastebin in case there's a lot of it and you want to keep your question clean) ? thanks ;)
score: 0
comment on: http://stackoverflow.com/q/25753953
type: Comment

http://stackoverflow.com/q/25731303
has body: My Existing system read all files from a particular folder, and ran MapReduce on it. Code given below: Path path = new Path(inputPath) if (!FileSystem.get(conf).exists(path)) { System.out.println("Path does not exist (skipping): " + path); return 1; } FileInputFormat.setInputPaths(conf, inputPath); This ran without any problem. Now, recent file changes required me to specify which files to use as input. I changed code to this: for(String fileName:filePath.split(",")){ MultipleInputs.addInputPath(conf, new Path(fileName), TextInputFormat.class, RawLogMapper.class); // MultipleInputs.addInputPath(conf, new Path(fileName), TextInputFormat.class); } where filePath is a comma-separated list of absolute file paths that need to be processed. I'm using mapred, not mapreduce. import org.apache.hadoop.mapred.Reporter; import org.apache.hadoop.mapred.TextInputFormat; import org.apache.hadoop.mapred.lib.MultipleInputs; import org.apache.hadoop.mapred.lib.MultipleTextOutputFormat; Upon changing the code, I'm encountered with the following error: 14/09/08 13:50:05 INFO mapred.JobClient: Task Id : attempt_201408201501_1196_m_000000_1, Status : FAILED java.lang.RuntimeException: Error in configuring object at org.apache.hadoop.util.ReflectionUtils.setJobConf(ReflectionUtils.java:109) at org.apache.hadoop.util.ReflectionUtils.setConf(ReflectionUtils.java:75) at org.apache.hadoop.util.ReflectionUtils.newInstance(ReflectionUtils.java:133) at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:413) at org.apache.hadoop.mapred.MapTask.run(MapTask.java:332) at org.apache.hadoop.mapred.Child$4.run(Child.java:268) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:396) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1438) at org.apache.hadoop.mapred.Child.main(Child.java:262) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method…
score: 1
tagged with: java
upvote count: 1
has title: Hadoop MultipleInputs fails with RuntimeException
type: Question
has answer: http://stackoverflow.com/a/25733809
tagged with: mapreduce
tagged with: hadoop
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/25733809
type: AnsweredQuestion

http://stackoverflow.com/comment/40228879
score: 3
type: AnswerComment
type: Comment
has text: Even better to create a UsernameModel instead of using String directly. Wicket can reuse a constructed component tree, so you don't have to go through all constructors etc again. To be able to reuse a label, the model value should change, not the component itself,
comment on: http://stackoverflow.com/a/25714401

http://stackoverflow.com/comment/40350080
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25796945
score: 0
has text: changing it to <context:component-scan base-package="com.aucklanduni.spring.webservices.service" /> also gives me the same error

http://stackoverflow.com/a/25805374
upvote count: 10
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/40364886
has comment: http://stackoverflow.com/comment/40364988
accepted answer of: http://stackoverflow.com/q/25805231
score: 10
answers question: http://stackoverflow.com/q/25805231
has comment: http://stackoverflow.com/comment/40365317
has body: The reason of the misbehaviour is a wrong initialization sequence: new SubClass() executes AClass constructor AClass constructor calls aMethod() aMethod() shows x (which is 0 so far) and y which is 6 because of being static) SubClass initialize its non-static fields, so x becomes 5. To avoid surprizes, never call virtual methods (esp. overriden) in constructors
type: AcceptedAnswer

http://stackoverflow.com/q/25712994
tagged with: user-interface
tagged with: android
possible better answer: http://stackoverflow.com/a/25713104
has title: Is there a way to create/edit a theme in Android from Java?
type: AnsweredQuestion
has body: I was wondering if anyone knows how to create/edit themes in Android from Java? I am already aware of all possible ways of coloring views and creating custom views, but I need specifically to change or create a new app theme from code. Any hint would be appreciated!
tagged with: dynamic
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25713104
has answer: http://stackoverflow.com/a/33502516
tagged with: themes
accepted answer: http://stackoverflow.com/a/33502516
score: 0

http://stackoverflow.com/a/47127155
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/25869428
downvote count: 0
has body: I've created a ClassPathResourceReader class in a Java 8 way to make easy read files from classpath import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.stream.Collectors; import org.springframework.core.io.ClassPathResource; public final class ClassPathResourceReader { private final String path; private String content; public ClassPathResourceReader(String path) { this.path = path; } public String getContent() { if (content == null) { try { ClassPathResource resource = new ClassPathResource(path); BufferedReader reader = new BufferedReader(new InputStreamReader(resource.getInputStream())); content = reader.lines().collect(Collectors.joining("\n")); reader.close(); } catch (IOException ex) { throw new RuntimeException(ex); } } return content; } } Utilization: String content = new ClassPathResourceReader("data.sql").getContent();
score: 5

http://stackoverflow.com/q/25867387
answer count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/40477891
tagged with: java
score: 0
has title: How to create a web service in java with Reply To parameter
has comment: http://stackoverflow.com/comment/40477954
tagged with: callback
tagged with: reply
tagged with: rest
tagged with: asynccallback
has body: Hi I am working with a REST web services in java and I am looking for a solution for handling the reply of the service. I want if client call the service it will pass another URL to the REST service so that it will automatically reply to that service not to client.

http://stackoverflow.com/comment/40432680
type: QuestionComment
score: 0
has text: Same that you want but for "uname -a" [here](http://stackoverflow.com/a/792049/797462).
type: Comment
comment on: http://stackoverflow.com/q/25842079

http://stackoverflow.com/comment/97498859
has text: @vikingsteve - Could you please help me in this related question ? https://stackoverflow.com/questions/55388561/intellij-idea-how-to-run-specific-testng-groups-in-a-class
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25742323
score: 0

http://stackoverflow.com/comment/40245805
type: QuestionComment
comment on: http://stackoverflow.com/q/25740088
has text: What does `UIManager.getIcon("close")` return? Or did you try anything else?
score: 0
type: Comment

http://stackoverflow.com/comment/40264034
type: AnswerComment
has text: @auselen You seem to only be thinking of this at a RUNTIME analysis through `Class#getAnnotation(..)`. For `RetentionPolicy.CLASS`, the rules of `@Inherited` would still have to be satisfied in the byte code. Similarly, at `SOURCE, the rules would have to be satisfied when analyzing the source code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25749160

http://stackoverflow.com/q/25773308
has title: How to remove an element in an array of strings
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/40306872
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/40306800
has body: im fairly new at coding. I have an array of movies. What im trying to do is delete the movie with the least number of sales. In my method 'remover' located in the box office class, i get an error saying " int cannot be dereferenced" on the line including this code "((movies.get(i).sales).equals(small))". also i called the remove method to delete it from the array but im guessing that remove isnt legitimate in java. What call would i have to make to remove it from the array and update the length. import java.util.*; public class LIANGLAB1p2 { public static void main(String[] argv) { BoxOffice bo = new BoxOffice(); bo.add(new Movie("starboat","pg","action")); bo.add(new Movie("bloody banquet","pg-13","horror")); bo.add(new Movie("godizilla eats tokyo","pg","horror")); bo.add(new Movie("geeks in love","pg","comedy")); bo.add(new Movie("bad cop, worse cop","r","comedy")); bo.add(new Movie("lost of bullets","r","action")); bo.add(new Movie("the eliminator","r","action")); bo.add(new Movie("the garbage collector","pg","comedy")); bo.add(new Movie("the dentist","r","comedy")); bo.add(new Movie("the professor","r","horror")); bo.add(new Movie("bloody noon", "r", "action")); for(int i=0;i&lt;200;i++) bo.sellticket("the professor"); for(int i=0;i&lt;100;i++) bo.sellticket("starboat"); for(int i=0;i&lt;120;i++) bo.sellticket("the eliminator"); for(int i=0;i&lt;10;i++) bo.sellticket("bloody banquet"); for(int i=0;i&lt;40;i++) bo.sellticket("the dentist"); for(int i=0;i&lt;25;i++) bo.sellticket("geeks in love"); bo.listmovie(); bo.genrecounter(); System.out.println("The most popular genre is " +bo.genrecounter()); System.out.println("The most popular movie is " +bo.mostpopular()); System.out.println("The sales have been reset to 0"); bo.reset(); } } class Movie { public int sales; public int genr; public String title; public String rating; public String genre; public Movie (String t, String r, String g){ title = t; rating = r; genre = g; sales = 0; genr = 0; } public String toSt…
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/25773448
has comment: http://stackoverflow.com/comment/40306436
has answer: http://stackoverflow.com/a/25773357
score: -1
answer count: 2
upvote count: 0

http://stackoverflow.com/a/25848911
has body: When making JUnit tests, you are expected to use JUnit assertions. The built-in assert is a different thing. Try something like this to see what happens. @Test public void testValues() { User user = new User(); Assert.assertEquals(user.getCode(), "CODE"); } You will see that the test fails. Your previous code wasn't throwing, most likely because the JVM didn't have assertions enabled (the -ea flag). By default, the Java Virtual Machine will ignore all asserts. That is something you can test as well: running the same code you have in your question with -ea.
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/25848731

http://stackoverflow.com/comment/40428127
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25839599
has text: Thanks for the tip i made the change you suggested and it says the next error java.lang.ClassCastException: java.util.Date cannot be cast to java.sql.Date It seems i was right about the date, could somebody tell me how i should save the date?
type: Comment

http://stackoverflow.com/comment/40349752
score: 0
type: AnswerComment
type: Comment
has text: Yep, you're going to need some double quotes there.
comment on: http://stackoverflow.com/a/25796750

http://stackoverflow.com/a/25807693
score: 0
answers question: http://stackoverflow.com/q/25807636
has comment: http://stackoverflow.com/comment/40368790
type: Answer
has comment: http://stackoverflow.com/comment/40368990
has comment: http://stackoverflow.com/comment/40368690
has comment: http://stackoverflow.com/comment/40369010
has body: This is not a problem of DecimalFormat, it is a problem of the way binary float point numbers work. Certain numbers are not representable this way, so you get an approximation to them - like in your case. Using BigDecimal is a possible solution.
has comment: http://stackoverflow.com/comment/40368905

http://stackoverflow.com/a/37142193
has body: If you want most of your activities to have an action bar you would probably inherit your base theme from the default one (this is automatically generated by Android Studio per default): And then add a special theme for your bar-less activity: For me, setting actionBarTheme to @null was the solution. Finally setup the activity in your manifest file: <activity ... android:theme="@style/AppTheme.NoTitle" ... >
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25863676
upvote count: 7
score: 7

http://stackoverflow.com/comment/40386728
type: Comment
comment on: http://stackoverflow.com/a/25816866
has text: How about creating a custom logger class that contains all other categories as static members. public class CustomLogger { public final static Logger customlog = LoggerFactory.getLogger("customlog"); } and we call CustomLogger.customlog.infor("");
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40465831
comment on: http://stackoverflow.com/a/25860399
has text: That only works if all the elements are the same except for the number. sorry my list.add codes were wrong I edited
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25848652
has answer: http://stackoverflow.com/a/25849131
has answer: http://stackoverflow.com/a/25849346
has comment: http://stackoverflow.com/comment/40444890
tagged with: java
linked to: http://stackoverflow.com/q/17037508
tagged with: database
has comment: http://stackoverflow.com/comment/40443738
has comment: http://stackoverflow.com/comment/40443955
has comment: http://stackoverflow.com/comment/40443932
type: AnsweredQuestion
downvote count: 0
possible better answer: http://stackoverflow.com/a/25849215
has comment: http://stackoverflow.com/comment/40445869
accepted answer: http://stackoverflow.com/a/25849131
favorite count: 0
has answer: http://stackoverflow.com/a/25849215
has title: how many arguments can be used with the IN clause in postgresql?
tagged with: postgresql
type: Question
score: 3
tagged with: jdbc
has comment: http://stackoverflow.com/comment/40444024
has comment: http://stackoverflow.com/comment/40445941
upvote count: 3
answer count: 3
has body: I am executing a query in postgresql database from a java program, and the query is like: SELECT ... FROM table_name WHERE column_name IN("&lt;list of values&gt;"); the problem is that the list of values is created dynamically and there is no limit to its size, and when this list is getting too big I am getting a PSQLException with the message: stack depth length exceeded. my question is how do I determine how many arguments can I use with the IN clause before this exception happens? let's say the max_stack_depth is 2MB, can I use that to determine how many arguments can I use with the IN clause?

http://stackoverflow.com/q/25748195
has body: My code is: List&lt;? super myclass&gt; test_list = new ArrayList&lt;Object&gt;(); .... myclass m; m = test_list.get(i); and get the compile error MixedLists.java:43: error: incompatible types m=test_list.get(i); ^ required: myclass found: CAP#1 where CAP#1 is a fresh type-variable: CAP#1 extends Object super: myclass from capture of ? super myclass 1 error
type: Question
has title: Why is an explicit cast required for List<? super myclass>?
answer count: 2
has answer: http://stackoverflow.com/a/25748320
has comment: http://stackoverflow.com/comment/40260558
has answer: http://stackoverflow.com/a/25748465
tagged with: super
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40262680
tagged with: java

http://stackoverflow.com/comment/40457048
has text: @jarnbjo - you're right
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25851017

http://stackoverflow.com/a/26954864
has comment: http://stackoverflow.com/comment/133553000
has comment: http://stackoverflow.com/comment/68473476
has comment: http://stackoverflow.com/comment/62281768
has comment: http://stackoverflow.com/comment/62907808
has comment: http://stackoverflow.com/comment/62900973
answers question: http://stackoverflow.com/q/25747499
downvote count: 5
has comment: http://stackoverflow.com/comment/138082417
has comment: http://stackoverflow.com/comment/80607224
has comment: http://stackoverflow.com/comment/44382444
has body: I found the best way to do this is with ChronoUnit. long minutes = ChronoUnit.MINUTES.between(fromDate, toDate); long hours = ChronoUnit.HOURS.between(fromDate, toDate); Additional documentation is here: Period and Duration
has comment: http://stackoverflow.com/comment/88556537
type: Answer
score: 733
has comment: http://stackoverflow.com/comment/62898977
upvote count: 738

http://stackoverflow.com/a/25774241
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25774172
score: 3
upvote count: 3
type: AcceptedAnswer
has body: For example: String customerList="'C1','C2','C3','C4','C5'"; for( String s : customerList.split(",") ) { System.out.println(s.replaceAll("'", "")); }
type: Answer
answers question: http://stackoverflow.com/q/25774172

http://stackoverflow.com/comment/40288370
has text: Have a look at the answers here: https://stackoverflow.com/questions/51438/getting-a-files-mime-type-in-java
score: 1
comment on: http://stackoverflow.com/q/25763533
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25853102
has comment: http://stackoverflow.com/comment/40460649
has comment: http://stackoverflow.com/comment/40452303
has answer: http://stackoverflow.com/a/25853246
has comment: http://stackoverflow.com/comment/40452149
has body: I am trying to execute grep command on the linux using the following java code, but I am not able to capture output. I am getting always null in the output Process p; String output = null; try { String command = "grep searchString filename.txt"; System.out.println("Running command: " + command); p = Runtime.getRuntime().exec(command); BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream())); if (null != output) { while ((output = br.readLine()) != null) System.out.println(output); } p.waitFor(); System.out.println("exit: " + p.exitValue()); p.destroy(); } catch (Exception e) { e.printStackTrace(); } How to capture the output? Is there any third party library or some better way to execute the command on linux and capture the output?
has title: Execute grep command on Linux and capture result
tagged with: jakarta-ee
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40452849
answer count: 1
accepted answer: http://stackoverflow.com/a/25853246
linked to: http://stackoverflow.com/q/792024
score: 0
tagged with: linux
tagged with: grep

http://stackoverflow.com/comment/87985916
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25738275
has text: The settings in the Java Control Panel affect only applets and Java Web Start apps. Standalone apps have to manage proxies themselves.
type: AnswerComment

http://stackoverflow.com/comment/40453448
score: 7
has text: Execute your do/while loop on paper, and note the value of the count variable at each iteration.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25853880

http://stackoverflow.com/q/25728402
has comment: http://stackoverflow.com/comment/40265268
tagged with: perl
has comment: http://stackoverflow.com/comment/40231309
has comment: http://stackoverflow.com/comment/40264385
has comment: http://stackoverflow.com/comment/40224287
has comment: http://stackoverflow.com/comment/40230919
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40225720
tagged with: jvm
favorite count: 0
tagged with: perl-module
has comment: http://stackoverflow.com/comment/40265242
has comment: http://stackoverflow.com/comment/40235352
has comment: http://stackoverflow.com/comment/40231796
has comment: http://stackoverflow.com/comment/40264604
has body: How can I connect to an external, already-running JVM using Inline::Java? I'm trying to connect to a running OSGi app so I can send and receive objects, arrays, lists, etc. As I understand it, Inline::Java creates its own JVM to run the Java code on; all I need to figure out is how to communicate between that JVM and the one running the app. I tried using RMI, with the following code for the client: import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import example.hello.Hello; public class Client { private Client() {} public static void main(String[] args) { String host = (args.length &lt; 1) ? null : args[0]; try { Registry registry = LocateRegistry.getRegistry(host); Hello stub = (Hello) registry.lookup("Hello"); String response = stub.sayHello(); System.out.println("response: " + response); } catch (Exception e) { System.err.println("Client exception: " + e.toString()); e.printStackTrace(); } } When I compile and run this separately, it works, but when I try to embed the code into a Perl script using Inline::Java, it gives an error: C:\Users\josesong\Documents\RMI_Test&gt;perl hello.pl A problem was encountered while attempting to compile and install your Inline Java code. The command that failed was: "C:\Program Files\Java\jdk1.8.0_20\bin\javac.exe" -deprecation -d "C:\Users\j osesong\Documents\RMI_Test\lib\auto\hello_pl_5a5a" Client.java &gt; cmd.out 2&gt;&amp;1 The build directory was: C:\Users\josesong\Documents\RMI_Test\build\hello_pl_5a5a The error message was: Client.java:3: error: package example.hello does not exist import example.hello.Hello; ^ Client.java:14: error: cannot find symbol Hello stub = (Hello) registry.lookup("Hello"); ^ symbol: class Hello location: class Client Client.java:14: error: cannot find symbol Hello stub = (Hello) registry.lookup("Hello"); ^ symbol: class Hello location: class Client 3 errors To debug the problem, I cd'd to the build directory and inspected the output file, which looked like this: at hell…
has comment: http://stackoverflow.com/comment/40264255
has answer: http://stackoverflow.com/a/25750849
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/40264585
type: Question
has comment: http://stackoverflow.com/comment/40231846
has title: How can I connect to an external JVM using Inline::Java?
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40225787
has comment: http://stackoverflow.com/comment/40265180

http://stackoverflow.com/a/25753086
has comment: http://stackoverflow.com/comment/40269886
type: Answer
has body: check before decoding, it might help: if(Base64.isBase64(input)){ Base64.decodeBase64(input); }
answers question: http://stackoverflow.com/q/25752980
has comment: http://stackoverflow.com/comment/40270041
score: 0

http://stackoverflow.com/a/26109072
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/25829125
upvote count: 2
answers question: http://stackoverflow.com/q/25829125
has body: If it helps anyone else: The URL string itself was the same, minus the database name: db.url=jdbc:sqlserver://:1433; For the query string however, I had to use OPENQUERY format: createSQLQuery("SELECT value " + "FROM OPENQUERY(OLEDBSOURCE,'SELECT value " + "FROM tablename ORDER BY value')")
score: 2

http://stackoverflow.com/comment/40272182
type: Comment
comment on: http://stackoverflow.com/q/25754007
score: 0
type: QuestionComment
has text: I dont know android well enough to actually answer this however the problem definitely is because you `standby_time` is a primitive data type and modifying it in the `onFinish` method does not change the value you passed to the `CountDownTimer`. I would look into using the `Timer` class.

session
tags question: http://stackoverflow.com/q/25806467
tags question: http://stackoverflow.com/q/25811788
tags question: http://stackoverflow.com/q/25796973
tags question: http://stackoverflow.com/q/25873446
tags question: http://stackoverflow.com/q/25742984
tags question: http://stackoverflow.com/q/25860213
type: Tag
tags question: http://stackoverflow.com/q/25803917
tags question: http://stackoverflow.com/q/25733591
tags question: http://stackoverflow.com/q/25800632
tags question: http://stackoverflow.com/q/25868781
tags question: http://stackoverflow.com/q/25786145
tag name: session
tags question: http://stackoverflow.com/q/25779874
tags question: http://stackoverflow.com/q/25751993
tags question: http://stackoverflow.com/q/25774095
tags question: http://stackoverflow.com/q/25825445
tags question: http://stackoverflow.com/q/25784283
tags question: http://stackoverflow.com/q/25862150

http://stackoverflow.com/q/25831914
tagged with: divider
has title: How to disable Divider in JsplitPane from hiding one component?
upvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/40413974
has comment: http://stackoverflow.com/comment/40413842
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40413603
has comment: http://stackoverflow.com/comment/40516981
has comment: http://stackoverflow.com/comment/40413861
answer count: 0
downvote count: 0
score: 1
tagged with: java
tagged with: swing
has body: I have a jsplitPane and 2 component. I want to not let the user click the divider to maximize the top component. Here is my code. import java.awt.BorderLayout; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JSplitPane; public class MovingJSplitPaneDivider { public static void main(String[] a) { JFrame horizontalFrame = new JFrame(); horizontalFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JComponent topButton = new JButton("Left"); JComponent bottomButton = new JButton("Right"); final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); splitPane.setTopComponent(topButton); splitPane.setBottomComponent(bottomButton); horizontalFrame.add(splitPane, BorderLayout.CENTER); horizontalFrame.setSize(150, 150); horizontalFrame.setVisible(true); splitPane.setDividerLocation(0.5); } } What I want exactly is that to block the user when he wants to move down the divider.
type: Question
tagged with: jsplitpane
has comment: http://stackoverflow.com/comment/40413545

http://stackoverflow.com/comment/40344609
has text: it is not possible to "deactivate" the task manager - even if you were to achieve this marvelous OS-hack, a bluescreen would appear once you hit CTRL+ALT+DEL.
type: Comment
comment on: http://stackoverflow.com/a/25793528
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40279616
score: 0
type: AnswerComment
type: Comment
has text: Yes, if you need to search only for field_2, then you need a separate index for it, but don't forget that writes will be slower. This index will work for field_1 and field_2 combined, but not in all cases as I described above and also it should work if you search by field_1 only.
comment on: http://stackoverflow.com/a/25758176

http://stackoverflow.com/comment/40611058
has text: Hi @M. Deinum, sorry for the late reply and thx for you effort. Actually I found the issue and it was related to logging implementation that I use for the application. I resolved it and everything works now.
comment on: http://stackoverflow.com/q/25849567
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/25867522
type: Answer
downvote count: 0
score: 1
has body: you have not loaded mysql driver,this is why drivermanager is returning null.In JDBC, we must have to register Driver(Mysql Driver in your case). Class.forName("com.mysql.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/cloudbase", user, passwd); /* your remaining code .... ...*/
answers question: http://stackoverflow.com/q/25852629
upvote count: 1

http://stackoverflow.com/comment/40367821
type: QuestionComment
comment on: http://stackoverflow.com/q/25807179
has text: umm, how do I do that?
score: 0
type: Comment

http://stackoverflow.com/a/25781993
has body: Or you could do something like this, storing your indexes in array int[] indexes = new int[n]; outer: while (true) { if (indexes[n-1] == u) { int indexesToChange = 1; while ((indexesToChange &lt; n + 1) &amp;&amp; (indexes[n - indexesToChange] &gt;= (u-1))) indexesToChange++; if (indexesToChange == n+1) break outer; indexes[n - indexesToChange]++; for (int i = indexesToChange - 1; i &gt; 0; i--) indexes[n - i] = indexes[n - indexesToChange]; } else { // do something indexes[n-1]++; } } Haven't tested it, so could be errors in implementation. But I hope I drive the point home. UPDATE Tested and found bug. Now it's fixed and works as intended.
accepted answer of: http://stackoverflow.com/q/25781054
has comment: http://stackoverflow.com/comment/40327770
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40323202
has comment: http://stackoverflow.com/comment/40327702
upvote count: 2
has comment: http://stackoverflow.com/comment/40327229
type: Answer
has comment: http://stackoverflow.com/comment/40323288
score: 2
has comment: http://stackoverflow.com/comment/40327609
answers question: http://stackoverflow.com/q/25781054

http://stackoverflow.com/q/25829683
has comment: http://stackoverflow.com/comment/40410006
has body: I am trying to see if my equation balances out in case of parentheses. But i am having trouble with the equation, x=(1+2))+3. It is always valid even though it is not. Any help? public boolean checkEquation(String infix){ for(int j=0;j&lt;infix.length();j++){ // loop until the end of the line for a string (expression) // Check for parentheses if( infix.charAt(j)=='('){ operatorStack.push(infix.charAt(j)); // push the parentheses to stack } // Check for braces else if( infix.charAt(j)=='[' ){ operatorStack.push(infix.charAt(j)); // push the braces to stack } // Check for bracket else if( infix.charAt(j)=='{' ){ operatorStack.push(infix.charAt(j)); // push the bracket to stack } /* for reverse cases */ // Check for reverse parentheses else if( infix.charAt(j)==')' ){ if(operatorStack.isStackEmpty()){ System.out.println(operatorStack.pop()); return false; } if(operatorStack.peek()!='('){ System.out.println(operatorStack.pop()); return false; } } // Check for reverse braces else if( infix.charAt(j)==']' ){ if(operatorStack.isStackEmpty()){ return false; } if(operatorStack.peek()!='['){ return false; } } // Check for reverse bracket else if( infix.charAt(j)=='}' ){ if(operatorStack.isStackEmpty()){ return false; } if(operatorStack.peek()!='{'){ return false; } } // ignore other characters for now } // close for loop return operatorStack.isStackEmpty(); } // end of checkEquation method
accepted answer: http://stackoverflow.com/a/25829884
has comment: http://stackoverflow.com/comment/40409804
has comment: http://stackoverflow.com/comment/40409704
has comment: http://stackoverflow.com/comment/40409515
has comment: http://stackoverflow.com/comment/40409437
has comment: http://stackoverflow.com/comment/40409910
has title: Parentheses check in Java
has comment: http://stackoverflow.com/comment/40409617
tagged with: stack
downvote count: 2
has comment: http://stackoverflow.com/comment/40409817
has comment: http://stackoverflow.com/comment/40410142
has comment: http://stackoverflow.com/comment/40410094
has comment: http://stackoverflow.com/comment/40409852
has comment: http://stackoverflow.com/comment/40409619
has comment: http://stackoverflow.com/comment/40410187
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40409470
has comment: http://stackoverflow.com/comment/40409884
score: -2
has comment: http://stackoverflow.com/comment/40409418
has comment: http://stackoverflow.com/comment/40409485
tagged with: java
has answer: http://stackoverflow.com/a/25829884
has comment: http://stackoverflow.com/comment/40409429
type: Question
has comment: http://stackoverflow.com/comment/40409794
has comment: http://stackoverflow.com/comment/40410157
has comment: http://stackoverflow.com/comment/40410078
has comment: http://stackoverflow.com/comment/40409773
upvote count: 0
has comment: http://stackoverflow.com/comment/40410137
answer count: 1
tagged with: arrays
has comment: http://stackoverflow.com/comment/40409415
favorite count: 0
has comment: http://stackoverflow.com/comment/40409598
has comment: http://stackoverflow.com/comment/40409530

http://stackoverflow.com/comment/40357230
score: 2
has text: sessions is not stored in Cookies. Only Session ID is stored in a cookie.
type: AnswerComment
comment on: http://stackoverflow.com/a/25800870
type: Comment

http://stackoverflow.com/a/25771632
upvote count: 1
type: AcceptedAnswer
has body: This is a bit of an unusual case, so there's no neat way of doing this. But you can always use a Converter - something like: using(new Converter&lt;SourceBigThing, TargetColorThing&gt;(){ public TargetColorThing convert(MappingContext&lt;SourceBigThing, TargetColorThing&gt; context) { TargetColorThing target = new TargetColorThing(); if (context.getSource().getGreen() != null) target.setName(context.getSource().getGreen().getName()); else if (context.getSource().getRed() != null) target.setName(context.getSource().getRed().getName()); return target; }}).map(source).setThing(null);
type: Answer
answers question: http://stackoverflow.com/q/25766262
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25766262
score: 1

http://stackoverflow.com/comment/40305681
score: 0
type: Comment
type: QuestionComment
has text: Your code can't be compiled, please fix it and post a code that is compilable
comment on: http://stackoverflow.com/q/25772669

http://stackoverflow.com/q/25805204
answer count: 2
linked to: http://stackoverflow.com/q/26221821
downvote count: 1
upvote count: 16
favorite count: 0
tagged with: visualvm
type: UnansweredQuestion
has title: Running Visual VM from eclipse
has answer: http://stackoverflow.com/a/26222778
tagged with: java
type: Question
has body: I am trying to debug a java app using Visual VM in Eclipse kepler. I am executing the class having main method selecting Visual VM as launcher. I have configured Visual VM as per the instructions given in http://blog.idrsolutions.com/2013/05/setting-up-visualvm-in-under-5-minutes. I am getting the following error: An internal error occurred during: “Launching TestNew”. java.lang.NullPointerException “TestNew” is the name of the class with main method I am trying to execute. please help.
has answer: http://stackoverflow.com/a/63794363
has comment: http://stackoverflow.com/comment/40372967
score: 15
tagged with: eclipse
tagged with: profiler

http://stackoverflow.com/q/25858664
favorite count: 0
type: Question
upvote count: 1
has comment: http://stackoverflow.com/comment/40462676
has comment: http://stackoverflow.com/comment/40462464
has body: Today I started learning about json files and I made a test using NetBeans and json-lib : package tp; import java.io.FileInputStream; import java.io.IOException; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import net.sf.json.JSONSerializer; import org.apache.commons.io.IOUtils; public class Tp { public static void main(String[] args) throws IOException { String jsonTxt = IOUtils.toString(new FileInputStream("test/test/test1.json"), "UTF-8"); System.out.println("jsonTxt.length " + jsonTxt.length()); JSONArray root = (JSONArray) JSONSerializer.toJSON(jsonTxt); JSONObject document = root.getJSONObject(0); String tag = document.getString("tag"); System.out.println("tag " + tag); } } this is my json file : { "tag": "value" } I'm tying to read and display the value but I get : jsonTxt.length 25 Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/exception/NestableRuntimeException 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 java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at tp.Tp.main(Tp.java:15) Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException 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.URLClassLoade…
tagged with: netbeans
has comment: http://stackoverflow.com/comment/40463086
answer count: 0
type: UnansweredQuestion
has title: read simple json lib file
has comment: http://stackoverflow.com/comment/40463055
tagged with: json-lib
downvote count: 0
score: 1
tagged with: java

http://stackoverflow.com/comment/40412970
comment on: http://stackoverflow.com/q/25820969
has text: @glogic It seems that when you call displayMyImage the service object isn't fully constracted, it's hard to say more without code.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40474151
score: 0
type: Comment
has text: Ah, I misunderstood. Maybe this is what you're looking for: http://frankkieviet.blogspot.ca/2006/10/classloader-leaks-dreaded-permgen-space.html
comment on: http://stackoverflow.com/a/25864442
type: AnswerComment

http://stackoverflow.com/q/25798033
has comment: http://stackoverflow.com/comment/40351935
tagged with: gradle
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/40352093
score: 0
has title: Is there a way to automatically mail gradle test reports?
has comment: http://stackoverflow.com/comment/40352003
tagged with: junit
has body: I run the tests on a remote machine on vpn. I don't want to reconnect just to see the reports, can they be mailed to me through gradle?
has comment: http://stackoverflow.com/comment/40352165
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/a/45866565
type: Answer
has comment: http://stackoverflow.com/comment/96070742
score: 0
has body: To override the Enter key press behavior I use the function below calling it in the scene's key press event filter: public static void overrideEnterKeyPressEvent(KeyEvent evt) { EventTarget eventTarget = evt.getTarget(); if ((eventTarget instanceof TextArea) || (eventTarget instanceof TableView)) { return; } if (eventTarget instanceof Button) { Platform.runLater(() -> { KeyEvent newEventPressed = new KeyEvent(KeyEvent.KEY_PRESSED, " ", " ", KeyCode.SPACE, false, false, false, false); Event.fireEvent(eventTarget, newEventPressed); KeyEvent newEventReleased = new KeyEvent(KeyEvent.KEY_RELEASED, " ", " ", KeyCode.SPACE, false, false, false, false); Event.fireEvent(eventTarget, newEventReleased); }); evt.consume(); return; } Platform.runLater(() -> { KeyEvent tabEvent = new KeyEvent(KeyEvent.KEY_PRESSED, "", "\t", KeyCode.TAB, evt.isShiftDown(), false, false, false); Event.fireEvent(eventTarget, tabEvent); }); evt.consume(); } Based on the event's target the function works as follows. For a TextArea or TableView, it's a NoOp. For a button, it consumes the Enter press event and fires Space key press and release events. And for all the other controls, it also consumes the Enter press event and fires a Tab event so pressing Enter moves focus to the next control just like Tab. Then you just register an event filter for the whole scene: scene.addEventFilter(KeyEvent.KEY_PRESSED, this::onSceneKeyPressedFilter); And the event filter looks like: private void onSceneKeyPressedFilter(KeyEvent evt) { switch (evt.getCode()) { case ENTER: if (evt.isControlDown() && FxTools.isAncestorNodeTargeted(evt.getTarget(), fxHBoxInputAp)) { return; //let the events for the fxHBoxInputAp pane pass through } overrideEnterKeyPressEvent(evt); break; ... default: break; } } ----- edit because I forgot to include the isAncestorNodeTargeted() function; thanks for the comment, Robert ----- public static boolean isDescendantOf(Node node, Node ancestor) { while ((node != null) && (node != ancestor)) { n…
answers question: http://stackoverflow.com/q/25758782
has comment: http://stackoverflow.com/comment/96048065

http://stackoverflow.com/comment/40673286
comment on: http://stackoverflow.com/a/25932468
type: AnswerComment
type: Comment
has text: Why don't you share the another analysis of heap after doing the optimizations (@Remove annotation) ? so I will have a better picture of the situation. I would love to see the output of jmap -histo:live <pid>
score: 0

autowired
tags question: http://stackoverflow.com/q/25726444
tags question: http://stackoverflow.com/q/25839186
tags question: http://stackoverflow.com/q/25793344
type: Tag
tag name: autowired

http://stackoverflow.com/a/25938010
answers question: http://stackoverflow.com/q/25772275
type: Answer
score: 0
has body: For validations like NotNull, MinLength, etc consider using a suitable JSR303 compatible validator For some business validations there are two approaches: Using a separate validator class or Having validations in the object itself. I sometimes do standalone validations in the object itself. But if the code gets bigger, then it is better to separate/decouple the validation into a validator. (Spring can help you bind separated validators with services.) However, I wouldn't suggest having the validation logic in DAO. Data Access Objects should be used for accessing data. Assuming your database contains validated data, the validations could be performed at a much higher level. You can pass your object to validator methods instead of extending anything. Validator classes extending entity classes is not a good idea. Where should you validate the objects? IMO you can validate when objects or data are passed across boundaries. Most particularly when objects are created from request data (controller layer). Also,validate or make defensive copies when objects are mutable. As Nathan mentioned timezone (and currency, char encoding, etc) issues could be tricky down the line. So arrive at a standard. This will help minimize validations and conversions.

http://stackoverflow.com/comment/118521493
comment on: http://stackoverflow.com/a/25801822
score: 0
type: Comment
has text: worked like charm for my UI development server.
type: AnswerComment

http://stackoverflow.com/a/25737453
has comment: http://stackoverflow.com/comment/40241685
score: 0
has body: You can use import.sql. Add a import.sql file in resource as follow: /*create database at first time*/ CREATE SCHEMA your-database-name; and add a line in hibernate.cfg.xml as follow: <hibernate-configuration> ... ... import.sql ... ... </hibernate-configuration> So, if not exist the database, hibernate creates new db. your hibernate.hbm2ddl.auto setting should be defining that the database is created (options are validate, create, update or create-drop) There is also the undocumented value of "none" to disable it entirely. defined as below create A value of create will create your tables at sessionFactory creation, and leave them intact. A value of create-drop will create your tables, and then drop them when you close the sessionFactory. validate: validate the schema, makes no changes to the database. update: update the schema.
type: Answer
answers question: http://stackoverflow.com/q/25737018
has comment: http://stackoverflow.com/comment/40279298
has comment: http://stackoverflow.com/comment/40241721

http://stackoverflow.com/comment/40401517
has text: @ShirgillAnsari probably `javap -c JobImpl`
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25815684

http://stackoverflow.com/a/25733214
answers question: http://stackoverflow.com/q/25725552
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/40243358
has comment: http://stackoverflow.com/comment/40244633
downvote count: 0
has body: Using trial and error, I found a solution. The problem is that jetty is executed using from the parent pom using mvn -pl webapp jetty:run The command is called from the directory of the main pom, thus jetty cannot resolve the relative paths inside the extraClasspath correctly. When executing the jetty:run goal inside the webapp directory, all modified classes are loaded correctly. I assume the scanTargets are working correctly even when using mvn -pl webapp jetty:run, because the relative paths get resolved during the execution of the plugin (with the correct working directory). Jetty outputs the scan targets on startup: [INFO] Added extra scan target:C:\PathToProject\business\target\classes [INFO] Added extra scan target:C:\PathToProject\persistence\target\classes However, the &lt;extraClasspath&gt;property is part of the &lt;webApp&gt; property, which is an instance of the org.eclipse.jetty.webapp.WebAppContext class. I assume that this instance is passed to jetty directly and that the extraClasspath property is accessed by jetty when it is already started.
score: 4
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25725552

http://stackoverflow.com/comment/40315880
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25778159
score: 0
has text: I am not sure if you run plenty of the thread SetTimer , you may prints the Threadid in the run method and see if they are the same thread. And also, do you run your thread SetTimer by calling run() method? or start() method?

http://stackoverflow.com/comment/40430718
type: Comment
has text: @user3852672 have you tried at least 1 of the answers? Some of the answers are related to `DatePickerDialog`.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25841037

http://stackoverflow.com/comment/40211537
score: 0
has text: @Mistre83: If i rightly understood your question you want to construct link for each user profile image
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25721400

http://stackoverflow.com/comment/40354403
type: QuestionComment
type: Comment
has text: for love of God, do your homework by yourself.
score: 0
comment on: http://stackoverflow.com/q/25799235

http://stackoverflow.com/a/25792018
downvote count: 0
answers question: http://stackoverflow.com/q/25774920
has comment: http://stackoverflow.com/comment/40358039
type: Answer
score: 2
has body: Thanks for the comments guys, i have solved this problem by reading "MyFile.txt" as a URL, and then read it the code: URL myURL = new URL("http://MyDomainName.com/MyFile.txt"); BufferedReader in = new BufferedReader( new InputStreamReader(myURL.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) line.add(inputLine); in.close(); Solved
upvote count: 2

http://stackoverflow.com/comment/73168078
type: Comment
score: 1
has text: Using this doesn't seem to prevent `Unmapped destination properties found` errors when executing `modelMapper.validate()`
type: AnswerComment
comment on: http://stackoverflow.com/a/25855937

http://stackoverflow.com/comment/40467414
type: QuestionComment
comment on: http://stackoverflow.com/q/25861296
score: 0
has text: Bods, it not _processing_ each line, the first loop reads all the lines but stores only the last. Then the following loop only has the last line to work with.
type: Comment

http://stackoverflow.com/q/25795109
type: AnsweredQuestion
tagged with: byte-buddy
has answer: http://stackoverflow.com/a/25822122
upvote count: 3
type: Question
score: 3
tagged with: bytecode
tagged with: java
accepted answer: http://stackoverflow.com/a/25822122
answer count: 1
downvote count: 0
favorite count: 0
has body: Is it possible to use Byte Buddy to redefine a private method of a class? It seems that the entry point into using Byte Buddy is always sub-classing an existing class. When doing this, it is obviously not possible to redefine a private method of the parent class (at least not in a way that the redefined method is used in the parent class). Consider the following example: public class Foo { public void sayHello() { System.out.println(getHello()); } private String getHello() { return "Hello World!"; } } Foo foo = new ByteBuddy() .subclass(Foo.class) .method(named("getHello")).intercept(FixedValue.value("Byte Buddy!")) .make() .load(Main.class.getClassLoader(), ClassLoadingStrategy.Default.WRAPPER) .getLoaded() .newInstance(); foo.sayHello(); The output will be "Hello World!". Is there any chance to get "Byte Buddy!" as output?
has title: Can I redefine private methods using Byte Buddy?

http://stackoverflow.com/a/27129071
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/25764419
answers question: http://stackoverflow.com/q/25764419
upvote count: 1
has body: Use HttpURLConnection you should be able to access the requested web page from java. Try the following code: HttpURLConnection httpcon = (HttpURLConnection) url.openConnection(); httpcon.addRequestProperty("User-Agent", "YOUR_BROWSER_AGENT");
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/25796584
tagged with: playframework-2.0
has comment: http://stackoverflow.com/comment/40351351
tagged with: java
has answer: http://stackoverflow.com/a/25802362
downvote count: 1
type: Question
upvote count: 0
score: -1
answer count: 2
has comment: http://stackoverflow.com/comment/40352759
has comment: http://stackoverflow.com/comment/40351843
favorite count: 0
type: UnansweredQuestion
has title: Play 2.0: Persist main title to database
tagged with: ebean
has comment: http://stackoverflow.com/comment/40374215
has answer: http://stackoverflow.com/a/25801981
has comment: http://stackoverflow.com/comment/40372869
has body: My web app has a main title which shows up on each page. For example, the way stackoverflow will show up in the top menu on every page. Currently this title is hard coded in my main.scala.html: My Main Title I want to make this title configurable on a settings page that I have. How can I persist this so that I can load it later and have it configurable by the user?

http://stackoverflow.com/comment/43148240
type: QuestionComment
has text: At first i thought that taking this advice wouldn't do anything but after a bit of time i went back to this project to try to finish it and it finally works by putting the GUI and network code in different files thank you @PeterLawrey
score: 1
comment on: http://stackoverflow.com/q/25848644
type: Comment

http://stackoverflow.com/q/25791518
tagged with: android
tagged with: compare
answer count: 4
accepted answer: http://stackoverflow.com/a/25791564
tagged with: equals
possible better answer: http://stackoverflow.com/a/25791574
has answer: http://stackoverflow.com/a/25791574
has answer: http://stackoverflow.com/a/25791568
has body: I get a string form a list and try to compare it with some strings in the values and then do some stuff for(int i=0; i&lt;sizeOfList; i++){ String LIST_TITLE; LIST_TITLE = list_title.get(i); //the List list_title includes some strings if(LIST_TITLE.equals(R.string.percentbattery)) { //do stuff Log.d("EQUAL!","" + LIST_TITLE); } else if(LIST_TITLE.equals(R.string.screenrecorder) == true) { //do stuff Log.d("EQUAL!","" + LIST_TITLE); } else if(LIST_TITLE.equals(R.string.eightsms) == true) { //do stuff Log.d("EQUAL!","" + LIST_TITLE); } else { // do stuff Log.e("TITLE NOT EQUAL","" + LIST_TITLE); } } If I compare my LIST_TITLE with the (R.string. ...) in my Logcat they are equal, but I get only the "TITLE NOT EQUAL" Log from the else statement. Is there another way to compare these strings? the "==" method also don't work.
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40339427
has answer: http://stackoverflow.com/a/25791564
has answer: http://stackoverflow.com/a/25791572
tagged with: string
has title: compare two strings with .equals() don't work
score: 0

http://stackoverflow.com/a/25896599
upvote count: 1
has body: The problem was in my service as I had the annotation: @Transactional(readOnly = true, propagation = Propagation.REQUIRED) and because I was managing transactions through web flow, they never commited. So I added @Transactional to the persist methods and that fixed it. You can also just remove the readOnly = true part, but I didn't because there were fetch methods that I didn't want to be exposed.
score: 1
answers question: http://stackoverflow.com/q/25854916
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25854916
downvote count: 0
type: Answer

http://stackoverflow.com/q/25864244
type: UnansweredQuestion
tagged with: java
upvote count: 1
tagged with: swing
downvote count: 1
type: Question
has title: items aren't appearing till after hovering in Jcombobox
has comment: http://stackoverflow.com/comment/40479191
has comment: http://stackoverflow.com/comment/40472419
has comment: http://stackoverflow.com/comment/40472356
score: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40473331
has comment: http://stackoverflow.com/comment/40488244
has body: I can see the first item selected in the combobox but when I click it there are no items visible, only when i scroll over them can I see the names.. String[] countries = Locale.getISOCountries(); ArrayList countryList = new ArrayList(); for(String contCode : countries) { Locale contr = new Locale("", contCode); //countryField.addItem(contr.getDisplayCountry()); countryList.add(contr.getDisplayCountry()); } countryField = new JComboBox(countryList.toArray());
answer count: 0

http://stackoverflow.com/comment/40259286
score: 0
has text: would this help ? http://stackoverflow.com/questions/8574348/error-type-referred-to-is-not-an-annotation-type
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25747415

http://stackoverflow.com/q/25741463
has answer: http://stackoverflow.com/a/25741665
score: 0
answer count: 1
has title: How to identify which field caused exception
has body: I am trying to identify which field caused an ConstraintViolationException in java. I have two unique fields, username and email, and when i catch the exception i want to return the correct enum field. USER_ALREADY_REGISTERED("User Already Registered"), EMAIL_ALREADY_REGISTERED("Email Address Already In Use"), What is the correct way to do this? One approach I can think of is to grab the message from the exception and see if it contains the field name if it does then use one enum otherwise return the other, however, this seems a little flakey - is there a better way? Thanks edit: }catch(ConstraintViolationException e){ if(e.getConstraintName() != null){ if(e.getConstraintName().toLowerCase().contains("email")){ return RegistrationStatus.EMAIL_ALREADY_REGISTERED; } } return RegistrationStatus.USER_ALREADY_REGISTERED;
tagged with: exception
type: UnansweredQuestion
tagged with: java
tagged with: mysql
type: Question
tagged with: enums

http://stackoverflow.com/q/25754341
accepted answer: http://stackoverflow.com/a/25778005
answer count: 1
has body: I am having a problem with my images in my game. I am using an ImageLoader class which was written by my teacher. I create the two Image variables like this: private static Image healthPic = ImageLoader.loadCompatibleImage("Health.gif"); private static Image enemyRocket = ImageLoader.loadCompatibleImage("EnemyShip2Rocket.png");; To create the health powerup, I use an arraylist, and populate it using this code: if (frameCount % 951 == 0){ Random r = new Random(); int randX = r.nextInt(width - 20)+10; healthP.add(new GameObject(randX, -400, 20,20,healthPic,8,0)); } enemyWH is one variable used for both the width and height. It is equal to 35. I populate the enemy rocket arraylist using this code if (frameCount % 300 == 0){ for (int i = army.size()-1;i&gt;=0;i--){ EnemyShip curEnemy = army.get(i); rocketP.add(new GameObject(curEnemy.getR().x, curEnemy.getR().y, 20,20, enemyRocket,5,d)); } } The 20 and 20 are the width and height, the x and y are where the enemy is at that exact location and time, enemyRocket is the Image variable, 5 is the ySpeed (how fast it moves down the screen), and d is the damage that it does to the playership. My problem is that as the game progresses, randomly, about a second or so after the enemies all fire their rockets, the picture variable that is associated with the rocket suddenly switches to the health powerup picture, so it seems like a health powerup is coming, but it is really an enemy rocket. The picture is switching from rocket to health powerup
tagged with: side-scroller
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25778005
has title: Different image drawn for same object
tagged with: image
tagged with: logic
tagged with: arraylist
score: 0

http://stackoverflow.com/a/25841601
score: 5
has comment: http://stackoverflow.com/comment/40431510
has comment: http://stackoverflow.com/comment/62699926
type: AcceptedAnswer
upvote count: 5
type: Answer
accepted answer of: http://stackoverflow.com/q/25841395
has comment: http://stackoverflow.com/comment/40431606
answers question: http://stackoverflow.com/q/25841395
downvote count: 0
has body: try { jsonObj = new JSONObject(YourString); } catch (JSONException e) { Log.v("Error in Parser", " " + e); } try{ String name=jsonObj.getString("name"); Data = jsonObj.getJSONArray("data"); for (int i = 0; i &lt; Data.length(); i++) { JSONObject jsonObj2 = Data.getJSONObject(j); String vName = jsonObj2.getString("vendor_name"); String vId=jsonObj2.getString("vendor_id"); } }catch(Exception e) { }

ubuntu
tags question: http://stackoverflow.com/q/25868495
tags question: http://stackoverflow.com/q/25744154
tags question: http://stackoverflow.com/q/25729674
tag name: ubuntu
tags question: http://stackoverflow.com/q/25714449
tags question: http://stackoverflow.com/q/25727601
tags question: http://stackoverflow.com/q/25754488
type: Tag
tags question: http://stackoverflow.com/q/25718980
tags question: http://stackoverflow.com/q/25732685

http://stackoverflow.com/comment/40216842
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25724736
has text: When you say 'But this will fail' what exactly are you seeing in the stacktrace? Also, on what version of Spring are you on? May be this could help: http://stackoverflow.com/q/6129285/2231632 ?

http://stackoverflow.com/a/25729470
downvote count: 0
has body: That code should execute extremely quickly, so I doubt if splitting it up into more synchronized blocks will lessen contention. I'd go with the single, function level synchronized. However, if the code were doing more, e.g. ... if(maxX &gt; this.maxX){ this.maxX = maxX; doSomeSlowerCalculation(); updateSomeComplexSharedDataStructure(); } ... Then splitting it up into individual synchronized blocks could help
type: Answer
answers question: http://stackoverflow.com/q/25728753
upvote count: 1
accepted answer of: http://stackoverflow.com/q/25728753
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/40296872
has text: can you be brief on my point 3 as whenever I ran my program for get(car6) I got same result for object car6 i.e equals called three times. Can there be any possibility exists that car6 compares car1 and return true before comparing any other object. Thus equals be called 1 time only.
comment on: http://stackoverflow.com/a/25767331
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25861379
has title: Defect Tracking WebApp using Spring mvc
downvote count: 1
tagged with: spring-mvc
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25861960
tagged with: java
has comment: http://stackoverflow.com/comment/40467939
score: -1
type: Question
upvote count: 0
has body: This is login screen from my spring mvc web app.i need to catch every possible error conditon and store to database.like bug detecting system. for example if user click login button without filling form the error condition nothing provided should save on error table. and if it not provide password it should save password not provided. @RequestMapping(value = { "/do-login" }, method = RequestMethod.POST) public String login(@ModelAttribute(value = "user") User user) { process(user); return "success"; } public void process(User user) { List&lt;User&gt; users = userService.findAll(); for (User u : users) { if (!u.getUserName().equals(user.getUserName())) { IssueDetail detail = new IssueDetail(); detail.setSummary("user name"); detail.setDescription("wrong user name entered"); issueDetailService.save(detail); } else if (!u.getPassword().equals(user.getPassword())) { IssueDetail detail = new IssueDetail(); detail.setSummary("password"); detail.setDescription("wrong password entered"); issueDetailService.save(detail); } else if (!u.getUserType().equalsIgnoreCase(user.getUserType())) { IssueDetail detail = new IssueDetail(); detail.setSummary("user type"); detail.setDescription("wrong user type entered"); issueDetailService.save(detail); } } } i tried the above code.... when the above looping run, if user not entering any of the field the loop is saving any of the if statement 3 times in database. is there any alternate way to do it. TEST CASES Username password type ------------------------- N N N =NULL Y N N = WRONG PASS &amp; TYPE Y Y N = WRONG TYPE. N Y Y = WRONG USER. N N Y = WRONG PASSWORD &amp; TYPE.
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/25861960
tagged with: spring
tagged with: defects

http://stackoverflow.com/comment/40377062
has text: Note that the example is somewhat dated - this can all be done with annotations now. No need to any `web.xml`.
type: AnswerComment
type: Comment
score: 1
comment on: http://stackoverflow.com/a/25811826

http://stackoverflow.com/comment/40270726
has text: Like @thkala said: `There is no way to protect the DB credentials or the data from a sufficiently determined and knowledgeable user. If your application can access something, so can they.` The issue is you have to embed the credentials or a way to get the credentials in the app -> Huge security issue. Simply put: Do not do this. Just create a web service which you pass data to and it does what it needs to do then returns the data set.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25753082

http://stackoverflow.com/comment/40353763
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25798958
has text: Then use an array of size y*x, it would be more logical...

http://stackoverflow.com/q/25715145
upvote count: 5
type: UnansweredQuestion
tagged with: jenkins
downvote count: 0
tagged with: java
has title: Deploy Jenkins CI to Heroku
type: Question
tagged with: heroku
score: 5
has comment: http://stackoverflow.com/comment/40199112
has body: Is there a way to run Jenkins CI as an Heroku app? It is possible to run Java Apps on heroku but I cannot find description of how to make Jenkins run on Heroku anywhere. Very grateful for hints.
has comment: http://stackoverflow.com/comment/40248624
answer count: 1
has answer: http://stackoverflow.com/a/44335464
favorite count: 0

http://stackoverflow.com/comment/40665827
has text: Ahh, thanks very much. I suspected it would be something like this but the docs are a bit hazy on the details.
comment on: http://stackoverflow.com/a/25855564
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40262838
type: Comment
type: QuestionComment
has text: Yeah well, `getElementsByTagName("connection").item(0);` gets you the first `connection`-element only. Check how many there are and loop over them...
comment on: http://stackoverflow.com/q/25749492
score: 0

http://stackoverflow.com/comment/40266186
score: 2
has text: @zamk Note, if you don't know this already, that primitives don't work with generics. But `double[]` is not a primitive, it is a reference type.
type: AnswerComment
comment on: http://stackoverflow.com/a/25751211
type: Comment

http://stackoverflow.com/comment/40479148
has text: another thing : in the case of cameras, all of the needed drivers are already installed on your system : the windows USB-stack, if you connect your camera via USB. In that light, your comment makes even less sense and im guessing you downvoted my answer ... which would prove another assumption of mine but lets not talk about that righ now.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25855103

http://stackoverflow.com/comment/40376229
type: Comment
has text: @OlafKock started from scratch but this time with jre7 instead of jre8, and it works! thanks for your help.
score: 0
comment on: http://stackoverflow.com/q/25795217
type: QuestionComment

http://stackoverflow.com/a/25755006
score: 3
downvote count: 0
type: AcceptedAnswer
upvote count: 3
has body: You are simply forgetting to assign your return values. root = sqrt(root); actual = sqrt_(actual);
type: Answer
accepted answer of: http://stackoverflow.com/q/25754961
answers question: http://stackoverflow.com/q/25754961
has comment: http://stackoverflow.com/comment/40273580

http://stackoverflow.com/a/25810052
answers question: http://stackoverflow.com/q/25806469
score: 0
type: Answer
has body: using this code seems to work String urlstr = "https://ejbca05.prv:8443/ejbca/ejbcaws/ejbcaws?wsdl"; System.setProperty("javax.net.ssl.trustStore","C:/Users/l./Downloads/truststore.jks"); System.setProperty("javax.net.ssl.trustStorePassword","provae"); System.setProperty("javax.net.ssl.keyStore","C:/Users/l./Downloads/superadmin.p12"); System.setProperty("javax.net.ssl.keyStoreType", "pkcs12"); System.setProperty("javax.net.ssl.keyStorePassword","provae"); maybe converting p12 to jks keystore was not working properly. EDIT: it is possible convervet to jks with this command keytool -importkeystore -srckeystore [MY_FILE.p12] -srcstoretype pkcs12 -srcalias [ALIAS_SRC] -destkeystore [MY_KEYSTORE.jks] -deststoretype jks -deststorepass [PASSWORD_JKS] -destalias [ALIAS_DEST]
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25806469

http://stackoverflow.com/q/25744446
tagged with: concurrency
has comment: http://stackoverflow.com/comment/40253674
tagged with: deadlock
answer count: 2
has comment: http://stackoverflow.com/comment/40255802
has comment: http://stackoverflow.com/comment/40253650
accepted answer: http://stackoverflow.com/a/25744916
favorite count: 0
has body: I have two threads. The two threads must invoke send() (and then receive()) OR receive(), but there is a nice deadlock with this code. Is there a way to solve this problem? public class C { public static void main(String[] args) { Z z1=new Z(); Z z2=new Z(); z1.setZ(z2); z2.setZ(z1); z1.start(); z2.start(); } } class Z extends Thread { Z z; Object lock=new Object(); public void setZ(Z zz) { z=zz; } public void run() { new Thread() { public void run() { z.send(); } }.start(); new Thread() { public void run() { z.send(); } }.start(); } public void send() { synchronized(lock) { System.out.println("[Z] Send"); z.receive(); } } public void receive() { synchronized(lock) { System.out.println("[Z] Receive"); } } }
has title: How to solve this deadlock
has comment: http://stackoverflow.com/comment/40253488
has comment: http://stackoverflow.com/comment/40253682
linked to: http://stackoverflow.com/q/18356795
type: AnsweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/40253574
tagged with: java
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/25745314
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/25744916
has answer: http://stackoverflow.com/a/25745314
type: Question
has comment: http://stackoverflow.com/comment/40254165

http://stackoverflow.com/comment/40384120
type: QuestionComment
has text: Expanding the comment of @Jack : [Reading the API docs](http://api.mongodb.org/java/current/org/bson/types/ObjectId.html) usually solves these kind of questions pretty fast.
score: 0
comment on: http://stackoverflow.com/q/25815074
type: Comment

http://stackoverflow.com/comment/40391452
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25819562
type: Comment
has text: @IvanMatala save the select query into a string variable and print it. If it looks fine - try to manually run it directly in the DB and see how many results you're getting. In addition to that, like already mentioned: add error printing inside the catch block.

cors
type: Tag
tag name: cors
tags question: http://stackoverflow.com/q/25860490
tags question: http://stackoverflow.com/q/25871647
tags question: http://stackoverflow.com/q/25744088

http://stackoverflow.com/q/25741995
has comment: http://stackoverflow.com/comment/40248974
favorite count: 0
has answer: http://stackoverflow.com/a/25742352
type: Question
tagged with: android
score: -2
has answer: http://stackoverflow.com/a/25743372
answer count: 2
downvote count: 2
has body: I try my app on acer Z120 smartphone (vers. Android 4.1.1) and I have this runtime error: 09-09 12:03:24.827: W/dalvikvm(6414): threadid=11: thread exiting with uncaught exception (group=0x419af908) 09-09 12:03:24.830: E/AndroidRuntime(6414): FATAL EXCEPTION: Thread-546 09-09 12:03:24.830: E/AndroidRuntime(6414): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 09-09 12:03:24.830: E/AndroidRuntime(6414): at android.os.Handler.&lt;init&gt;(Handler.java:121) 09-09 12:03:24.830: E/AndroidRuntime(6414): at android.app.Dialog.&lt;init&gt;(Dialog.java:107) 09-09 12:03:24.830: E/AndroidRuntime(6414): at android.app.AlertDialog.&lt;init&gt;(AlertDialog.java:114) 09-09 12:03:24.830: E/AndroidRuntime(6414): at android.app.AlertDialog$Builder.create(AlertDialog.java:913) 09-09 12:03:24.830: E/AndroidRuntime(6414): at android.app.AlertDialog$Builder.show(AlertDialog.java:931) 09-09 12:03:24.830: E/AndroidRuntime(6414): at aqua.example.aquasalt.MainActivity.setAlertMsg(MainActivity.java:753) 09-09 12:03:24.830: E/AndroidRuntime(6414): at aqua.example.aquasalt.MainActivity$ConnectedThread.run(MainActivity.java:250) 09-09 12:03:24.931: W/MMUMapper(6414): fail to register MVA, unsupported format(0x5) App works well on my smartphone (Samsung Galaxy S Advance). Can I do?
tagged with: java
type: UnansweredQuestion
upvote count: 0
has title: Runtime error app Android

http://stackoverflow.com/q/25714171
tagged with: replace
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/25714295
upvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/25714295
has comment: http://stackoverflow.com/comment/40197108
downvote count: 1
type: AnsweredQuestion
tagged with: java
has title: Loops inside of loops/Replace can't make them work
score: -1
has body: I want to delete all the vowels from every word inside of an array. So I came up with this: public class AnotherExercise { public static void main (String[] args){ String[] intruments = {"cello", "guitar", "violin", "double bass"}; //the array of words String[] vowels = {"a", "e", "i", "o", "u"}; // the array of vowels String[] intruments2 = new String[5]; //the array of wrods without vowels String nothing = ""; // used to replace a vowel to nothing for (int i = 0; i &lt; 4; i++){ // first for loop to go through all of the intruments for(int e = 0; e &lt; 5; e++){ //second for loop to go through all the vowels intruments2[i] = intruments[i].replaceAll(vowels[e], nothing); //replacing vowels //and storing them in a new array } System.out.println(intruments2[i]); //outputting the words without vowels } } } From all the options I tried, I guess this one was the best, but still I can't make it work, it outputs: cello gitar violin doble bass The weirdest part in my opinion is that it does replace "u". It may be a silly mistake but I can't figure it out.

http://stackoverflow.com/comment/40404582
type: Comment
type: QuestionComment
score: 0
has text: Did not get the satisfactory answer
comment on: http://stackoverflow.com/q/25827055

http://stackoverflow.com/comment/40289218
score: 0
has text: Is the problem indeed that the file names loose their mixed case? I do not understand the exact problem. Network? FAT32 formatted disk? Copy script? Good luck exploring that. If you found a solution add an answer here. Till then, feel free to contact me.
type: Comment
comment on: http://stackoverflow.com/a/25723513
type: AnswerComment

http://stackoverflow.com/comment/40256270
score: 0
type: QuestionComment
type: Comment
has text: so you're sure you're using the same PgJDBC version as PostgreSQL?
comment on: http://stackoverflow.com/q/25743267

http://stackoverflow.com/comment/40624401
type: AnswerComment
has text: thx for your help so far. I just used a second Session to make sure that there is nothing "preconfigured" on it, which might cause unexpected results. but the Outcome is the same...
type: Comment
comment on: http://stackoverflow.com/a/25830441
score: 0

http://stackoverflow.com/q/25826859
tagged with: char
answer count: 3
has body: I need to do some stuff with codepoints and a newline. I have a function that takes a char's codepoint, and if it is \r it needs to behave differently. I've got this: if (codePoint == Character.codePointAt(new char[] {'\r'}, 0)) { but that is very ugly and certainly not the right way to do it. What is the correct method of doing this? (I know that I could hardcode the number 13 (decimal identifier for \r) and use that, but doing that would make it unclear what I am doing...)
tagged with: unicode
favorite count: 0
has answer: http://stackoverflow.com/a/25826900
has answer: http://stackoverflow.com/a/76871651
upvote count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/25826900
downvote count: 0
tagged with: codepoint
tagged with: java
type: Question
has title: What is the propper way to get a char's code point?
score: 4
has answer: http://stackoverflow.com/a/25826931
accepted answer: http://stackoverflow.com/a/25826931

http://stackoverflow.com/a/33545082
upvote count: 2
type: Answer
score: 2
has body: I do a goofy mistake and It take me 2 hour to solve It.I mentioned it here for other persons may be help them.The mistake was I enable ssl connector and changed both https and http ports to same number .
answers question: http://stackoverflow.com/q/25742913
downvote count: 0

http://stackoverflow.com/comment/40304623
score: 0
type: Comment
type: QuestionComment
has text: It compiles fine for me using javac on the command line. It doesn't compile in Eclipse, though, as per the description above. This is what makes me think it's a generics-related compiler option in Eclipse. Eclipse suggests fixing the error by de-generifying the type of the first parameter of fill.
comment on: http://stackoverflow.com/q/25762308

http://stackoverflow.com/comment/40471515
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25861862
has text: who is that update the DB? I mean, if some application updates the DB, maybe it is more feasible to have the producer (who writes the DB) to signal the consumer (who read the DB) when new data is ready; the way to implement that depends on the writing application (I add that given the frenquency of "all the time DB is changed" you may have usability issue...)

http://stackoverflow.com/comment/40342835
score: 0
type: QuestionComment
type: Comment
has text: @David Yeah, you should be right with that. I will take care in my answer.
comment on: http://stackoverflow.com/q/25793238

http://stackoverflow.com/q/25783208
has comment: http://stackoverflow.com/comment/40325533
has answer: http://stackoverflow.com/a/25790819
tagged with: groovy
has title: Spock interaction test takes precedence over exceptions
has answer: http://stackoverflow.com/a/25861659
score: 0
accepted answer: http://stackoverflow.com/a/25861659
tagged with: unit-testing
type: AnsweredQuestion
tagged with: spock
tagged with: java
type: Question
answer count: 2
has body: Why does the following test fail with "too few calls" instead of the actual exception that is thrown inside the do method before the mocked method could be called? Is there any way to change this behavior? @Test def "Should Create"() { when: "We do stuff" this.someStuff.do() then: "Should not get exception" notThrown(Exception) and: "Should send mail" 1 * mailSession.send(_, _, _, _, _, _, _) }
possible better answer: http://stackoverflow.com/a/25790819

http://stackoverflow.com/comment/40261983
type: QuestionComment
comment on: http://stackoverflow.com/q/25749078
score: 2
has text: can you post some more log cat after `Error during launch: java.lang.NullPointerException`
type: Comment

http://stackoverflow.com/q/25764686
type: AnsweredQuestion
has title: Java: convert list of objects to something else
has answer: http://stackoverflow.com/a/25764737
accepted answer: http://stackoverflow.com/a/25764795
type: Question
has comment: http://stackoverflow.com/comment/40290219
has comment: http://stackoverflow.com/comment/40290218
tagged with: java
has body: I have a class that has a list of Events. public class EventScheduler{ List&lt;Event&gt; event } public class Event{ private String text; private int timestamp; } I have an EventView, it takes an Event as a constructor and has getters and no setters. It is basically allows subset of variables set in event to be viewed, whilst acting in a similar fashion to Event. public class EventView{ public EventView(Event event){ this.event = event; } public String getText(){ return event.getText(); } //no timestamp getter as its not allowed for this view object. } So with this setup, what is the quickest way to convert a List&lt;Event&gt; to List&lt;EventView&gt;? Or some kind of alternative.
answer count: 2
has answer: http://stackoverflow.com/a/25764795
score: 0
possible better answer: http://stackoverflow.com/a/25764737

http://stackoverflow.com/q/25753383
possible better answer: http://stackoverflow.com/a/25753581
type: Question
has comment: http://stackoverflow.com/comment/40270538
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/40270784
has comment: http://stackoverflow.com/comment/40270754
tagged with: string
has answer: http://stackoverflow.com/a/25753581
has title: Cannot convert Array to List of String correctly
accepted answer: http://stackoverflow.com/a/25753540
has comment: http://stackoverflow.com/comment/40270648
has body: There is string with fixed length and it has to be spitted by 15 characters each record. The results should be placed in List, however it seems like whole string always placed in 0 position in List. Arrays.asList(a1.substring(1,324).split("[a-zA-Z]{20}")) Why is that? UPDATE: List&lt;String&gt; l = Arrays.asList("1111111111 1119999999 ".split("[0-9]{15}"));
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40270685
has answer: http://stackoverflow.com/a/25753540
linked to: http://stackoverflow.com/q/16485687
tagged with: java
has comment: http://stackoverflow.com/comment/40270707

http://stackoverflow.com/comment/40356575
comment on: http://stackoverflow.com/q/25800387
score: 0
type: Comment
type: QuestionComment
has text: Show us your hibernate configuration and Repository Configuration. Does the repo config has a TransacrionManager defined?

http://stackoverflow.com/comment/40249895
comment on: http://stackoverflow.com/a/25739032
has text: `hashCode` and `equals` gives differnt results now. This will break some logics in HashSet TreeSet LinkedHashSet and HashTable.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/25806994
has body: I am using Nimbus L&amp;F , JDK 1.7 and Netbeans 8.0. I should customize Nimbus. However, when I run my project even without changing any code, some colors which I set by UIManager are changing. This is where I set Nimbus; try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { System.err.println("Some error"); } Here is my painter example (darkpainter is the same with Color.Gray instead of Color.orange); Painter orangePainter = new Painter() { @Override public void paint(Graphics2D g, Object object, int width, int height) { g.setColor(Color.Orange); g.fillRect(0, 0, width, height); } }; And I am customizing with these codes; UIManager.put("control", Color.gray); UIManager.put("nimbusBlueGrey", Color.gray.darker()); UIManager.put("nimbusBorder", Color.orange); UIManager.put("TabbedPane:TabbedPaneTab[Disabled].backgroundPainter", darkpainter); UIManager.put("TabbedPane:TabbedPaneTab[Disabled+Selected].backgroundPainter", orangePainter); UIManager.put("TabbedPane:TabbedPaneTab[Enabled].backgroundPainter", darkpainter); UIManager.put("TabbedPane:TabbedPaneTab[Selected].backgroundPainter", orangePainter); I couldn't find the problem. I tried to use JDK 1.8 and Netbeans 7.3. I also tried to run from console directly but the same problem. Thank you for your help.
type: UnansweredQuestion
tagged with: nimbus
linked to: http://stackoverflow.com/q/6922368
tagged with: netbeans
tagged with: java
type: Question
has title: Java nimbus - color differs sometimes even if It is same code
score: 0
tagged with: customization
answer count: 1
has answer: http://stackoverflow.com/a/25807184

http://stackoverflow.com/a/25731731
answers question: http://stackoverflow.com/q/25726356
score: 0
type: Answer
has body: There is no such thing as a synchronized method. Repeat after me: There is no such thing as a synchronized method. When you write this: synchronized Foobar myFunk() { ... } That's just syntactic sugar that saves you from having to write this instead: Foobar myFunk() { synchronized(this) { ... } } But the second one makes it more obvious what is really going on: It's not the method that is synchronized, it's the object. The JVM will not allow two different threads to synchronize the same object at the same time. That's all it means. Synchronizing an object does not "lock" the object (other threads can still modify it). Synchronizing an object does not prevent other threads from calling the same method. All it does is prevent other threads from synchronizing the same object at the same time. How you use that feature is up to you. Normally, you use it to protect invariants. An invariant is an assertion that you make about some value or some group of values. (e.g., the length of list L is always even). If one thread must temporarily break the invariant (e.g., by first adding one thing to the list, and then adding another), and some other thread will crash and burn if it sees the broken invariant; then you need synchronization. The first thread only breaks the invariant while inside a synchronized block, and any other thread only looks at the data when it is synchronized on the same object. That way, the one the looks can never see the invariant in the broken state.

http://stackoverflow.com/a/25792311
accepted answer of: http://stackoverflow.com/q/25792197
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/25792197
type: Answer
upvote count: 1
has body: Press ctrl-C in the command prompt where you ran standalone.bat from.
score: 1

http://stackoverflow.com/q/25766671
has comment: http://stackoverflow.com/comment/40294686
has title: How to encode a cookie data in jsp and decode it in php?
type: UnansweredQuestion
tagged with: php
downvote count: 1
has comment: http://stackoverflow.com/comment/40295659
tagged with: cookies
has body: We have created a cookie like below Cookie userNamecookie = new Cookie ("username", URLEncoder.encode(snUser.getUsername(), "UTF-8")); userNamecookie.setPath("/"); userNamecookie.setMaxAge(60); response.addCookie(userNamecookie); but i want to create cookie with encoded data and that has to be decode in php. Can any one please help me.
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/25767205
type: Question
has comment: http://stackoverflow.com/comment/40294961
has comment: http://stackoverflow.com/comment/40294700
has comment: http://stackoverflow.com/comment/40295102
upvote count: 0
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/40294546
favorite count: 0
tagged with: encode
has comment: http://stackoverflow.com/comment/40294650

http://stackoverflow.com/a/25846588
answers question: http://stackoverflow.com/q/25846078
score: 1
downvote count: 0
has body: Generally speaking you cannot do this. You can't access arbitrary file details from another system. However, on an appropriately configured Windows system, you can refer to network shares on remote systems. See this Q&amp;A for details: How to Read file from a shared location Windows? (Java) Similarly, on Linux or other Unix-like operating systems, you can access remote file systems that have been mounted; e.g. via NFS.
type: Answer
upvote count: 1

http://stackoverflow.com/a/25822096
type: Answer
accepted answer of: http://stackoverflow.com/q/25821845
answers question: http://stackoverflow.com/q/25821845
score: 0
has body: Your code contains several problems. So let us fix that one by one in each method: public static void main(String[] args) throws FileNotFoundException { // get the filename Scanner keyboard = new Scanner(System.in); System.out.print("Enter the name of the file: "); String filename = keyboard.nextLine(); keyboard.close(); // &lt;- don't forget to close this resource File file = new File(filename); //Scanner inputFile = new Scanner(file); // &lt;- this line is unnecessary, because you never use that variable lines(file); // &lt;- you already obtained a File object, so use it ;) words(file); characters(file); } Next method: public static void lines(File file) throws FileNotFoundException // mind the new argument type { Scanner inputFile = new Scanner(file); int lines = 0; while (inputFile.hasNextLine()) { lines++; inputFile.nextLine(); //&lt;- use "inputFile" instead of "file" } inputFile.close(); //return lines; // &lt;- you can't return something if your method uses "void" as the return type //your comment on that method says that you like to print the result, so let's do that System.out.println("The number of lines is: " + lines); } And the next one: public static void words(File file) throws FileNotFoundException // &lt;- new argument type { Scanner inputFile = new Scanner(file); int words = 0; while (inputFile.hasNextLine()) { //String word = inputFile.next(); // that won't work like you think, but we can do a little "trick" here String line = inputFile.nextLine(); // read the current line of text words += line.split(" ").length; // split the line using whitespace and add the number of words to the current value of variable "words" //words++; // &lt;- not needed anymore } //return words; // &lt;- like before: not possible if return type is void inputFile.close(); //your comment on that method says that you like to print the result, so let's do that System.out.println("The number of words is: " + words); } And the last method: public static void characters(File fil…
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40409436

http://stackoverflow.com/comment/40276878
score: 0
has text: in place of int j = (int) c;
type: AnswerComment
comment on: http://stackoverflow.com/a/25756925
type: Comment

gwt-rpc
tags question: http://stackoverflow.com/q/25869416
type: Tag
tag name: gwt-rpc

http://stackoverflow.com/a/26503409
type: Answer
answers question: http://stackoverflow.com/q/25789163
downvote count: 1
score: -1
has body: You can use volumeAttachmentApi.listAttachmentsOnServer() to do this. NovaApi novaApi = context.unwrapApi(NovaApi.class);VolumeApi volumeApi = novaApi.getVolumeExtensionForZone(region).get(); VolumeAttachmentApi volumeAttachmentApi = novaApi.getVolumeAttachmentExtensionForZone(region).get(); volumeAttachmentApi.listAttachmentsOnServer(serverId)
upvote count: 0

http://stackoverflow.com/q/25751216
tagged with: classloader
has body: I'm getting the following error: com.sun.xml.messaging.saaj.soap.MessageFactoryImpl cannot be cast to javax.xml.soap.MessageFactory Is there a way to force use of the MessageFactory from saaj-api over the one from javaee-api? At least that's what I think may need to be done. javax javaee-api 7.0 com.sun.xml.messaging.saaj saaj-impl 1.3.15 javax.xml.soap saaj-api 1.3.5 <prefer-application-packages> javax.xml.soap.* javax.xml.ws.* com.sun.xml.messsaging.saaj.* </prefer-application-packages>
tagged with: war
tagged with: spring
has title: Setting the Order of Precedence of Jars in WAR
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25751276
accepted answer: http://stackoverflow.com/a/25751276
tagged with: java
type: Question
tagged with: weblogic
score: 0
answer count: 1

http://stackoverflow.com/a/25801592
has body: You can create a read only user in the following way : SQL&gt; create user read_only identified by read_only; User created. SQL&gt; grant create session, select any table, select any dictionary to read_only; Grant succeeded. SQL&gt; conn read_only@pdborcl/read_only; Connected. SQL&gt; create table t(col number); create table t(col number) * ERROR at line 1: ORA-01031: insufficient privileges SQL&gt; desc scott.emp; Name Null? Type ----------------------------------------- -------- ---------------------------- EMPNO NOT NULL NUMBER(4) ENAME VARCHAR2(10) JOB VARCHAR2(9) MGR NUMBER(4) HIREDATE DATE SAL NUMBER(7,2) COMM NUMBER(7,2) DEPTNO NUMBER(2) SQL&gt; select count(*) from scott.emp; COUNT(*) ---------- 14 SQL&gt; update scott.emp set ename='LALIT'; update scott.emp set ename='LALIT' * ERROR at line 1: ORA-01031: insufficient privileges SQL&gt; insert into scott.emp(ename) values('LALIT'); insert into scott.emp(ename) values('LALIT') * ERROR at line 1: ORA-01031: insufficient privileges SQL&gt;
score: 5
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/25801401
has comment: http://stackoverflow.com/comment/40359235
type: Answer

http://stackoverflow.com/comment/40407541
score: 0
has text: How does this machine decide when to transition to another state?
comment on: http://stackoverflow.com/q/25828694
type: Comment
type: QuestionComment

morphia
tag name: morphia
type: Tag
tags question: http://stackoverflow.com/q/25718806

http://stackoverflow.com/comment/40433532
has text: The `.jrxml` should have already been compiled. Then all you need to do is load the resulting `.jasper` file and fill it...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25842748

http://stackoverflow.com/comment/40382315
has text: @AlexWien a quick A.L. experiment with an option for the self-replication and mutation. Maybe Java is a wrong language then ?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25814671

http://stackoverflow.com/a/25820947
has body: M confused what u asked what i understood is u are not able to return the response to the dog driver class so for that just call getResponse method from your dog driver class : public class DogDriver{ public static void main(String args[]){ System.out.println("\nWhat trick shall Sparky do?"); System.out.println("Roll Over"); System.out.println("Jump"); System.out.println("Sit"); System.out.println("Bark"); System.out.print("\nYour command: "); final String command = keyboard.nextLine(); Dog dog = new Dog(); String response = dog.getResponse(command); System.out.println(response); } } And your dog class code will be public String getResponse(final String command) { if (command.equalsIgnoreCase("Roll Over")) { // Roll Over Code response = "I just Rolled Over!"; } // rest of the commands return response; }
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/25820793
answers question: http://stackoverflow.com/q/25820793
type: Answer
has comment: http://stackoverflow.com/comment/40393937

http://stackoverflow.com/q/25715653
score: 0
answer count: 1
duplicate of: http://stackoverflow.com/q/18384930
has answer: http://stackoverflow.com/a/25715829
has title: Trying to understand this Regex code
tagged with: regex
has comment: http://stackoverflow.com/comment/40199916
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25715829
has body: I have the following code. As far as I can see, the program should print 0123445. Instead, it prints 01234456. import java.util.regex.Matcher; import java.util.regex.Pattern; public class Regex2 { public static void main(String[] args) { Pattern p = Pattern.compile("\\d*"); Matcher m = p.matcher("ab34ef"); boolean b = false; while(b=m.find()){ System.out.print(m.start() + m.group()); } System.out.println(); } } I think the following should happen- Since the search pattern is for a \d*, It finds a hit at position 0, but since the hit is not a digit, it just prints 0 It finds a hit at position 1, but again, not a digit, prints 0 Finds a hit at position 2 and since we are looking for \d*, the hit is 34, and so it prints 234. Moves to position 4, finds a hit, but since hit is not a digit, it just prints 4. Moves to position 5, finds a hit, but since hit is not a digit, it just prints 5. At this point, as far as I can see, it should be done. But for some reason, the program also returns a 6. Much appreciate it if someone can explain.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/40199899
linked to: http://stackoverflow.com/q/18384930

http://stackoverflow.com/comment/40323398
type: Comment
has text: @peter.petrov: seriously ? Perhaps you could explain how you would calculate the loop indices when the start index for each loop varies as per the OP's case ?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25781054

http://stackoverflow.com/a/25749898
score: 0
answers question: http://stackoverflow.com/q/25748782
type: Answer
has body: So the issue ended up being that I was passing the same integer ID argument to initLoader for both the original call, AND the one in the first LoadManager's onLoadFinished method. I assume this was resulting in the result of the first loader to be returned to the wrong manager.

http://stackoverflow.com/a/25831691
has body: see this https://netbeans.org/kb/74/web/quickstart-webapps-gwt.html and also this http://www.gwtproject.org/doc/latest/DevGuideUiHandlers.html That should take care of you.
answers question: http://stackoverflow.com/q/25831473
type: Answer
accepted answer of: http://stackoverflow.com/q/25831473
has comment: http://stackoverflow.com/comment/40413827
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/59393201

http://stackoverflow.com/comment/40627305
comment on: http://stackoverflow.com/a/25783078
type: AnswerComment
type: Comment
score: 1
has text: "New applications should prefer TypeAdapter, whose streaming API is more efficient than this interface's tree API." You should better use TypeAdapters for efficiency.

http://stackoverflow.com/comment/40300786
score: 0
comment on: http://stackoverflow.com/q/25769001
type: Comment
type: QuestionComment
has text: Do you just want to know about a part closing or are you trying to prevent the close?

http://stackoverflow.com/q/25713407
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25713446
tagged with: java
tagged with: dom
accepted answer: http://stackoverflow.com/a/25713446
answer count: 1
score: 0
has title: how to find the natural order of a element in XML?
tagged with: http://stackoverflow.com/tag/xml
has body: I have to find the natural order of element in the xml .i am not sure where to start ? here is the requirement : I have to find the correct order of all the figure element In the above sample code figure there are 11 figure element . and i have to get the order of each figure element , Suppose for the moment i am at element then i have to count all the figure element before that (total 9) I am processing the xml in java using the dom . and at run time
type: Question

http://stackoverflow.com/q/25873067
score: 5
upvote count: 5
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/26014566
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has body: I need to create an Eclipse Debugger Plugin that is able to debug embedded code, running at a Cortex-M0 core. My plugin depends on an existing plugin for debugging arm applications: GNU ARM Eclipse JLink plugin (http://gnuarmeclipse.livius.net/blog/) My debugger plugin should be able to send information (like src code line, file etc) to a java application when a breakpoint is hit and when the user presses resume and suspend button. According to https://www.eclipse.org/articles/Article-Debugger/how-to.html , I have to implement my own Eclipse Debug Model I have managed to create a Launch Delegate that extends GNU ARM JLink plugin LaunchConfigurationDelegate class, so that I do not have to rewrite the code that initializes the debug environment. From the GNU ARM Eclipse JLink plugin src code, I understand that it does not extend the default functionality of Eclipse when a breakpoint is hit or the user presses resume,step into etc. So I do not have an existing jlink plugin class to extend. In my debug model I created classes that implement IDebugTarget, IStackFrame, IThread and extend DebugElement among others. I thought that by implementing classes from org.eclipse.debug.core.model.ISuspendResume &amp; org.eclipse.debug.core.model.IStep I would be able to catch breakpoint hit events and stepping events. But still, I can not catch any debug events in my plugin code. Do you have any hints on how to catch debug events in my plugin (suspend,resume,step into,step over etc) from the Eclipse UI? Could you inform me which classes should I extend or which interfaces should I implement in order to catch code stepping events?
has answer: http://stackoverflow.com/a/26014566
has title: Extending Eclipse Debug Functionality
tagged with: java
type: Question
tagged with: debugging

http://stackoverflow.com/comment/60175266
comment on: http://stackoverflow.com/a/25743164
type: Comment
has text: Also, this link seems to be broken now.
score: 1
type: AnswerComment

http://stackoverflow.com/a/25716605
answers question: http://stackoverflow.com/q/25716587
score: 0
has body: if ((( clx + 31 + rectleftup&gt;=500) &amp;&amp; ( clx + 31 + rectleftup &lt;=820))) || ... // 123 2 3 210 // \_________________________________________________________________/ // Bracket balance You have "closed off" the if statement condition fully at that final closing bracket above, you are not permitted to keep going. I suspect it will all work fine if you simply wrap () around the whole thing, or remove the closing bracket before the || and the opening bracket _afterthe||`. You may find it's also more readable if you do something like: int p1 = clx + 31 + recleftup; // though use better var name than p1. int p2 = cly - 300; // ditto. if (((p1 &gt;= 500) &amp;&amp; (p1 &lt;= 820)) || ((p2 &gt;= 500) &amp;&amp; (p2 &lt;= 789))) {
type: Answer

http://stackoverflow.com/q/25763486
possible better answer: http://stackoverflow.com/a/25763609
has title: Coordinate generation for memory card game
has answer: http://stackoverflow.com/a/25763609
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/25763545
tagged with: android
has answer: http://stackoverflow.com/a/25763613
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25763545
tagged with: java
tagged with: coordinates
tagged with: andengine
has body: How can I generate (x, y) coordinates for a memory card game? Let's say I can set the number of cards, rows and columns. How would my for loop look like? My general idea is as follows: final int ROWS = 4; final int COLUMNS = 5; for(int i = 0; i&lt;ROWS; i++){ for(int j = 0; j&lt;COLUMNS; j++){ //calculate X coordinate int index = some_calculation MemoryCard memoryCard = new MemoryCard(x, y, index); } //calculate y coordinate } However, I'm having an issue creating my objects here. The above loop will go 4 times for i and 5 times for j. So, in total I have 20 objects there. But how do I get to my object's index? Let's say I have an array list of my objects: private ArrayList&lt;MemoryCard&gt; objects = new ArrayList&lt;MemoryCard&gt;(); //parameters for MemoryCard object are (float x, float y, Texture frontImage) Is there a way to make this dynamic? To make the program generate proper positions if I set number of ROWS to 3 and COLUMS to 6? Or any other even pair.
type: Question

http://stackoverflow.com/q/25720237
score: -1
answer count: 6
has title: Getting same output in an ArrayList Java
has answer: http://stackoverflow.com/a/25720290
upvote count: 0
has answer: http://stackoverflow.com/a/25720332
favorite count: 0
has answer: http://stackoverflow.com/a/25720316
tagged with: arraylist
has body: So I was making a java class "Tile", and I added an ArrayList so I can store those tiles in it. And i wanted to loop through the array and print out the details of each tile. I'm getting the same output every time. Here's the main class: package com.OriginsB; import java.util.ArrayList; public class Main { private static final int range = 5; public static ArrayList&lt;Tile&gt; tilearr = new ArrayList&lt;Tile&gt;(range); public static void main(String[] args) { for(int i=1; i&lt;range; i++){ tilearr.add(new Tile(i, i+1)); } for(int i=0; i&lt;tilearr.size(); i++){ System.out.println(tilearr.get(i)); } } } And here's the Tile class: package com.OriginsB; public class Tile { private static int ID; private static int Pos; public Tile(int ident, int Position){ Pos = Position; ID = ident; } @Override public String toString(){ return "Tile with ID: "+ID+" with pos: "+Pos; } } I'm getting the same output: Tile with ID: 4 with pos: 5 Tile with ID: 4 with pos: 5 Tile with ID: 4 with pos: 5 Tile with ID: 4 with pos: 5 Help?
has answer: http://stackoverflow.com/a/25720279
type: UnansweredQuestion
downvote count: 1
has answer: http://stackoverflow.com/a/25720284
type: Question
tagged with: oop
has answer: http://stackoverflow.com/a/25720274
tagged with: java

http://stackoverflow.com/comment/40210111
type: QuestionComment
comment on: http://stackoverflow.com/q/25720921
score: 0
has text: @J.Lucky no it suppose to be diff object but in my case all are same.
type: Comment

http://stackoverflow.com/q/25777659
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25777677
tagged with: shallow-copy
has comment: http://stackoverflow.com/comment/40314866
tagged with: reference
has body: I'm working on some code and trying to figure out how to copy an object reference to another object. I keep seeing the clone() method used, but I've read it's flawed and the class I'm wanting to copy is already implementing serializable. So one question I have is about the difference between using '=' and the clone method - My understanding is that both of these are shallow copies so they should work the same, but if that's true, then what is the benefit of having a method for this? The code I'm working on has 2 arrays of objects - both the same type of object, all objects in both arrays are initially null, and I assign the values of array B to equal array A. As the code progresses objects in array A are initialized and values are assigned to the variables of the objects in array A. At the end of the code though, all objects in array B are still null. Do I have the concept wrong here? If the concept isn't wrong I assume it's just something I'm overlooking in my code. Any help is appreciated.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40314901
type: Question
tagged with: clone
has title: Using '=' versus clone() in Java
tagged with: java
has answer: http://stackoverflow.com/a/25777683

http://stackoverflow.com/a/25847055
downvote count: 1
has comment: http://stackoverflow.com/comment/133298794
upvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/25846938
has body: There is no reason to add that extra parsing code in the compiler because the functionality is really useless, how many one line methods have you written that are not accessors or mutators? This has been dealt with in C# via properties but not yet in Java. So the reason is, it's unlikely to be used considering most developers discourage leaving out optional bracket blocks anyway.
score: -1
has comment: http://stackoverflow.com/comment/133339115

http://stackoverflow.com/a/25754257
score: 3
has comment: http://stackoverflow.com/comment/40272335
has body: If you know that the each of the dimensions' lengths won't change, then you can simulate a 6D array with a 1D array. The trick is to multiply the indexes for all but the last index c by a high enough number so that there won't be any collisions between distinct sets of 6D indexes mapping to the same 1D index. int[] oneDArray = new int[2*2*3*5*2*2]; And for the calculation of the 1D index, using the 6 6D indexes. Multiplying by the product of all the dimensions' lengths after each particular 6D index will avoid the collisions. int oneDIndex = 2*3*5*2*2 * a // last 5 dimensions' lengths + 3*5*2*2 * l // last 4 dimensions' lengths; variable letter l + 5*2*2 * y // last 3 dimensions' lengths + 2*2 * r // last 2 dimensions' lengths + 2 * oc // last dimension's length only + c; // no multiplier necessary for last index It will be better to use constants for each of the dimensions' lengths here, to reduce hard-coding.
has comment: http://stackoverflow.com/comment/40272230
answers question: http://stackoverflow.com/q/25754101
upvote count: 3
type: Answer
has comment: http://stackoverflow.com/comment/40272519
downvote count: 0

http://stackoverflow.com/comment/40565503
type: Comment
comment on: http://stackoverflow.com/a/25915436
has text: public class MyApp extends CordovaActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.init(); super.loadUrl(Config.getStartUrl()); } public void onBackPressed() { finish(); } } Unfortunately, it does not change anything.
score: 0
type: AnswerComment

http://stackoverflow.com/q/25805949
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25806260
has title: how to validate textbox input as a digit in netbeans
has comment: http://stackoverflow.com/comment/40365760
upvote count: 0
tagged with: java
has body: my problem is how to validate textbox input as a digit and the textbox shouldn't be empty. i need to check these 2 at once code segment //i code for not emty if(jTextField1.getText())
has answer: http://stackoverflow.com/a/25806144
type: Question
score: -1
has comment: http://stackoverflow.com/comment/40365663
answer count: 2
tagged with: validation
downvote count: 1
tagged with: netbeans-7
favorite count: 0

http://stackoverflow.com/comment/113040372
type: AnswerComment
score: 0
type: Comment
has text: repo was deleted
comment on: http://stackoverflow.com/a/40415747

http://stackoverflow.com/q/25816851
tagged with: android
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40386566
possible better answer: http://stackoverflow.com/a/25817003
score: 1
has answer: http://stackoverflow.com/a/25816943
tagged with: java
has answer: http://stackoverflow.com/a/25817003
upvote count: 1
type: Question
tagged with: object
has title: Why can't I multiply an object?
has body: I'm working with Android (Java), and what I want is to take a class, and make 3 instances out of it, but with some variables set to random. public class MainActivity extends Activity{ Player ourView; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ourView = new Player(this); setContentView(ourView); } protected void onPause() { super.onPause(); ourView.pause(); } protected void onResume() { super.onResume(); ourView.resume(); } } The other class... public class Player extends SurfaceView implements Runnable { Canvas canvas = new Canvas(); SurfaceHolder ourHolder; Thread ourThread = null; boolean isRunning = true; public Player(Context context) { super(context); ourHolder = getHolder(); ourThread = new Thread(this); ourThread.start(); } public void pause() { isRunning = false; while(true){ try{ ourThread.join(); } catch (InterruptedException e) { e.printStackTrace(); } break; } ourThread = null; } public void resume() { isRunning = true; } public void run() { while(isRunning) { if(!ourHolder.getSurface().isValid()) continue; canvas = ourHolder.lockCanvas(); canvas.drawRGB(30, 30, 200); Enemy[] enemy = new Enemy[3]; for(int i = 0; i&lt;enemy.length; i++){ enemy[i] = new Enemy(); enemy[i].draw(); } ourHolder.unlockCanvasAndPost(canvas); } } } And the "Enemy" class: public class Enemy{ Canvas canvas = new Canvas(); float x = (float) (Math.random()*200); float y = (float) (Math.random()*200); public void draw(){ Bitmap bitmap = (Bitmap) BitmapFactory.decodeResource(getContext(), R.drawable.ic_launcher); canvas.drawBitmap(bitmap, x, y, null); } } I can see that there are 3 bitmaps created, which is cool. But they don't stay still, it's like if the for loop never stops even though the condition is no longer satisfied. I've asked the question before but I couldn't find any answer. Hope you can help me, thanks.
tagged with: class
answer count: 2
accepted answer: http://stackoverflow.com/a/25816943
has comment: http://stackoverflow.com/comment/40386587
has comment: http://stackoverflow.com/comment/40386580
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40386486
has comment: http://stackoverflow.com/comment/40386690

http://stackoverflow.com/comment/40389364
type: QuestionComment
has text: "but doesn't do what you think it does"?
comment on: http://stackoverflow.com/q/25818084
score: 0
type: Comment

http://stackoverflow.com/comment/40464123
has text: How to fix the broken structure? I found out that dispatcher-servlet.xml and applicationContext.xml doesn't get included in the war that is built.
type: AnswerComment
comment on: http://stackoverflow.com/a/25854317
score: 0
type: Comment

tabs
type: Tag
tags question: http://stackoverflow.com/q/25759413
tag name: tabs
tags question: http://stackoverflow.com/q/25722546
tags question: http://stackoverflow.com/q/25812494

http://stackoverflow.com/comment/40257305
comment on: http://stackoverflow.com/a/25746406
score: 0
type: Comment
has text: @VinayVeluri One of OP questions was why TreeSet attains 100 000ms, while adding to ArrayList and then to TreeSet is faster, which is at first illogical. That is what I'm trying to answer.
type: AnswerComment

http://stackoverflow.com/comment/40213312
type: QuestionComment
comment on: http://stackoverflow.com/q/25720294
type: Comment
has text: Thank you for your reply, I am already using this constructor and I am facing this issue, I thought this related to JDK 7
score: 0

http://stackoverflow.com/a/25854878
has body: you can configure maven exec plugin in your pom.xml and then setup maven launch in idea, eclipse or run it from command-line or any other IDE.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/25854466
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40349843
comment on: http://stackoverflow.com/a/25796371
score: 0
type: Comment
has text: This question is about *dollar-sign name variables* as OP specified in his question. Also as explained in previous comment solution based on replacing each first key-value pair, then second key-value pair can cause problems. Lets say that our string looks like `hello ${key1} ${key2} ${key3} ...` which contains more of `key1`, `key2` and `key3`, and for some reason we want to change their order so now `key1->key2` `key2->key3` and `key3->key1`. With your approach we will end up with `key1` being everywhere (`key1` will become `key2` which will become `key3` which finally will become `key1`).
type: AnswerComment

http://stackoverflow.com/a/25773900
upvote count: 3
has body: Add a ChangeListener and set your label there. JLabel l = ...; JSpinner spinner = ...; spinner.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { l.setText("Counter = " + spinner.getValue()); } }
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/40341293
score: 3
accepted answer of: http://stackoverflow.com/q/25773858
has comment: http://stackoverflow.com/comment/40308559
answers question: http://stackoverflow.com/q/25773858
type: AcceptedAnswer

http://stackoverflow.com/comment/40406506
type: Comment
type: QuestionComment
has text: @chrylis, I misunderstood, I thought not to use inputstream. So are you saying the void getContent() function should return a byte[]? BTW, the [solution](http://stackoverflow.com/questions/5673260/downloading-a-file-from-spring-controllers) to a similar problem is using outputStream but mine doesn't work for a jpg file
score: 0
comment on: http://stackoverflow.com/q/25827079

flexjson
tags question: http://stackoverflow.com/q/25712967
tags question: http://stackoverflow.com/q/25789769
tag name: flexjson
type: Tag

http://stackoverflow.com/q/25776810
tagged with: java
type: Question
type: AnsweredQuestion
has body: Ok i've been trying to put together some code that will read the inbox of a shared mailbox. I was able to find this code try { // create properties field Properties properties = new Properties(); properties.put("mail.pop3.host", host); properties.put("mail.pop3.port", "110"); Session emailSession = Session.getInstance(properties, null); emailSession.setDebug(true); // create the POP3 store object and connect with the pop server Store store = emailSession.getStore("pop3s"); store.connect(host, username, password); // create the folder object and open it Folder emailFolder = store.getFolder("INBOX"); emailFolder.open(Folder.READ_ONLY); // retrieve the messages from the folder in an array and print it Message[] messages = emailFolder.getMessages(); System.out.println("messages.length---" + messages.length); for (int i = 0, n = messages.length; i &lt; n; i++) { Message message = messages[i]; System.out.println("---------------------------------"); System.out.println("Email Number " + (i + 1)); System.out.println("Subject: " + message.getSubject()); System.out.println("From: " + message.getFrom()[0]); System.out.println("Text: " + message.getContent().toString()); } // close the store and folder objects emailFolder.close(false); store.close(); } catch (Exception e) { e.printStackTrace(); } the point that is causing me issues is that even though I've specified port 110 it keeps changing to 995. Here is the debugging from JavaMail that I get DEBUG: setDebug: JavaMail version 1.5.2 DEBUG: getProvider() returning javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Oracle] DEBUG POP3: mail.pop3s.rsetbeforequit: false DEBUG POP3: mail.pop3s.disabletop: false DEBUG POP3: mail.pop3s.forgettopheaders: false DEBUG POP3: mail.pop3s.cachewriteto: false DEBUG POP3: mail.pop3s.filecache.enable: false DEBUG POP3: mail.pop3s.keepmessagecontent: false DEBUG POP3: mail.pop3s.starttls.enable: false DEBUG POP3: mail.pop3s.starttls.required: false DEBUG POP3: mail.pop3s.apop.enabl…
possible better answer: http://stackoverflow.com/a/25780545
has comment: http://stackoverflow.com/comment/40313344
has answer: http://stackoverflow.com/a/25780545
score: 0
tagged with: jakarta-mail
answer count: 2
has title: Javamail Changing Port Number
has comment: http://stackoverflow.com/comment/40313388
has answer: http://stackoverflow.com/a/25776909
accepted answer: http://stackoverflow.com/a/25776909

nosuchmethoderror
type: Tag
tags question: http://stackoverflow.com/q/25760518
tag name: nosuchmethoderror
tags question: http://stackoverflow.com/q/25823246

http://stackoverflow.com/a/25805930
answers question: http://stackoverflow.com/q/25797895
upvote count: 3
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/40372126
score: 3
has comment: http://stackoverflow.com/comment/40371819
has body: Sotirios comment pushed me forward - how to get a Jsp handling servlet into the embedded Jetty.... In getServletContextHandler I changed the instantiation of contextHandler to now be a WebAppContext. All the same methods apply to this. I then created this method to take the returned WebAppContext and set up Jsp Handling (snippet taken from here : https://github.com/jetty-project/embedded-jetty-jsp/blob/master/src/main/java/org/eclipse/jetty/demo/Main.java) private void setupJspHandler(WebAppContext context) { //Ensure the jsp engine is initialized correctly JettyJasperInitializer sci = new JettyJasperInitializer(); ServletContainerInitializersStarter sciStarter = new ServletContainerInitializersStarter(context); ContainerInitializer initializer = new ContainerInitializer(sci, null); List<ContainerInitializer> initializers = new ArrayList<ContainerInitializer>(); initializers.add(initializer); context.setAttribute("org.eclipse.jetty.containerInitializers", initializers); context.addBean(sciStarter, true); // Set Classloader of Context to be sane (needed for JSTL) // JSP requires a non-System classloader, this simply wraps the // embedded System classloader in a way that makes it suitable // for JSP to use ClassLoader jspClassLoader = new URLClassLoader(new URL[0], this.getClass().getClassLoader()); context.setClassLoader(jspClassLoader); // Add JSP Servlet (must be named "jsp") ServletHolder holderJsp = new ServletHolder("jsp",JspServlet.class); holderJsp.setInitOrder(0); holderJsp.setInitParameter("logVerbosityLevel","INFO"); holderJsp.setInitParameter("fork","false"); holderJsp.setInitParameter("xpoweredBy","false"); holderJsp.setInitParameter("compilerTargetVM","1.7"); holderJsp.setInitParameter("compilerSourceVM","1.7"); holderJsp.setInitParameter("keepgenerated","true"); context.addServlet(holderJsp, "*.jsp"); } I imported the following in my maven pom: org.eclipse.jetty jetty-jsp ${jetty.version} org.eclipse.jetty apache-jsp ${jetty.version} And also had to tur…
accepted answer of: http://stackoverflow.com/q/25797895
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40371692

http://stackoverflow.com/comment/40320608
type: AnswerComment
type: Comment
has text: I am having problem with the Mapping of spring. Can you please provide a sample.
comment on: http://stackoverflow.com/a/25780610
score: 0

http://stackoverflow.com/a/25788232
upvote count: 4
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25788174
answers question: http://stackoverflow.com/q/25788174
score: 4
type: AcceptedAnswer
has body: You are splitting on just the comma, therefore your array contains strings with spaces in front. Use this regex instead to split: lang.split("\\s*,\\s*") On a side note, you don't need these three lines: List&lt;String&gt; result = new ArrayList&lt;String&gt;(); String[] languages = lang.split(...); result = Arrays.asList(languages); All you need is List&lt;String&gt; result = Arrays.asList(lang.split(...));
type: Answer

http://stackoverflow.com/q/25797768
has answer: http://stackoverflow.com/a/25798121
answer count: 1
downvote count: 0
favorite count: 0
has title: Hibernate criteria using left join to filter results
accepted answer: http://stackoverflow.com/a/25798121
score: 1
tagged with: java
tagged with: hibernate
upvote count: 1
has body: JSF application with hibernate Is there a way to use a join to filter the results returned by criteria list? Example: i have 2 tables. orders and customers. @Entity(name = "order") public class Order { @Id private int id; private String billingCustomerId; private String shippingCustomerId; private Date orderDate; .... } @Entity(name = "customer") public class Customer { @Id private String id; private String name; private String emailAddress .... } I need to return all orders for customers that are missing an email address and all orders that the order.billingCustomerId = null and order.shippingCustomerId = null. The customer could match on the billingCustomerId or shippingCustomerId. The SQL I would use select o.* from order as o LEFT join customer as c1 on o.billingCustomerId = c1.id LEFT join customer as c2 on o.shippingCustomerId= c2.id where (o.billingCustomerId is null and o.shippingCustomerId is null) or (o.billingCustomerId is not null and c1.emailAddress is null) or (o.shippingCustomerIdis not null and c2.emailAddress is null) Hibernate Criteria Criteria criteria1 = session.createCriteria(Order.class); criteria.add(Restrictions.and(Restrictions.isNull("billingCustomerId"), Restrictions.isNull("shippingCustomerId")); List&lt;Order&gt; = criteria.list(); This will return the list of orders that billing /shipping customer = null. How can i change the criteria to also include the orders for customers with missing email addresses? Disjunction disjunciton = Restrictions.disjunction(); Criteria criteria = session.createCriteria(Order.class); disjunciton.add(Restrictions.and(Restrictions.isNull("billingCustomerId"), Restrictions.isNull("shippingCustomerId"))); disjunciton.add(... ...) criteria.add(disjunciton); List&lt;Order&gt; = criteria.list(); I have not been able to find examples of joining on a column, but only where the table have a common key.
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/23958048

http://stackoverflow.com/a/25755976
type: Answer
has comment: http://stackoverflow.com/comment/40312835
has comment: http://stackoverflow.com/comment/40444825
upvote count: 1
has comment: http://stackoverflow.com/comment/40417821
has body: Hope you are well too! I have had a look here and could not find any clear indications of access to individual classifiers from the Evaluation Class. I also ran a test sample using 10-fold cross-validation for J48 and there appeared to be no clear access to individual classifiers either. If you need to find the best of the ten, perhaps you could programmatically generate the 10 folds and use the Training and Evaluation algorithms that you have applied above, then save the classifier that gave the best results in the end. Hope this helps! UPDATE! Based on the changes above, please find below one possible solution for selecting and saving the best classifier: // Run for each model Classifier bestClassifier = models[0]; double bestAccuracy = -1; for (int j = 0; j &lt; models.length; j++) { // Collect every group of predictions for current model in a FastVector FastVector predictions = new FastVector(); // For each training-testing split pair, train and test the classifier for (int i = 0; i &lt; trainingSplits.length; i++) { Evaluation validation = classify(models[j], trainingSplits[i], testingSplits[i]); predictions.appendElements(validation.predictions()); } // Calculate overall accuracy of current classifier on all splits double accuracy = calculateAccuracy(predictions); if (accuracy &gt; bestAccuracy) { bestClassifier = models[j]; bestAccuracy = accuracy; } // Print current classifier's name and accuracy in a complicated, // but nice-looking way. System.out.println("Accuracy of " + models[j].getClass().getSimpleName() + ": " + String.format("%.2f%%", accuracy)); } // Save the Best Classifier weka.core.SerializationHelper.write("best.model", bestClassifier);
score: 1
has comment: http://stackoverflow.com/comment/40461864
downvote count: 0
answers question: http://stackoverflow.com/q/25727679
has comment: http://stackoverflow.com/comment/40426767
has comment: http://stackoverflow.com/comment/40306262

http://stackoverflow.com/q/25732522
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40231631
tagged with: java
tagged with: dependency-properties
has body: getting below error when i try to run unit test in my java project: SLF4J: Class path contains multiple SLF4J bindings. SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/org/slf4j/slf4j-log4j12/1.5.8/slf4j-log4j12-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/Users/me/.m2/repository/ch/qos/logback/logback-classic/1.0.6/logback-classic-1.0.6.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See slf4j.org/… for an explanation. My pom.xml does have these dependencies: org.slf4j slf4j-api ${org.slf4j-version} org.slf4j log4j-over-slf4j ${org.slf4j-version} org.slf4j jcl-over-slf4j ${org.slf4j-version} My mvn dependency tree: [INFO] +- junit:junit:jar:4.8.1:test [INFO] +- storm:storm:jar:0.9.0.1:provided [INFO] | +- storm:storm-console-logging:jar:0.9.0.1:provided [INFO] | +- storm:storm-core:jar:0.9.0.1:provided [INFO] | | +- org.clojure:clojure:jar:1.4.0:provided [INFO] | | +- commons-io:commons-io:jar:1.4:provided [INFO] | | +- org.apache.commons:commons-exec:jar:1.1:provided [INFO] | | +- storm:libthrift7:jar:0.7.0-2:provided [INFO] | | | +- commons-lang:commons-lang:jar:2.5:provided [INFO] | | | \- javax.servlet:servlet-api:jar:2.5:provided [INFO] | | +- clj-time:clj-time:jar:0.4.1:provided [INFO] | | | \- joda-time:joda-time:jar:2.0:provided [INFO] | | +- com.netflix.curator:curator-framework:jar:1.0.1:provided [INFO] | | | +- com.netflix.curator:curator-client:jar:1.0.1:provided [INFO] | | | \- org.apache.zookeeper:zookeeper:jar:3.3.3:provided [INFO] | | | \- jline:jline:jar:0.9.94:provided [INFO] | | +- backtype:jzmq:jar:2.1.0:provided [INFO] | | +- com.googlecode.json-simple:json-simple:jar:1.1:provided [INFO] | | +- compojure:compojure:jar:1.1.3:provided [INFO] | | | +- org.clojure:core.incubator:jar:0.1.0:provided [INFO] | | | +- org.clojure:tools.macro:jar:0.1.0:provided [INFO] | | | +- clout:clout:jar:1.0.1:provided [INFO] | | | \- ring:ring-core:jar:1.1.5:provided [INFO] | | | \- commons-fileupload:common…
tagged with: apache-storm
type: Question
has title: Class path contains multiple SLF4J bindings, log back-classic and log4j
answer count: 1
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40231719
has comment: http://stackoverflow.com/comment/40232541
has answer: http://stackoverflow.com/a/25734010
tagged with: pom.xml
has comment: http://stackoverflow.com/comment/40232160
favorite count: 0
has comment: http://stackoverflow.com/comment/40232133
has comment: http://stackoverflow.com/comment/40232448
has comment: http://stackoverflow.com/comment/40232553
has comment: http://stackoverflow.com/comment/40232529
accepted answer: http://stackoverflow.com/a/25734010
upvote count: 1
tagged with: maven
has comment: http://stackoverflow.com/comment/40231769

http://stackoverflow.com/comment/40217844
has text: Have you tried to measure time of selecting/inserting images stored in different formats?
type: Comment
comment on: http://stackoverflow.com/q/25722611
score: 0
type: QuestionComment

http://stackoverflow.com/comment/40214279
has text: You could set a breakpoint in the `run` method of boths timers and check what's happening. Unless your code were some kind of experiment, I won't advise doing time-consuming stuff like reading from a DB in a timer that has to update GUI, it might block
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25721283

http://stackoverflow.com/comment/76152377
comment on: http://stackoverflow.com/a/42849578
score: 1
type: AnswerComment
has text: +1 Yes this works as well. JsonSerialize and JsonProperty both seem to work. I wonder if there are subtle differences and if one if preferred over the other.
type: Comment

http://stackoverflow.com/comment/40492190
comment on: http://stackoverflow.com/q/25856139
score: 0
type: Comment
has text: I understand; my comment was a design suggestion.
type: QuestionComment

http://stackoverflow.com/q/25728344
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/32372127
accepted answer: http://stackoverflow.com/a/32372127
score: 0
answer count: 1
has body: I made my JComboBox editable using: myCombo.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE); I encounter multible problems with the following task: When writing into the combobox, the new content of the box should be taken and compared with a list and all entries starting with this text should be shown in the popupmenu. So if i have a list with: "Aban" "Aben" "Aber" "Acen" "Aden" and enter "Ab" into the box, then the pop-up should display the first 3 entries. When clicking one of the entries (Either by keyboard selecting and pressing enter/tab or by clicking with a mouse) The ComboBox should get that value and the Popup should hide. I need to find this action as some of the elements have a note at the end (In backets which I require) but only when one of the entries is selected Here are the most imporant parts of my code: final JTextComponent tcA = (JTextComponent) myCombo.getEditor().getEditorComponent(); tcA.getDocument().addDocumentListener(new DocumentListener() { public void methodUsedByinsertUpdateAndremoveUpdate(DocumentEvent e) { String item = ((JTextComponent) myCombo.getEditor().getEditorComponent()).getText(); //Routine to get the new list in a vector, not pasted for readability DefaultComboBoxModel newMyComboModel = new DefaultComboBoxModel(myVectorList); myCombo.setModel(newMyComboModel); SwingUtilities.invokeLater(new Runnable() { public void run() { myCombo.showPopup(); } }); } } myCombo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if(myCombo.getModel().getSize() == 1) { //Special logic to find out if the selected item has a note SwingUtilities.invokeLater(new Runnable() { public void run() { myCombo.hidePopup(); } }); } } With this, i have: Trouble with the first character (Caret position not working correctly) Popup not automatically shown and hides when entering new character into the field Problems with Swing GUI not being actualised If you require more information just ask
has comment: http://stackoverflow.com/comment/40242412
has title: Editable JComboBox with dynamic entries
has comment: http://stackoverflow.com/comment/40224917
has comment: http://stackoverflow.com/comment/93056873
tagged with: jcombobox
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/40238737
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25736126
score: 0
has text: `" 66"` is not `"66"`. The documentation [is pretty clear on why this is invalid here](http://docs.oracle.com/javase/7/docs/api/java/lang/Integer.html#parseInt(java.lang.String)): "The characters in the string *must all be decimal digits*, except that the first character may be an ASCII minus sign.."

http://stackoverflow.com/a/25867527
has comment: http://stackoverflow.com/comment/40500490
has body: This is not possible as the default keystore (jks) is a proprietary format used by Java. To exchange the key you would need something portable like PKCS#11 (which is a supported KeyStore format at least in Java 8).
has comment: http://stackoverflow.com/comment/40480225
answers question: http://stackoverflow.com/q/25867314
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40506202
has comment: http://stackoverflow.com/comment/40739344
type: Answer
has comment: http://stackoverflow.com/comment/40478413
upvote count: 1
has comment: http://stackoverflow.com/comment/40539566

http://stackoverflow.com/a/48642479
score: 0
has body: I had the same issue. In my case, I was sending a timestamp (base encoded) as one of the headers. The device's (in which I was testing) time was set to a past time which made authorization failure. (I know this post is old. Just added my experience, it might be of use to someone)
type: Answer
answers question: http://stackoverflow.com/q/25753615

http://stackoverflow.com/comment/40202105
score: 0
type: AnswerComment
type: Comment
has text: Considering ortho sets up an integer-perfect pixel space (1f correlates to 1 pixel) in this setup, the error needed to create a 1-pixel gap as seen would have to be >.5f, which seems way off, and would have to have the very specific scenario of the error being centered on the exact integer so that the rasterizer rounds the lower into pixel 1, skips over pixel 2 entirely, then rounds into pixel 3.
comment on: http://stackoverflow.com/a/25716596

http://stackoverflow.com/q/25859745
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/40464508
accepted answer: http://stackoverflow.com/a/25859781
answer count: 3
possible better answer: http://stackoverflow.com/a/25859778
has answer: http://stackoverflow.com/a/25859778
has comment: http://stackoverflow.com/comment/40464492
has comment: http://stackoverflow.com/comment/40464541
has title: How do I make the simplest Java program with one method?
type: AnsweredQuestion
has body: I need to take an int from the user, plug it into a formula, then return the calculated value. I feel like I should be able to do this without creating a constructor class, initializing an object, and then calling a method on that class, but I don't know how to. Here is some code that doesn't work, but it is all I have so far. How would I make this streamlined? public class Problem1 { public static void main(String[] args) { Scanner input=new Scanner(System.in); //Let user pick value of n System.out.println("Please pick a value of n."); int n=input.nextInt(); Problem1 codeTest = new Problem1(); codeTest.code(n); } public int code(int n) { int sum=0; for (int i=0; i&lt;n; i++) sum++; return sum; } }
has answer: http://stackoverflow.com/a/25859812
has answer: http://stackoverflow.com/a/25859781
tagged with: methods
type: Question

http://stackoverflow.com/a/25728762
answers question: http://stackoverflow.com/q/25728188
has comment: http://stackoverflow.com/comment/40267513
type: Answer
has body: If you have custom controls in your application then it should be specified using the full package in your layout XML, if only "yourcustomcontrol" is used it will throw this error. For example: &lt;yourcustomcontrol android:id="@+id/yourCustomControl1" /&gt; will throw error. &lt;packageName.yourcustomcontrol android:id="@+id/yourCustomControl1" /&gt; will work. More about custom controls can be found at the android developers' homepage here Originally answered here.
score: 0

http://stackoverflow.com/a/25827512
type: Answer
has body: Your test is wrong : if(i%2 == 0) should be if(array[i][j] % 2 == 0)
score: 4
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/25827474

checkbox
tag name: checkbox
tags question: http://stackoverflow.com/q/25725871
type: Tag

http://stackoverflow.com/q/25770768
has comment: http://stackoverflow.com/comment/40301421
favorite count: 0
accepted answer: http://stackoverflow.com/a/25770920
has body: I am creating a piece of software using Java and Eclipse. The software is to be freestanding and not require an internet connection. The main use of the program requires access to database. I am used to developing for Android where there is an inbuilt MySQL database in every device. Is there a similar thing with Java. I have looked everywhere and have seen references to this kind of thing but have not seen any clear answers. I know there is JDBC, but this seems to be a method of controlling the database rather than creating it. What I am trying to establish is, is there a pre installed database available to use in Eclipse without any further installation, in the same way as the MySQL Db is available when using Android?? The version of Java I am using is java.runtime.version=1.7.0_40-b43 and I am using Eclipse Kepler Service Release 2
upvote count: 1
has comment: http://stackoverflow.com/comment/40302425
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40301462
tagged with: java
tagged with: database
tagged with: eclipse
has comment: http://stackoverflow.com/comment/40301499
answer count: 2
has answer: http://stackoverflow.com/a/25770984
has title: Java local database
has answer: http://stackoverflow.com/a/25770920
downvote count: 0
has comment: http://stackoverflow.com/comment/40301566
score: 1
possible better answer: http://stackoverflow.com/a/25770984

http://stackoverflow.com/comment/40281054
score: 0
has text: the system is windows 7
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25758708

http://stackoverflow.com/q/25859163
favorite count: 0
has title: Getting R, G, or B in Buffered image
type: UnansweredQuestion
has body: I have a piece of a method that I am working on. The goal of this is to loop over every pixel in an image, get the values of the pixels around it and create a gradient that I can then compare to a threshold to decide if there is an edge present. I get an error of "Cannot invoke getBlue() on the primitive type int" and I cannot figure out why. int grad = 0; for (int i=0; i&lt;img.getWidth(); i++) { for (int j=0; j&lt;img.getHeight(); j++) { grad += abs(img.getRGB(i+1,j).getBlue()-img.getRGB(i-1,j).getBlue() + abs(img.getRGB(i,j+1).getBlue()-img.getRGB(i,j-1).getBlue()); grad += abs(img.getRGB(i+1,j).getGreen()-img.getRGB(i-1,j).getGreen()) + abs(img.getRGB(i,j+1).getGreen()-img.getRGB(i,j-1)getGreen()); grad += abs(img.getRGB(i+1,j).getRed()-img.getRGB(i-1,j).getRed()) + abs(img.getRGB(i,j+1).getRed()-img.getRGB(i,j-1).getRed());
has answer: http://stackoverflow.com/a/25859288
upvote count: 0
has answer: http://stackoverflow.com/a/25859206
tagged with: java
has answer: http://stackoverflow.com/a/25859215
type: Question
score: -1
answer count: 3
downvote count: 1

http://stackoverflow.com/a/25760486
accepted answer of: http://stackoverflow.com/q/25760233
type: Answer
has comment: http://stackoverflow.com/comment/84650191
has body: You have to take the total count and then fetch the last N records. Criteria count = session.createCriteria(UserTable.class); count.setProjection(Projections.rowCount()); Long total = count.uniqueResult(); int n; Criteria criteria = session.createCriteria(UserTable.class); criteria.setFirstResult(total-n); criteria.setMaxResults(n); List&lt;UserTable&gt; list = criteria.list(); If you maintain the entry timestamp then you can add order and fetch the last n results Criteria criteria = session.createCriteria(UserTable.class); criteria.addOrder(Order.desc("timestamp")); criteria.setMaxResults(n); List&lt;UserTable&gt; list = criteria.list(); To get any random entries set your first result to any random value, which must be less than total count.
upvote count: 2
has comment: http://stackoverflow.com/comment/84725216
answers question: http://stackoverflow.com/q/25760233
score: 2
has comment: http://stackoverflow.com/comment/104944186
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/84634171

webview
tags question: http://stackoverflow.com/q/25754394
tag name: webview
tags question: http://stackoverflow.com/q/25767863
tags question: http://stackoverflow.com/q/25769253
tags question: http://stackoverflow.com/q/25788055
tags question: http://stackoverflow.com/q/25839263
tags question: http://stackoverflow.com/q/25838965
tags question: http://stackoverflow.com/q/25790224
type: Tag
tags question: http://stackoverflow.com/q/25723628

http://stackoverflow.com/q/25789822
accepted answer: http://stackoverflow.com/a/25789983
tagged with: timer
has title: How to cancel an already scheduled TimerTask?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25789983
tagged with: timertask
has answer: http://stackoverflow.com/a/25791638
has body: I have a tiny problem that I can't seem to do right. I have the following class in java: package pooledtcpconnector.utilities; import java.io.IOException; import java.io.InputStream; import java.util.Timer; import java.util.TimerTask; import java.util.logging.Level; import java.util.logging.Logger; public final class Notifier implements Runnable { private final ILogger logger; private Timer mTimer; private final int Treshold; private final InputStream ResponseStream; private final TimerTask DoWaitTask; public Notifier(final InputStream _ResponseStream, final Integer _Treshold, final ILogger logger) { this.logger = logger; mTimer = new Timer(); this.ResponseStream = _ResponseStream; this.Treshold = _Treshold; DoWaitTask = new TimerTask() { @Override public void run() { try { int mSize = ResponseStream.available(); if (mSize &gt;= Treshold) { mTimer.cancel(); } } catch (final IOException ex) { final String ExceptionMessage = ex.getMessage(); logger.LogMessage( this.getClass().getCanonicalName(), "Notifier.DoWaitTask:run.ResponseStream.available", ex.getClass().getCanonicalName(), new String[]{ ExceptionMessage, "Parameters:", String.format("-"), }); Logger.getLogger(Notifier.class.getCanonicalName()).log(Level.FINE, ex.getMessage(), ex.getCause()); } } }; } @Override public void run() { synchronized (this) { mTimer.scheduleAtFixedRate(DoWaitTask, 250, 200); // Notification mechanism notify(); } } } This class would ensure that our application won't start processing the SocketInputStream unless the available method returns at least Treshold. The problem however is that, once I schedule the DoWaitTask with the Timer it runs for eternity. By cancelling the timer the task still runs and the whole application hangs, but more importantly it tries to call available on the stream once it already has been processed and closed. Of course this results in a nice IOException: stream closed. How could I stop the scheduled task along with the timer? timer.cancel obviously isn't enou…
type: Question
possible better answer: http://stackoverflow.com/a/25791638
score: 0
answer count: 2

http://stackoverflow.com/comment/40289304
has text: I edited my post about using JavaFX on JRE 6. Note that you seem to still have another problem anyway, because version 52 is Java 8, not Java 7. I'm asking for the ant build script because I don't know what the script generated by Eclipse is supposed to look like to begin with (I don't use Eclipse), and also because the script should include some interseting information, like the path to the ant-javafx.jar used. Also, have you tried running the ant script with the -v option (verbose mode)? It should display more usefull information.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25755719
type: AnswerComment

http://stackoverflow.com/a/25785550
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25785373
has comment: http://stackoverflow.com/comment/40359485
has body: If you want to reset the data displayed in the table you must call TableViewer.setInput(xxx) again with the data you want to display.
type: Answer
has comment: http://stackoverflow.com/comment/40359742
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40331288
has comment: http://stackoverflow.com/comment/40334727
has comment: http://stackoverflow.com/comment/40332948
has comment: http://stackoverflow.com/comment/40332392
has comment: http://stackoverflow.com/comment/40330724
accepted answer of: http://stackoverflow.com/q/25785373

http://stackoverflow.com/a/25772816
has body: Yes, it continues to repeat itself without executing any other statements. It will test the conditions 101 &lt; 199, 102 &lt; 198, and so on, until it tests 150 &lt; 150. Then it breaks out of the loop and executes the println statements. Output: 150 150 Note that the only reason it's not an infinite loop is that the condition is itself changing the values with the ++ and -- operators.
has comment: http://stackoverflow.com/comment/119354358
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
score: 8
answers question: http://stackoverflow.com/q/25772774
accepted answer of: http://stackoverflow.com/q/25772774

http://stackoverflow.com/a/25818192
upvote count: 2
accepted answer of: http://stackoverflow.com/q/25817947
answers question: http://stackoverflow.com/q/25817947
has body: It looks like there are a few issues there. The ones I have noticed are that when you set your view you are reinflating the view, versus setting it to the view you have already set up when you do dialog.setView(inflater.inflate(R.layout.dig_lay, null)); you want to set that instead to dialog.setView(inflatedView); Also, since we can't see the actual data you are putting into the EditText, we can't see if that might be null, etc. Finally, I never see you run a scoreEdit.getText(), so you wouldn't be retrieving any changes the user made to the edittext.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/40388932
type: Answer
score: 2

http://stackoverflow.com/a/25849920
answers question: http://stackoverflow.com/q/25849818
score: 0
has comment: http://stackoverflow.com/comment/40446500
type: Answer
has comment: http://stackoverflow.com/comment/40446772
has comment: http://stackoverflow.com/comment/40446317
has body: You'll need to model the phone number in a String variable. Interpreting a telephone number as a number can lead to issues with, for instance, telephone numbers starting with 0, or managing country codes (+01). Plus, you'll get rid of the length issue.

http://stackoverflow.com/comment/40431357
type: Comment
comment on: http://stackoverflow.com/q/25840589
type: QuestionComment
has text: My (service-core.jar) jar is included in build path of Maven dependencies. How do I exclude it when importing in eclipse. Because in my other maven project the jar of other module is not included in maven dependencies build path.
score: 0

http://stackoverflow.com/comment/40199928
type: QuestionComment
has text: Hi my question is more one of understanding a concept since I know what anonymous inner classes are. I want to understand what type of object this anonymously inner class creates? Is it of the type of the interface?
comment on: http://stackoverflow.com/q/25715513
score: 0
type: Comment

http://stackoverflow.com/a/25799685
answers question: http://stackoverflow.com/q/25799611
score: 2
downvote count: 0
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40356325
has body: EhCache can indeed store items on disk. It's not in memory only. http://ehcache.org/documentation/configuration/fast-restart#temporary-disk-storage If you'd like it to be, you can set this setting and then the results of hits and in-memory hits will be the same. &lt;cache&gt; &lt;persistence strategy="none"/&gt; &lt;/cache&gt;

http://stackoverflow.com/comment/40367381
type: Comment
score: 1
has text: You can do this at runtime, but you need a instance of the Class. OR you write a plugin for your build-management-tool.
type: QuestionComment
comment on: http://stackoverflow.com/q/25806919

http://stackoverflow.com/comment/40217954
type: Comment
type: QuestionComment
has text: Also note that double is not precise --> `double a = 0.3 - 0.1` gives `0.19999999999999998`
comment on: http://stackoverflow.com/q/25725126
score: 0

http://stackoverflow.com/q/25791978
answer count: 2
has body: Am using JDK 7, SQLite, and have Guava in my project. I have a TreeMap with less than 100 entries that is being updated by a single "worker" thread hundreds of times a second. I am now writing a component (another thread - the "DB thread") that will write the map to my database every 5 or 10 seconds. I know that I need to make a deep copy of the map so the DB thread will use a snapshot, while the worker thread continues its job. I am looking at the Guava Maps class which has many methods that make copies, but I am not sure if any of them meet my needs to synchronize on the map whenever a copy is needed. Is there a method there that will meet my needs, or should I write a synchronized block to make my own deep copy?
score: 0
has comment: http://stackoverflow.com/comment/40340020
has answer: http://stackoverflow.com/a/25792259
has title: Thread safe way to copy a map
has comment: http://stackoverflow.com/comment/40340048
type: AnsweredQuestion
tagged with: guava
has comment: http://stackoverflow.com/comment/40350487
tagged with: java
possible better answer: http://stackoverflow.com/a/25792136
has comment: http://stackoverflow.com/comment/40347204
accepted answer: http://stackoverflow.com/a/25792259
has answer: http://stackoverflow.com/a/25792136
type: Question

http://stackoverflow.com/q/25776968
tagged with: servlets
type: Question
has body: I can't seem to understand how to integrate Swagger to generate API documentation. url: ####:8080/MyService/rest/users/getall I have added Annotations to code and dependency. I try to visit: ####:8080/MyService/rest/ but says its not found. //web.xml <servlet> mycompany-users-serlvet com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.config.property.packages com.users.services.mycompany,com.wordnik.swagger.jersey.listing ` <servlet> JerseyJaxrsConfig com.wordnik.swagger.jersey.config.JerseyJaxrsConfig api.version 1.0.0 swagger.api.basepath ####:8080/MyService/rest/ //not sure What this should be? 2 `
favorite count: 0
upvote count: 14
tagged with: rest
has answer: http://stackoverflow.com/a/35197631
answer count: 4
possible better answer: http://stackoverflow.com/a/40415747
has answer: http://stackoverflow.com/a/66453366
has title: How to integrate Swagger with Maven + Java + Jersey +Tomcat
downvote count: 0
has answer: http://stackoverflow.com/a/40415747
tagged with: maven
score: 14
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25787352
accepted answer: http://stackoverflow.com/a/25787352
tagged with: java
tagged with: swagger

http://stackoverflow.com/a/25720642
type: Answer
score: 0
has body: ^\+\d{2}[^\d]*(\d+)[^\d]*(\d+)[^\d]*(\d+)$ You can use this and then replace with 0$1$2$3 See demo. http://regex101.com/r/iX5xR2/12 This will work for all cases
answers question: http://stackoverflow.com/q/25720282

http://stackoverflow.com/comment/40215115
has text: Very interesting. Will give this a try tonight.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25722256
type: AnswerComment

http://stackoverflow.com/comment/40368251
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25807311
score: 0
has text: would it be possible to insert a new line on the bytecode... I am using dirtyJoe... it does not inserts new lines only edits existing.

http://stackoverflow.com/q/25835812
tagged with: java
has comment: http://stackoverflow.com/comment/40420867
type: Question
downvote count: 0
tagged with: logback
tagged with: embedded-jetty
has body: I would like to log my embedded jetty app with logback and define the log level into a logback.xml config file. Actually, I had a Spark Java server and all was right, but since I migrated to an embedded Jetty directly, my configuration is not taken into account anymore.
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has title: Logback in embedded Jetty 9
tagged with: logging
score: 2
has answer: http://stackoverflow.com/a/31704867
has comment: http://stackoverflow.com/comment/40420815

http://stackoverflow.com/comment/40292481
type: QuestionComment
comment on: http://stackoverflow.com/q/25757655
has text: Edited my question with how my data will be coming in.
score: 0
type: Comment

http://stackoverflow.com/a/25783360
has comment: http://stackoverflow.com/comment/40333100
accepted answer of: http://stackoverflow.com/q/25782051
type: AcceptedAnswer
score: 0
type: Answer
answers question: http://stackoverflow.com/q/25782051
has comment: http://stackoverflow.com/comment/40328774
has body: It is hard to answer that without more informations. Short story : it depends If the service needs expensive initialization for each new connection (example : a JDBC connection), you should keep a connection pool. If it is something as simple as a not connected web service, just open a connection for each call. Edit per comment : The way you describe your service, I think you can reasonably use a TCP connection for each call.

http://stackoverflow.com/q/25847621
score: 0
has answer: http://stackoverflow.com/a/25859381
tagged with: maven
tagged with: orientdb
type: AnsweredQuestion
tagged with: java
has title: OGraphDatabase ClassNotFoundException OrientDB 1.7.8
type: Question
has body: I have configured following pom.xml dependencies for OrientDB 1.7.8 in my project: <orientdb.version>1.7.8</orientdb.version> com.orientechnologies orient-commons ${orientdb.version} com.orientechnologies orientdb-core ${orientdb.version} com.orientechnologies orientdb-object ${orientdb.version} com.orientechnologies orientdb-client ${orientdb.version} com.orientechnologies orientdb-graphdb ${orientdb.version} everything works fine with OrientGraph class, but I have ClassNotFoundException with OGraphDatabase. How to add this class via OrientDB Maven dependencies ?
accepted answer: http://stackoverflow.com/a/25859381
answer count: 1

http://stackoverflow.com/a/25864589
downvote count: 1
answers question: http://stackoverflow.com/q/25864439
score: 0
type: Answer
has body: Source: Comma-separated values A comma-separated values (CSV) (also sometimes called character-separated values, because the separator character does not have to be a comma) file stores tabular data (numbers and text) in plain-text form. Plain text means that the file is a sequence of characters, with no data that has to be interpreted instead, as binary numbers. A CSV file consists of any number of records, separated by line breaks of some kind; each record consists of fields, separated by some other character or string, most commonly a literal comma or tab. Usually, all records have an identical sequence of fields. As the data consists of plain test records there is no concept of pages, so what you want to do is not possible.
upvote count: 1

http://stackoverflow.com/comment/40267662
comment on: http://stackoverflow.com/a/25751915
score: 0
type: AnswerComment
has text: @KickButtowski which seems to be exactly what OP wants "*I want the scanner to ignore everything inside ( * ....... * ).*"
type: Comment

http://stackoverflow.com/a/25806286
answers question: http://stackoverflow.com/q/25806157
has comment: http://stackoverflow.com/comment/40366825
upvote count: 1
has comment: http://stackoverflow.com/comment/40366288
has comment: http://stackoverflow.com/comment/40366369
has comment: http://stackoverflow.com/comment/40366915
has comment: http://stackoverflow.com/comment/40367943
downvote count: 0
score: 1
has body: You need to say tomcat where the Servlet is. Therefore, edit your WEB-INF/web.xml file and add: your-servlet your.package.servlet your-servlet /your_servlet Please note that the Servlet's class should be in the WEB-INF/classes/ folder, with the complete package structure. If you don't want to do this hardcoded, you can use Eclipse JavaEE to generate this file for you. Don't forgett to restart the server in both cases!
has comment: http://stackoverflow.com/comment/40366662
type: Answer

http://stackoverflow.com/comment/40391543
comment on: http://stackoverflow.com/a/25818451
has text: Check and see if you have installed google play services and see my updated answer
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/40469408
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25862537
has text: The point is in `This is useful in long-running conversations` where `persist` is preferable (inserting many many objects) over `save`.
score: 0

http://stackoverflow.com/q/25749128
favorite count: 0
has body: This program tells me which time a start date and an end, now I ask you whether you want to enter another period when you s (yes) adds the starting period, but this want to join with above, for example, I add the following: 16/08/1993 - 09/09/2014 = 21 years, 0 months, 24 days. 14/02/1995 - 18/05/2001 = 6 years, 3 months, 35 days Total:.................................27 years, 3 months y 59 days NOTE: I do not know if something is wrong and try everything. I am new to java. public void diferencia(){ char seguir=0; Scanner teclado =new Scanner(System.in); do{ System.out.println("day/Month/year "); System.out.println("Write the first date: "); String dayini = teclado.next(); System.out.println("write the second date: "); String dateactual = teclado.next(); String[] aFechaIng = dateini.split("/"); Integer dayini = Integer.parseInt(aFechaIng[0]); Integer monthini = Integer.parseInt(aFechaIng[1]); Integer yearini = Integer.parseInt(aFechaIng[2]); String[] aFecha = dateactual.split("/"); Integer dayactual= Integer.parseInt(aFecha[0]); Integer monthactual = Integer.parseInt(aFecha[1]); Integer yearactual = Integer.parseInt(aFecha[2]); int b = 0; int days = 0; //DAYS int month = 0; //MONTH int years = 0; //YEARS int months = 0; //MONTHS month = monthini - 1; // LEAP YEAR if(month==2){ if ((yearactual % 4 == 0) &amp;&amp; ((yearactual % 100 != 0) || (yearactual % 400 == 0))){ b = 29; }else{ b = 28; } }else if(month &lt;= 7){ if(month == 0){ b = 31; }else if(month % 2==0){ b = 30; }else{ b = 31; } }else if(month &gt; 7){ if(month % 2 == 0){ b = 31; }else{ b = 30; } } if((yearini &gt; yearactual) || (yearini == yearactual &amp;&amp; monthini &gt; monthactual) || (yearini == yearactual &amp;&amp; monthini == monthactual &amp;&amp; dayini &gt; dayactual)){ // errors System.out.println("The start date must be minor "); }else{ //time periods if(monthini &lt;= monthactual){ years = yearactual - yearini; if (dayini &lt;= dayactual){ mmonths = monthactual - monthini; days = b - (day…
answer count: 3
has answer: http://stackoverflow.com/a/25749742
has answer: http://stackoverflow.com/a/25755948
possible better answer: http://stackoverflow.com/a/25750700
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40262089
score: -5
accepted answer: http://stackoverflow.com/a/25749742
has answer: http://stackoverflow.com/a/25750700
tagged with: java
has comment: http://stackoverflow.com/comment/40274909
downvote count: 5
has title: Java: I can add as period to another period?
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/40262275
tagged with: between

http://stackoverflow.com/comment/40446016
type: QuestionComment
has text: You do realize that some phone numbers start with a 0 which cannot be reproduced using a numeric data format. You should use strings for phone numbers.
comment on: http://stackoverflow.com/q/25849818
score: 0
type: Comment

http://stackoverflow.com/a/31888036
has body: Your Code Works, As Of Java 8 Update 51 Your code is working now, as of Java 8 Update 51 on Mac OS X Mountain Lion. The Answer by Holger that there may have been a bug in earlier versions of Java. Understandable as the java.time framework is brand-new in Java 8. Here is a modified copy of your code. String dateStr = "2014-08-16T05:03:45-05:00"; TemporalAccessor creationAccessor = DateTimeFormatter.ISO_OFFSET_DATE_TIME.parse( dateStr ); Instant instant = Instant.from( creationAccessor ); long millisSinceEpoch = instant.toEpochMilli( ); ZonedDateTime zdt = ZonedDateTime.ofInstant( instant, ZoneOffset.of( "-05:00" ) ); Dump to console. System.out.println( "dateStr: " + dateStr ); System.out.println( "instant: " + instant ); System.out.println( " millis: " + millisSinceEpoch ); System.out.println( " zdt: " + zdt ); When run. dateStr: 2014-08-16T05:03:45-05:00 instant: 2014-08-16T10:03:45Z millis: 1408183425000 zdt: 2014-08-16T05:03:45-05:00 Canonical Method: parse(CharSequence text, TemporalQuery&lt;T&gt; query) You may want to accomplish your parsing using an alternate method. The class doc for DateTimeFormatter mentions that the usual way to parse should be a call to DateTimeFormatter::parse(CharSequence text, TemporalQuery&lt;T&gt; query) rather than DateTimeFormatter::parse(CharSequence text). So instead of this: String input = "2007-12-03T10:15:30+01:00[Europe/Paris]" ; TemporalAccessor temporalAccessor = DateTimeFormatter.ISO_DATE_TIME.parse( input ) ; …do this, where we add a second argument, the argument being a method reference in Java 8 syntax, to call the conversion from method (in this example, ZonedDateTime :: from): String input = "2007-12-03T10:15:30+01:00[Europe/Paris]" ; ZonedDateTime zdt = DateTimeFormatter.ISO_DATE_TIME.parse( input , ZonedDateTime :: from ) ; Dump to console. System.out.println("input: " + input ); System.out.println(" zdt: " + zdt ); When run. input: 2007-12-03T10:15:30+01:00[Europe/Paris] zdt: 2007-12-03T10:15:30+01:00[Europe/Paris…
upvote count: 11
score: 11
answers question: http://stackoverflow.com/q/25735583
downvote count: 0
type: Answer

http://stackoverflow.com/comment/40277152
score: 0
has text: Hi jon, so the reason i mentioned as novice. I know that interfaces are like blueprints of a class and just holds member declarations, where classes which implements this interface provides definitions. I didnt see any instances created for Interfaces. So asking this query.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25757034

http://stackoverflow.com/a/30941021
upvote count: 17
has body: Another, option to add a second authentication provider: Simply specify another one on the AuthenticationManagerBuilder. Because the @EnableWebSecurity annotation is itself annotated with EnableGlobalAuthentication you can configure the global instance of AuthenticationManagerBuilder. (See the javadocs for more details.) For example, here we have an LDAP authentication provider as well as an in memory (hard-coded) authentication provider (this is something we do in development to have local users to test with): @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Value("${user.role}") private String userRole; // i.e. ROLE_APP_USER @Value("${include.test.users}") private boolean includeTestUsers; @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/**/js/**").permitAll() .antMatchers("/**/images/**").permitAll() .antMatchers("/**/favicon.ico").permitAll() .antMatchers("/**/css/**").permitAll() .antMatchers("/**/fonts/**").permitAll() .antMatchers("/**").hasAnyRole(userRole) .and().formLogin().loginPage("/login").permitAll().and().logout().permitAll(); http.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout")); } @Autowired public void configureGlobal(AuthenticationManagerBuilder auth, LdapContextSource contextSource) throws Exception { auth.ldapAuthentication() .userSearchBase("OU=Users OU") .userSearchFilter("sAMAccountName={0}") .groupSearchBase("OU=Groups OU") .groupSearchFilter("member={0}") .contextSource(contextSource); if (includeTestUsers) { auth.inMemoryAuthentication().withUser("user").password("u").authorities(userRole); } } }
answers question: http://stackoverflow.com/q/25794680
has comment: http://stackoverflow.com/comment/112206123
downvote count: 0
type: Answer
score: 17
has comment: http://stackoverflow.com/comment/65693346

http://stackoverflow.com/comment/40292209
type: Comment
type: QuestionComment
has text: If you are using Linux, there are many interesting ideas in http://stackoverflow.com/questions/9072879/how-to-use-linux-software-watchdog
comment on: http://stackoverflow.com/q/25765028
score: 0

http://stackoverflow.com/q/25839843
tagged with: metadata
upvote count: 3
accepted answer: http://stackoverflow.com/a/25839882
downvote count: 1
has comment: http://stackoverflow.com/comment/40428421
has answer: http://stackoverflow.com/a/25839891
score: 2
type: AnsweredQuestion
has title: can 'this' pointer be null in c++ class?
possible better answer: http://stackoverflow.com/a/25839889
tagged with: java
has answer: http://stackoverflow.com/a/25839889
type: Question
has comment: http://stackoverflow.com/comment/40428496
has body: There is a c++ code shown below: class Metadata : public MetaspaceObj { void print_value_on_maybe_null(outputStream* st) const { if (this == NULL) st-&gt;print("NULL"); else print_value_on(tty); } } I just wonder how could 'this' be NULL in a C++ object.Could be there a possibility? The code above is excerpted from jdk8/openjdk/hotspot/src/share/vm/oops/metadata.hpp.
tagged with: null
has comment: http://stackoverflow.com/comment/40429159
has comment: http://stackoverflow.com/comment/40428507
favorite count: 0
has comment: http://stackoverflow.com/comment/40428403
answer count: 3
has comment: http://stackoverflow.com/comment/40428419
tagged with: jvm
has answer: http://stackoverflow.com/a/25839882
tagged with: c++
has comment: http://stackoverflow.com/comment/40428569

http://stackoverflow.com/q/25713404
has answer: http://stackoverflow.com/a/25713517
upvote count: 1
has answer: http://stackoverflow.com/a/25713456
tagged with: tree
type: AnsweredQuestion
tagged with: algorithm
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/25713499
type: Question
accepted answer: http://stackoverflow.com/a/25713517
downvote count: 0
favorite count: 0
tagged with: binary-tree
possible better answer: http://stackoverflow.com/a/25713510
has answer: http://stackoverflow.com/a/25713510
answer count: 4
has body: int count(Node node) { if (node == null) return 0; int r = count (node.right); int l = count (node.left); return 1 + r + l; } This function returns number of nodes in Binary Tree rooted at node. A few articles say this is a pre-order traversal, but to me this looks like a post-order traversal, because we are visiting the left and the right parts before we visit the root. Am I wrong here ? Or is my notion of "visited" at fault ?
has title: How is this program a pre-order traversal?

http://stackoverflow.com/q/25844095
has answer: http://stackoverflow.com/a/28041604
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40436795
favorite count: 0
type: UnansweredQuestion
tagged with: garbage-collection
has body: I am investigating performance problems on an EE application which are probably a result of a less than optimally tuned garbage collector. While looking into jstat logs I gathered under heavy load I stumbled upon the following finding: S0 S1 E O P 7.39 0.00 41.81 88.89 53.93 NGCMN NGCMX NGC S0C S1C 131072.0 301056.0 301056.0 30080.0 30080.0 EC OGCMN OGCMX OGC 240896.0 1441792.0 2058240.0 2058240.0 As per the official jstat documentation here we can see that the current old generation size (OGC) has reached the maximum old generation size (OGCMX). The first line however tells us that "Old space utilization as a percentage of the space's current capacity" (O) is "only" at 88%. My questions are: What mechanic is setting the old generation limit seeen as OGCMX in the jstat output? What is keeping old space from growing and using up the remaning ~12% of heap? We have JVM parameters which are setting the min/max for total heap, new space and perm space (-Xms -Xmx -XX:NewSize -XX:MaxNewSize -XX:PermSize -XX:MaxPermSize). But there are no limits set on old space (I don't know if such parameters even exist). Edit concerning NewRatio: It is my understadning and also mentioned here that the JVM does not enforce the ratio between new and old space, especially not if the MaxNewSize param is used. And the MaxNewSize param is accepted, as the value above (301056.0KB) is in fact exactly the 294MB we are specifying for MaxNewSize. Furthermore, the default value for NewRatio is 2 (see here), which is not at all the ratio between any of the above values listed by jstat.
has comment: http://stackoverflow.com/comment/40436072
has comment: http://stackoverflow.com/comment/40435957
score: 3
upvote count: 3
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/15428227
has comment: http://stackoverflow.com/comment/40436408
has title: Java heap: What is limiting maximum old generation capacity?
tagged with: jstat

http://stackoverflow.com/comment/40326082
score: 0
type: Comment
has text: Thanks @peter, Your answer does answers alot of my questions.
comment on: http://stackoverflow.com/a/25746479
type: AnswerComment

http://stackoverflow.com/q/25811797
score: 0
has body: I am trying get some files from website. And I want to do this but I don't know filename. HttpClient httpclient = new DefaultHttpClient(); HttpGet httpget = new HttpGet("http://www.examplewebsite.com/Directory1/Directory2/Text.txt"); HttpResponse response = null; response = httpclient.execute(httpget); HttpEntity entity = response.getEntity(); if (entity != null) { long len = entity.getContentLength(); inputStream = entity.getContent(); // write the file to whether you want it. } String filePath = "Text.txt"; FileOutputStream fos = new FileOutputStream(new File(filePath)); int inByte; while((inByte = inputStream.read()) != -1) fos.write(inByte); inputStream.close(); fos.close(); how can be automatically this way? By the way I don't want to get in ftp server and list items and add www.exampleserver.com/Directory1/Directory2/ here.Maybe if i cant find another way, i ll use that but i dont want to write ftp 's username and password for the security.
has comment: http://stackoverflow.com/comment/40378768
has comment: http://stackoverflow.com/comment/40383790
type: UnansweredQuestion
tagged with: android
answer count: 0
tagged with: java
tagged with: http
has title: how to list files in httpdocs?
type: Question
has comment: http://stackoverflow.com/comment/40377324
has comment: http://stackoverflow.com/comment/40377379

http://stackoverflow.com/comment/42095090
has text: For me installing Eclipse Mars fixed it for me. I don't think it was anything to do with the 32 or 64bits since my Activity Monitor (yes I'm on OSX) didn't say x32 against Eclipse. +1 for @greg-449 however.
comment on: http://stackoverflow.com/q/25753966
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25802691
has title: Pie chart using google chart
tagged with: jsp
tagged with: javascript
score: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has comment: http://stackoverflow.com/comment/40360441
has body: I am trying to run this javascript code which retrive data from the database and a string is created this string is passed to the draw method which creates a pie chart but it is not displaying any thing please help.... <%@page import="java.io.File"%> <%@page import="java.sql.PreparedStatement"%> <%@page import="java.sql.Statement"%> <%@page import="java.sql.ResultSet"%> <%@page import="java.sql.Connection"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="Persistence.FolderBroker"%> <%@page import="java.util.*"%> <% FolderBroker fb = new FolderBroker(); Connection conn = fb.insert(); ResultSet rs, rs1; String s = ""; Statement st = conn.createStatement(); PreparedStatement query = conn .prepareStatement("select sum(frequency) from tokendetails;"); rs = query.executeQuery(); rs.next(); int count = rs.getInt(1); String sql = "select filename, sum(frequency) as freq from tokendetails group by filename;"; rs1 = st.executeQuery(sql); while (rs1.next()) { String file = rs1.getString(1); File f = new File(file); String files = f.getName(); double freq = ((rs1.getInt(2)) * 100 / count); s = s + "['" + files + "', " + freq + "]"; } String str = "[" + s + "]"; System.out.println(str); %> JSP Page
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25802846
tagged with: java
type: Question

http://stackoverflow.com/comment/40299288
type: Comment
score: 0
comment on: http://stackoverflow.com/a/25757053
type: AnswerComment
has text: It looks like this info might help, as it certainly seems more directed toward what I am trying to achieve. I will see what I can make of this next time I have a chance to sit down and work on my program. Thanks!

http://stackoverflow.com/a/25811571
upvote count: 3
has comment: http://stackoverflow.com/comment/40377770
accepted answer of: http://stackoverflow.com/q/25794801
answers question: http://stackoverflow.com/q/25794801
type: AcceptedAnswer
downvote count: 0
has body: There is nothing in the API to provide such a hint, the NumberAxis class just tries to select a standard tick size that shows the largest number of tick marks without any of the labels overlapping. You could modify that behaviour by overriding the selectAutoTickUnit() method in the NumberAxis class. If you don't want to modify the code, you could encourage less ticks to be displayed by increasing the insets for the tick labels with the setTickLabelInsets(RectangleInsets insets) method.
type: Answer
score: 3

http://stackoverflow.com/comment/40360220
score: 0
type: Comment
type: QuestionComment
has text: @morgano Hint: Any android phone won't have a problem with 50 elements^^ Even a microprocessor should be able to handle this.
comment on: http://stackoverflow.com/q/25802052

http://stackoverflow.com/q/25757918
tagged with: java
has body: this code is double while loop ! but not double... only one loop > The end.. plz help me.. i want a double loop for while.. do not double loop for hasNext()? ---------------------------edit-------------- I'm sorry. I've made ​​a mistake Clumsy English. "Do not make a double loop (While) as HasNext ()?" What I'm asking. Sorry, I did not polite. Put the "While" he "HasNext ()" not been able to repeat the first loop. I'd like to create like multiplication like. Please help me. import java.io.IOException; import java.net.MalformedURLException; import org.geotools.data.shapefile.files.ShpFiles; import org.geotools.data.shapefile.shp.ShapefileException; import org.geotools.data.shapefile.shp.ShapefileReader; import org.geotools.data.shapefile.shp.ShapefileReader.Record; import com.vividsolutions.jts.geom.Geometry; import com.vividsolutions.jts.geom.GeometryFactory; class Point { double x; double y; Point(double x2, double y2) { this.x = x2; this.y = y2; } static double distance(Point p1, Point p2) { double dist; dist = Math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y)); return dist; } } public class KFunction { private static double X; private static double Y; private static double X1; private static double Y1; public static void main(String[] args) { ShapefileReader r = null; ShapefileReader r2 = null; try { ShpFiles shpFile = new ShpFiles("Juvenile_Offenders_in_Cardiff.shp"); ShpFiles shpFile2 = new ShpFiles("Juvenile_Offenders_in_Cardiff.shp"); GeometryFactory geometryFactory = new GeometryFactory(); r = new ShapefileReader(shpFile, true, false, geometryFactory); r2 = new ShapefileReader(shpFile2, true, false, geometryFactory); Record record2 = r2.nextRecord(); Geometry shape2 = (Geometry) record2.shape(); com.vividsolutions.jts.geom.Point centroid2 = shape2.getCentroid(); int i = 0; boolean A = r2.hasNext(); while (A) { X = centroid2.getX(); Y = centroid2.getY(); while (r.hasNext()) { System.out.println("No." + i); Record record = r.nextRecord();…
type: UnansweredQuestion
score: -3
tagged with: distance
upvote count: 0
has answer: http://stackoverflow.com/a/25758005
favorite count: 0
tagged with: while-loop
type: Question
has comment: http://stackoverflow.com/comment/40278463
downvote count: 3
has comment: http://stackoverflow.com/comment/40278493
has comment: http://stackoverflow.com/comment/40278523
has comment: http://stackoverflow.com/comment/40278603
answer count: 1
has title: Do not make a double loop (While) as HasNext ()?

http://stackoverflow.com/comment/40326452
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/25784417
has text: Related: http://stackoverflow.com/questions/19998454/interface-with-default-methods-vs-abstract-class-in-java-8 and http://stackoverflow.com/questions/20139404/java-8-default-methods-vs-non-abstract-methods-in-abstract-classes
type: Comment

http://stackoverflow.com/comment/40257049
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25746204
has text: @UweB Come on! get with it!

http://stackoverflow.com/q/25721443
tagged with: android-videoview
type: Question
tagged with: android-layout
answer count: 1
linked to: http://stackoverflow.com/q/22637413
tagged with: scrollview
type: UnansweredQuestion
score: 0
tagged with: android
has body: I am Using VideoView in my code for playing some video from an URL. My VideoView is inside a Linear Layout which inside a ScrollView. I have Problem with MediaController Object Which appear in bottom of Video view over other View which located inside scrollView and constant location in screen (I mean when Scrolled down screen all view move except this) I want Set this MediaController in constant Location below videoView which move with scroller. My XML Code is Here: &lt;ScrollView android:id="@+id/scrollView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginLeft="94dp" android:layout_marginTop="196dp" &gt; &lt;LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;AbsoluteLayout android:id="@+id/nonVideoLayout" android:layout_width="match_parent" android:layout_height="match_parent" &gt; &lt;LinearLayout android:id="@+id/playerLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"&gt; &lt;com.HRDatis.component.VideoViewQmery android:id="@+id/playerImage" android:layout_width="match_parent" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; And JAVA code here : ((LinearLayout)(findViewById(R.id.playerLayout))).setLayoutParams(new LayoutParams((int)(width) , (int)(height*0.371) ,0 , (int)(height*(0.0)) )); VideoViewQmery videoView =((VideoViewQmery)(findViewById(R.id.playerImage))); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); videoView.setVideoURI(Uri.parse(URI)); videoView.setMediaController(mediaController); Note that,All of Dimension set in java in activity in onCreate function.Also,I used setLayoutparam function for mediaController but it didn't work and mediaController didnt move. Only SetY and SetX works.This function move MediaController related…
has answer: http://stackoverflow.com/a/25748996
has title: Video View Media Controller Android
tagged with: java

http://stackoverflow.com/q/25830480
tagged with: imageicon
has body: I want to change the icon used by imageicon in this code to another one by clicking in that imageicon. Can anybody help me please? what can i do in this code?? and i want it to also make fall down if the bottom is filled with white color.If one user click at the white point the color changes to yellow then after, if again click on another white one the color changes to red. import java.awt.Color; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; class Connect4Games extends JFrame implements ActionListener, MouseListener { JFrame frame; JPanel pane; JLabel insertaxis[][]; ImageIcon EmptySpace, circleYellow, circleRed ; BufferedImage bufferedImage; public Connect4Games() { LookAndFeel.setLookAndFeel(); pane = new JPanel(); frame = new JFrame(); insertaxis = new JLabel[6][7]; EmptySpace = new ImageIcon("image/Circle.png"); circleYellow = new ImageIcon("image/Circle2.png"); circleRed = new ImageIcon("image/Circle3.png"); pane.setLayout(new GridLayout(6, 7)); pane.setBackground(Color.blue); add(pane); addMouseListener(this); setTitle("Connect 4"); setVisible(true); setSize(670, 590); frame.pack(); setLocationRelativeTo(null); setResizable(false); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); for (int i = 0; i &lt; 6; i++) { for (int j = 0; j &lt; 7; j++) { insertaxis[i][j] = new JLabel(); pane.add(insertaxis[i][j]); insertaxis[i][j].setIcon(EmptySpace); } } } @Override public void actionPerformed(ActionEvent e) { } public static void main(String[] args) { new Connect4Games(); } @Override public void mouseClicked(MouseEvent e) { int x = e.getX(); int y = e.getY(); if(e.getPoint() == null){ insertaxis[x][y].setIcon(circleRed); } } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method …
has title: How can i change an image to another image by clicking in it in java
type: UnansweredQuestion
downvote count: 2
tagged with: swing
has answer: http://stackoverflow.com/a/25833327
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/40411542
tagged with: image
type: Question
upvote count: 0
answer count: 1
tagged with: awt
favorite count: 0
has comment: http://stackoverflow.com/comment/40410981

http://stackoverflow.com/comment/40213969
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/25722611
has text: I want to know whether there is difference between byte and binary

http://stackoverflow.com/a/25801816
type: Answer
has body: If it is not explicitly required that you need to calculate the length using a scanner object, using length() will return the number of characters in any string. ** Using scanner.nextLine().length() is actually returning a string at the first method call, and then returning the length at the second method call anyway.
score: 0
answers question: http://stackoverflow.com/q/25801513

http://stackoverflow.com/a/25773344
type: Answer
has comment: http://stackoverflow.com/comment/40318263
answers question: http://stackoverflow.com/q/25773239
upvote count: 1
has comment: http://stackoverflow.com/comment/40306743
has body: import for LaxRedirectStrategy class import org.apache.http.impl.client.LaxRedirectStrategy import the class BasicCookieStore and org.apache.http.client.CookieStore import org.apache.http.impl.client.BasicCookieStore import org.apache.http.client.CookieStore remove import java.net.CookieStore;
has comment: http://stackoverflow.com/comment/40318126
score: 1
has comment: http://stackoverflow.com/comment/40308041
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25773239

http://stackoverflow.com/a/25823526
upvote count: 1
has comment: http://stackoverflow.com/comment/40398874
has body: Problem: the GroupLayout layout manager, which I believe NetBeans code generation uses as its default layout, is rather rigid and doesn't easily accept addition of new components at runtime. Solution: don't have your receiving container use GroupLayout but rather have it use one of the more flexible layouts that allow addition of other components such as GridLayout or BoxLayout. Note that you can tell NetBeans GUI builder that this the layout that you want one of your containers to use. As an aside, I wonder if what you really want to do is to add a row to a JTable. Edit regarding your comment: i didn't want to use JTable, it's like a formular (i wanted to add an image of it but they didn't let me) but how do i tell netbeans that i want to use GridLayout or BoxLayout rather than GroupLayout? I don't use NetBeans or code generation, but if you add a JPanel to your GUI, one that is needed to hold your additional components, I am sure that if you right-click that JPanel, you'll have ability to change its properties including that of its layout manager. There are also other ways that NetBeans allows you to change the properties of the components it is creating, and so you will want to look into that.
type: Answer
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/25823511
has comment: http://stackoverflow.com/comment/40398491
has comment: http://stackoverflow.com/comment/40398807
has comment: http://stackoverflow.com/comment/40398277

google-gdk
tags question: http://stackoverflow.com/q/25763731
tags question: http://stackoverflow.com/q/25789059
tag name: google-gdk
type: Tag

http://stackoverflow.com/comment/40391442
score: 4
type: QuestionComment
type: Comment
has text: Must be Little Bobby Tables mom's email address.
comment on: http://stackoverflow.com/q/25819554

http://stackoverflow.com/q/25718059
has answer: http://stackoverflow.com/a/25718144
has comment: http://stackoverflow.com/comment/40204472
tagged with: java
linked to: http://stackoverflow.com/q/816142
answer count: 2
downvote count: 0
tagged with: string
favorite count: 0
has answer: http://stackoverflow.com/a/25718078
tagged with: utf-8
upvote count: 3
has body: I have a String, which is then converted into an JSON-object: public static final String JSON_STRING = "json string"; JSONObject jsonObject = new JSONObject(JSON_STRING); But sometimes when the String is too long, I get the error: UTF8 representation for string * is too long for the constant pool Are there other ways to get a such long string?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40210138
has title: UTF8 representation for string * is too long for the constant pool
type: Question
score: 3

buildpath
type: Tag
tags question: http://stackoverflow.com/q/25830342
tags question: http://stackoverflow.com/q/25776439
tag name: buildpath

http://stackoverflow.com/q/25743574
has answer: http://stackoverflow.com/a/25743760
type: Question
has comment: http://stackoverflow.com/comment/40252395
has comment: http://stackoverflow.com/comment/40252315
has title: Java: best practice for declaring unchecked exception
downvote count: 0
linked to: http://stackoverflow.com/q/4609870
score: 8
favorite count: 0
has answer: http://stackoverflow.com/a/25743634
linked to: http://stackoverflow.com/q/24554057
upvote count: 8
tagged with: exception
answer count: 5
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25743751
has answer: http://stackoverflow.com/a/25743740
has body: Let's say you have some method declaring throwing an unchecked exception EDIT: let's say it's not you who designed this method, but authors of a very respectable framework (Spring, aekhm!), you're just calling it void someMethod() throws UncheckedException; My first question is: Is there any reason other than clarity for declaring that unchecked exception in the throws clause? Let's say you have another method that's calling someMethod void someOtherMethod() { someMethod() } My second question is: What would be the best practice of deciding whether to declare throwing the UncheckedException in the someOtherMethod? Just a little background: Spring framework's exception are based on unchecked exceptions. So for example some methods are throwing (and declaring it in the throws ) DataAccessException. If my code is using these calls, should it or should it not declare throwing these exceptions? And why?
tagged with: java
has answer: http://stackoverflow.com/a/25743721

http://stackoverflow.com/comment/40321684
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25781652
has text: Date expects a number of milliseconds, not seconds, since the epoch.

jakarta-ee
tags question: http://stackoverflow.com/q/25868944
tags question: http://stackoverflow.com/q/25795541
tags question: http://stackoverflow.com/q/25867187
tags question: http://stackoverflow.com/q/25796111
tags question: http://stackoverflow.com/q/25807221
tags question: http://stackoverflow.com/q/25781371
tags question: http://stackoverflow.com/q/25726545
tags question: http://stackoverflow.com/q/25737913
tags question: http://stackoverflow.com/q/25854318
tags question: http://stackoverflow.com/q/25800828
tags question: http://stackoverflow.com/q/25799671
type: Tag
tags question: http://stackoverflow.com/q/25827848
tags question: http://stackoverflow.com/q/25766021
tags question: http://stackoverflow.com/q/25780349
tags question: http://stackoverflow.com/q/25714201
tags question: http://stackoverflow.com/q/25819063
tags question: http://stackoverflow.com/q/25816350
tags question: http://stackoverflow.com/q/25824701
tags question: http://stackoverflow.com/q/25821268
tags question: http://stackoverflow.com/q/25795512
tags question: http://stackoverflow.com/q/25758332
tags question: http://stackoverflow.com/q/25805452
tags question: http://stackoverflow.com/q/25794520
tags question: http://stackoverflow.com/q/25760025
tags question: http://stackoverflow.com/q/25803917
tags question: http://stackoverflow.com/q/25736878
tags question: http://stackoverflow.com/q/25785997
tags question: http://stackoverflow.com/q/25785303
tags question: http://stackoverflow.com/q/25844535
tags question: http://stackoverflow.com/q/25815319
tags question: http://stackoverflow.com/q/25724545
tags question: http://stackoverflow.com/q/25831221
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/25861804
tags question: http://stackoverflow.com/q/25839007
tags question: http://stackoverflow.com/q/25816205
tags question: http://stackoverflow.com/q/25840315
tags question: http://stackoverflow.com/q/25822465
tags question: http://stackoverflow.com/q/25856580
tags question: http://stackoverflow.com/q/25736419
tags question: http://stackoverflow.com/q/25812482
tags question: http://stackoverflow.com/q/25847257
tags question: http://stackoverflow.com/q/25752171
tags question: http://stackoverflow.com/q/25828542
tags question: http://stackoverflow.com/q/25853102
tags question: http://stackoverflow.com/q/25798596
tags question: http://stackoverflow.com/q/25723693
tags question: http://stackoverflow.com/q/25836010
tags question: http://stackoverflow.com/q/25843805
tags question: http://stackoverflow.com/q/25782699
tags question: http://stackoverflow.com/q/25764351
tags question: http://stackoverflow.com/q/25772640
tags question: http://stackoverflow.com/q/25862150
tags question: http://stackoverflow.com/q/25760361
tags question: http://stackoverflow.com/q/25867608
tags question: http://stackoverflow.com/q/25784705
tags question: http://stackoverflow.com/q/25751287
tags question: http://stackoverflow.com/q/25825075
tags question: http://stackoverflow.com/q/25839345
tags question: http://stackoverflow.com/q/25786740
tags question: http://stackoverflow.com/q/25833022
tags question: http://stackoverflow.com/q/25853512
tags question: http://stackoverflow.com/q/25802755
tags question: http://stackoverflow.com/q/25848072
tags question: http://stackoverflow.com/q/25740832
tags question: http://stackoverflow.com/q/25840940
tags question: http://stackoverflow.com/q/25782961

jdialog
type: Tag
tags question: http://stackoverflow.com/q/25856531
tags question: http://stackoverflow.com/q/25816146
tags question: http://stackoverflow.com/q/25780251
tag name: jdialog
tags question: http://stackoverflow.com/q/25786904

http://stackoverflow.com/comment/40411964
type: Comment
score: 0
has text: I suggest that you at least describe your hadoop configurations setup. Like what version of Hadoop you are using per example.
type: QuestionComment
comment on: http://stackoverflow.com/q/25827950

http://stackoverflow.com/a/25791570
upvote count: 9
has comment: http://stackoverflow.com/comment/40350898
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/62791069
answers question: http://stackoverflow.com/q/25787127
accepted answer of: http://stackoverflow.com/q/25787127
type: Answer
has body: Although the error message is pretty clear about what is happening (the compiler thinks the final variable "panel" is being called before it is instantiated), the variable will not be called until the button generates an action, and how we can´t say when the action will happen, the code should compile. You should consider the fact that compilers follow formal rules and don’t have your knowledge. Especially, a compiler can’t know that the method addActionListener does not invoke the actionPerformed method immediately. It also has no idea about the visibility of the button which determines when actionPerformed might be called. The formal behavior has a specification. There you find the following points: Chapter 16. Definite Assignment Each local variable (§14.4) and every blank final field (§4.12.4, §8.3.1.2) must have a definitely assigned value when any access of its value occurs. An access to its value consists of the simple name of the variable (or, for a field, the simple name of the field qualified by this) occurring anywhere in an expression except as the left-hand operand of the simple assignment operator = (§15.26.1). and 15.27.2. Lambda Body … Unlike code appearing in anonymous class declarations, the meaning of names and the this and super keywords appearing in a lambda body, along with the accessibility of referenced declarations, are the same as in the surrounding context (except that lambda parameters introduce new names). In your code, the meaning of names within the lambda body, read of panel, is the same as in the surrounding context which is the constructor. In that context, the rule that “every blank final field must have a definitely assigned value when any access of its value occurs” applies. And, yes, that’s different from inner class definitions. The specification explicitly states that.
has comment: http://stackoverflow.com/comment/40363920
score: 9
has comment: http://stackoverflow.com/comment/40364442

http://stackoverflow.com/comment/40262173
type: Comment
score: 0
has text: What do you intend to do with this `List`?
comment on: http://stackoverflow.com/q/25749161
type: QuestionComment

http://stackoverflow.com/q/25747298
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/40258728
upvote count: 2
has title: Using try with resources in Java
has answer: http://stackoverflow.com/a/25747352
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has body: WhenI use try with resources in a program written in Java 8, documentation, is it still necessary or a good practice to close files explicitly?
accepted answer: http://stackoverflow.com/a/25747352

http://stackoverflow.com/comment/40271644
score: 3
has text: 123 is not the answer.
comment on: http://stackoverflow.com/q/25753914
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25863850
has comment: http://stackoverflow.com/comment/40479029
has comment: http://stackoverflow.com/comment/40474414
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40473647
type: Question
has body: I use postgres 9.3 as DB, Spring 4.0.6 and the postgresql-9.3-1101-jdbc41.jar driver. I have the code to store a File into DB with the LargeObjectManager. I have also the code to retrieve the data with the LargeObjectManager. This works fine. Now I need to copy the file. My theory is I can reuse the two pieces of code over there to retrieve first the old File, and then rewrite it with a new oid. But my question is: already exists a such function on the drivers? I have seen That there are also a CopyManager, but I'm not really sure if I can use it for largeObject. Has anyone a better suggestion that mine to copy a largeObject?
has comment: http://stackoverflow.com/comment/40472894
downvote count: 0
has comment: http://stackoverflow.com/comment/40479366
favorite count: 0
tagged with: postgresql
has title: How copy a file stored as largeobject in postgres?
has comment: http://stackoverflow.com/comment/40479277
has comment: http://stackoverflow.com/comment/40474387
answer count: 0
has comment: http://stackoverflow.com/comment/40478921
type: UnansweredQuestion
upvote count: 1
tagged with: postgresql-9.3

http://stackoverflow.com/comment/40457551
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25838063
has text: It turns out that jsch can also take it in Bytes. Any sample code that would be handy to convert the file to Byte. Will try various examples on Google, but figured I'd ask and save hours of time searching.

http://stackoverflow.com/comment/40489444
score: 0
type: AnswerComment
has text: http://ootips.org/uml-hasa.html holds good definitions for association, aggregation and composition. It is slightly different to what has been said here. Association means that there is a reference, aggregation that there is no reference cycles and as you have already said composition is about ownership/life cycle of the objects.
type: Comment
comment on: http://stackoverflow.com/a/25873098

http://stackoverflow.com/comment/40279815
has text: Might not be possible http://stackoverflow.com/questions/8046725/get-mac-address-of-remote-pc
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25758591

http://stackoverflow.com/comment/40444314
score: 0
comment on: http://stackoverflow.com/q/25802432
type: Comment
type: QuestionComment
has text: Did you try the suggestion?

http://stackoverflow.com/comment/40224514
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/25728957
type: Comment
has text: The layout information such as size won't be available yet

http://stackoverflow.com/q/25851894
possible better answer: http://stackoverflow.com/a/36152295
favorite count: 0
answer count: 5
has answer: http://stackoverflow.com/a/25852136
accepted answer: http://stackoverflow.com/a/25852136
upvote count: 15
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/40450529
has body: When to use: Container c = getContentPane(); And when to use: frame.getContentPane();
tagged with: java
has answer: http://stackoverflow.com/a/36152295
score: 13
tagged with: swing
has answer: http://stackoverflow.com/a/25851940
type: Question
has title: What does getContentPane() do exactly?
has comment: http://stackoverflow.com/comment/40450148
has answer: http://stackoverflow.com/a/25852358
has comment: http://stackoverflow.com/comment/40449798
has answer: http://stackoverflow.com/a/32905131
downvote count: 2
tagged with: user-interface

http://stackoverflow.com/comment/40327610
comment on: http://stackoverflow.com/q/25784833
type: QuestionComment
type: Comment
has text: `NULL` is not the same as "blank".
score: 0

http://stackoverflow.com/comment/40480657
has text: Which Java version are you using?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/25868856
type: Comment

http://stackoverflow.com/comment/40352703
score: 0
type: QuestionComment
has text: I would use regex and `replaceAll` method, but I am not sure if you are interested in such solution.
type: Comment
comment on: http://stackoverflow.com/q/25798422

http://stackoverflow.com/comment/40475578
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25866078
score: 0
has text: It is a text file, not a file full of floats in binary format. You're using the wrong tools for the job.

http://stackoverflow.com/comment/40216808
has text: I can't run my code on the remote side only use standard configuration
type: AnswerComment
comment on: http://stackoverflow.com/a/25724809
type: Comment
score: 0

http://stackoverflow.com/a/60217379
type: Answer
upvote count: 15
has body: Since Java 11 you can use a single command java example.java https://openjdk.java.net/jeps/330 Linked: How to compile and run in single command in java
score: 15
answers question: http://stackoverflow.com/q/25825864
downvote count: 0

http://stackoverflow.com/comment/62700899
type: AnswerComment
has text: @EugeneBeresovsky you're right, if one is able to use Java 8 (which wasn't widely spread when I posted the answer) - and even today not everyone is able to use Java 8.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25760725

log4j2
tags question: http://stackoverflow.com/q/25845120
tags question: http://stackoverflow.com/q/25807327
tags question: http://stackoverflow.com/q/25847508
tags question: http://stackoverflow.com/q/25822665
tags question: http://stackoverflow.com/q/25858528
tag name: log4j2
tags question: http://stackoverflow.com/q/25754933
type: Tag
tags question: http://stackoverflow.com/q/25871130

http://stackoverflow.com/q/25844560
score: 0
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/40436823
has body: I'm trying to make facebook for "someone" else opens on application, not on a browser, for example National Geography https://www.facebook.com/natgeo Here is the code I have: ddc.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/natgeo")); startActivity(browserIntent); } }); I found one on stackoverflow and I tried it and it has errors, here is the code: try { //try to open page in facebook native app. String uri = "fb://page/" + natgeo; //Custom URL Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(intent); } catch (ActivityNotFoundException ex){ //facebook native app isn't available, use browser. String uri = "https://www.facebook.com/natgeo" + natgeo; //Normal URL Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uriMobile)); startActivity(i); } the thing is I want, if someone didn't have facebook App, it will open in the browser. Edited package fa; import com.f.fa.R; import android.app.Activity; import android.content.ActivityNotFoundException; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.widget.Button; import android.view.View; import android.view.View.OnClickListener; public class MainActivity extends Activity { Button ddc; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_list_item); addListenerOnButton(); } public void addListenerOnButton() { ddc = (Button) findViewById(R.id.ddc); try { //try to open page in facebook native app. String uri = "fb://page/" + natgeo; //Custom URL Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri)); startActivity(intent); } catch (ActivityNotFoundException ex){ //facebook native app isn't available, use browser. String uri = "https://www.facebook.com/natgeo" + natgeo; //Normal URL Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri))…
tagged with: facebook
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25846054
accepted answer: http://stackoverflow.com/a/25846054
has comment: http://stackoverflow.com/comment/40437105
tagged with: java
has comment: http://stackoverflow.com/comment/40437025
type: Question
has title: facebook opening on a browser not on facebook App

http://stackoverflow.com/a/25811225
has body: The file system on Windows is not case-sensitive: Employee.class and employee.class cannot reside in the same directory. Scenario 1 with both classes defined in the same java source: The compiler creating employee.class probably overwerites Employee.class or whatever. Scenario 2 with separate java sources: Eclipse would not be able to create an employee.java in the same directory as Employee.java (under Windows file system). Hence someone in the past took care to handle the error user friendly. Java assumes case-sensitive names. You could take your sources to Linux, compile them to a .jar (a zip format, again case-sensitive). Then copy the jar to windows and execute it. By the way, I think you have found a new way to obfuscating java source code, decompiling under Windows. A related topic is using Unicode letters in class / file names. That touches different platforms, different canonical representations of Unicode (é as one or two Unicode code points), version control systems. Elaboration: (for the interested) The human character é has two representations in Unicode: "é" - as one code point U+00E9, é; "é" - as two code points, U+009B, letter e, plus combining diacritical mark U-0301, ´ (zero width accent). Unfortunately different operating systems (I was told) use a different canonical representation. I once wanted to use the version control system hg but had to find out, their missing support for Linux/Windows interoperability. Otherwise one could normalize to a canonical form with java.text.Normalizer. So let's wait for: class CaféMañanaFaçade
type: Answer
score: 2
answers question: http://stackoverflow.com/q/25810791
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/40376855

http://stackoverflow.com/comment/40292178
comment on: http://stackoverflow.com/q/25765559
has text: My opinion is that if you need the index, you should stick to the old `for` loop with index variable.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/34122373
score: 14
upvote count: 14
has body: This thing worked for me pretty well: @POST @Consumes(MediaType.MULTIPART_FORM_DATA) public void uploadMultiple(@FormDataParam("file") FormDataBodyPart body){ for(BodyPart part : body.getParent().getBodyParts()){ InputStream is = part.getEntityAs(InputStream.class); ContentDisposition meta = part.getContentDisposition(); doUpload(is, meta); } }
answers question: http://stackoverflow.com/q/25749472
downvote count: 0
type: Answer

http://stackoverflow.com/q/25740476
tagged with: jsp
tagged with: javabeans
has title: JavaBeans and sending "double" values
score: 0
tagged with: http://stackoverflow.com/tag/html
has body: im trying to write an HTML page which accepts an argument for amount of inches After the inches has been submitted a JSP page then invokes a bean which converts this inch amount to centimeters and then returns the output this is what i have: HTML page Converter Please enter initial measurement Inches: the bean i want to use package Module6; import java.io.Serializable; public class calculate implements Serializable { private double inch; private double cm; public calculate() {} public calculate(double tempInch){ this.inch = tempInch; } public double convert(){ cm = inch * 2.54; return cm; } } the jsp looks like this <%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> JSP Page <%@ page import="Module6.calculate"%> <%calculate calc = new calculate();%> The result is : <% out.println(calc.convert()); %> The result is always 0.0 ... what am i doing wrong ??
possible better answer: http://stackoverflow.com/a/25740524
has answer: http://stackoverflow.com/a/25741241
accepted answer: http://stackoverflow.com/a/25741241
has answer: http://stackoverflow.com/a/25740524
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/a/44909164
has comment: http://stackoverflow.com/comment/102775264
score: 2
upvote count: 2
has body: There is no html rendering support yet in pdfbox as of 2.0.6. But heard about few commitments on this feature in their future releases.
has comment: http://stackoverflow.com/comment/76813025
downvote count: 0
has comment: http://stackoverflow.com/comment/102774990
has comment: http://stackoverflow.com/comment/102769822
type: Answer
answers question: http://stackoverflow.com/q/25872404

http://stackoverflow.com/comment/40272730
comment on: http://stackoverflow.com/a/25754351
has text: i get what you are saying, but at the same time i don't. What in the code needs change? im not seeing straight
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/25849076
has answer: http://stackoverflow.com/a/25849417
accepted answer: http://stackoverflow.com/a/25849417
type: Question
has body: To interoperate with a service, I must encrypt some values using RSA with a key size that seeems smaller than the minimum of 512 bits on Java. Is there any way I can relax that policy? BigInteger e = new BigInteger("13082845549543033994073971762152947067", 10); BigInteger m = new BigInteger("229110545576645850236522690668306544921", 10); RSAPublicKeySpec spec = new RSAPublicKeySpec(m, e); KeyFactory keyFac = KeyFactory.getInstance("RSA"); PublicKey publicKey = keyFac.generatePublic(spec); // ^^^^ java.security.spec.InvalidKeySpecException: java.security.InvalidKeyException: RSA keys must be at least 512 bits long
has answer: http://stackoverflow.com/a/25849233
score: 0
answer count: 2
tagged with: public-key
possible better answer: http://stackoverflow.com/a/25849233
tagged with: encryption
has comment: http://stackoverflow.com/comment/40444792
has comment: http://stackoverflow.com/comment/40445216
has title: Java public key size
type: AnsweredQuestion
tagged with: java
tagged with: rsa

http://stackoverflow.com/a/25781290
has comment: http://stackoverflow.com/comment/40321073
downvote count: 0
answers question: http://stackoverflow.com/q/25781168
has body: You can use class something like below, import org.apache.log4j.Logger; public class CreateLog{ static Logger logEntry = Logger.getLogger( CreateLog.class.getName()); public void testLog(){ logEntry.info("some information message"); logEntry .error("some error message"); } }
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/40321393
score: 2

http://stackoverflow.com/comment/40411297
has text: Are you appending jsp file as jsp:include or include directive ?
type: AnswerComment
comment on: http://stackoverflow.com/a/25830257
score: 0
type: Comment

http://stackoverflow.com/q/25815537
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/25815779
upvote count: 5
tagged with: java
has body: What is the proper way to handle a bad parameter in a RESTful service? I have an endpoint right now that returns a 400 if the wrong data type is sent. @ResponseBody @RequestMapping(produces = "application/json", method = RequestMethod.GET, value="/v1/test") public MyResponse getSomething(@RequestParam BigDecimal bd) { MyResponse r = new MyResponse(); r.setBd(bd); return r; } It would be really nice if the end user were to pass, say, a String instead of a BigDecimal, that the response would return a json with the response code, status, and whatever else I'd like it to contain, rather than just a 400. Is there a way to do this? Update: My initial thought was to wrap every parameter and then check to see if it's the correct type in that wrapper class. This seems a bit silly. Isn't there a validator that I could just add to the classpath that would recognize something like this? Also, there is a way to handle this quite easily with a Bean type that I could create on my own, but what about standard types like BigDecimal? UPDATE-2: This update addresses answer that uses @ExceptionHandler. TestController.java import java.math.BigDecimal; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; import org.springframework.web.bind.ServletRequestBindingException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping("/") public class TestController { //this is where correct input from user is passed, no binding errors @RequestMapping(produces = "application/json", method = RequestMethod.GET, value="/v1/test") public @ResponseBody MyResponse getSomething(@RequestParam BigDecimal bd) { MyResponse r = new MyResponse(); r.setBd(bd); return r; } //this will hand…
score: 5
answer count: 1
downvote count: 0
favorite count: 0
has title: REST Handling a Bad Parameter
tagged with: rest
has answer: http://stackoverflow.com/a/25815779
tagged with: spring

http://stackoverflow.com/a/25831877
type: Answer
has comment: http://stackoverflow.com/comment/40414477
has comment: http://stackoverflow.com/comment/40414497
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/40414204
has comment: http://stackoverflow.com/comment/40414627
has comment: http://stackoverflow.com/comment/40414523
has comment: http://stackoverflow.com/comment/40414544
has comment: http://stackoverflow.com/comment/40413593
upvote count: 1
has comment: http://stackoverflow.com/comment/40414739
answers question: http://stackoverflow.com/q/25831776
has body: Your problem is that rotation matrix/quaternions rotate points around an axis that passes through the origin. To rotate around different point than the origin, you need to translate the triangle points to the origin (just Substract the rotation point value from the triangle points), then multiply by the quaternion and then translate back. So the algorithm becomes: translatedPoints[i] = triPoints[i] - rotationPoint; translatedPoints rotate using quaternion translate translatedPoints back by adding the rotation point value.

http://stackoverflow.com/comment/40437578
score: 0
type: Comment
has text: @SergeBallesta right... It has base directory starting with **/ (slash)**. In that case question it self is wrong.
type: AnswerComment
comment on: http://stackoverflow.com/a/25813681

http://stackoverflow.com/q/25763472
downvote count: 1
has title: Handle save as dialog box by selenium web driver in java
has answer: http://stackoverflow.com/a/25765472
accepted answer: http://stackoverflow.com/a/27443045
has answer: http://stackoverflow.com/a/44521256
tagged with: java
answer count: 5
tagged with: webdriver
tagged with: automation
type: AnsweredQuestion
score: 1
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27443045
has body: I'm Trying to save a Html Page using Selenium script in java which perform following operations open the web page. fire a right click event. click on save as html option. Now problem is when script click on save as html option it shows a pop-up to save html. I already set default option for download in Firefox but when i run the script it keep showing me pop-up again and again what i need is:- when Firefox shows a save as dialog box then it'll fire an enter event so that it can save html by using Selenium script.
has answer: http://stackoverflow.com/a/25763687
tagged with: selenium-webdriver
upvote count: 2
has answer: http://stackoverflow.com/a/25807866
tagged with: selenium
possible better answer: http://stackoverflow.com/a/25763687

http://stackoverflow.com/a/25785756
answers question: http://stackoverflow.com/q/25785718
type: Answer
has body: args is an argument to main, which means you can only use that argument (which is like a local variable) within main. If you want to use it elsewhere, you have two options. The most suitable is to pass it to your other function as an argument: static void amountOfCharsInSentence(String[] args) { // Declare argument here -----------^^^^^^^^^^^^^ int sum=0; for (String s: args) { // `args` here is the argument to *this* function sum+=s.length(); } } public static void main(String[] args) { amountOfCharsInSentence(args); // Pass it here --------^^^^ } Your other option is to create a static member of your class, which all methods in your class have access to, and assign args to that static member: class YourClass { static String[] commandLineArgs; static void amountOfCharsInSentence() { int sum=0; for (String s: commandLineArgs) { // Use the static member here sum+=s.length(); } } public static void main(String[] args) { commandLineArgs = args; // Assign the static member here amountOfCharsInSentence(); } } ...but that's probably not appropriate in this case.
accepted answer of: http://stackoverflow.com/q/25785718
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/40339951
score: 2
has text: If you want more precision, use doubles instead of ints. You can't expect to have a precise result of a division with integers, since they are... integers
comment on: http://stackoverflow.com/q/25791829
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25783271
type: Question
tagged with: testing
score: 0
tagged with: junit
has comment: http://stackoverflow.com/comment/40326978
has comment: http://stackoverflow.com/comment/40325414
type: UnansweredQuestion
has title: Testing for mutually exclusive correct assertions
has body: I have a loop in my code which goes over a set of strings. Said strings are then passed along to several other functions. In my tests, I'm basically emulating the flow of code and asserting at the start of each method I expect it to visit, if the string is correct. But I can only write the test method once. Meaning that I have to do the following to catch all the different strings: assertTrue(string.equals("test1") || string.equals("test2") || string.equals("test3") || ...); However, there's a problem with this if one or more of those strings are not successfully passed to the list that is looped over. Since this is a chain of OR statements, it will succeed as long as there is 1 correct string, regardless of whether any of the other strings are missing. Which is a problem. I can't emulate the loop, I can only emulate the functions receiving the data each time. Is there a way to deal with this problem? EDIT: some clarification. I start out with a list of strings. This list gets looped over, meaning every single string instance will go through a bunch of functions. And then the next string. And so on. In the test, I can write dummies for the methods the string goes through. This means I override the behavior of the actual code and send my own custom return. This has to be correct though, since the function following that has to properly process what I just send to it. But, when I start the test with the dummy data, it will do the loop, meaning the same function gets called multiple times, each time with a different string. I can't just do 1 test for one of the strings, because the next loop will fail on the next string.
answer count: 0
tagged with: java

http://stackoverflow.com/comment/40318089
score: 2
has text: Forget the Java part and do it all with the database tools. If you use a programming language you will have to move the data in both directions over the network. Doing it with the database itself will be orders of magnitude faster and more reliable.
comment on: http://stackoverflow.com/q/25779593
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/40208761
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25720269
has text: This is not true because dependencies can be injected as constructor arguments, keeping all Spring managed beans immutable. Setter (property based) injection (that makes objects mutable) becomes useful when there are legitimate scenarios requiring cyclic dependencies (`A` depends on `B` which in turn depends on `A`).
type: AnswerComment

http://stackoverflow.com/a/25799899
type: Answer
score: 1
has body: The reason is that you have two x variables -- one in A and one in B, so when you call super(x), it goes to the constructor in A, which, because it's in A, assigns A's x to the argument of super(x). So it sets super.x to 20, but doesn't change the x in B. So Bs x stays at the 10 it was originally initialized as.
answers question: http://stackoverflow.com/q/25799838
upvote count: 1
downvote count: 0

http://stackoverflow.com/comment/40291579
type: QuestionComment
comment on: http://stackoverflow.com/q/25765232
score: 0
has text: Java in nature is platform independent so I guess (not checked) that the answer is YES
type: Comment

oauth-2.0
tag name: oauth-2.0
type: Tag
tags question: http://stackoverflow.com/q/25765619

http://stackoverflow.com/a/75018586
downvote count: 0
has comment: http://stackoverflow.com/comment/135338616
type: Answer
answers question: http://stackoverflow.com/q/25753966
score: 13
upvote count: 13
has body: For anyone who, like me, needs to know exactly where to add this information, here it goes. First of all, understand where java is - in my case it is something like this (I use asdf but never mind that): ~$ asdf where java /Users/your.username/.asdf/installs/java/liberica-17.0.2+9 Therefore, the string that MAT needs to know is "/Users/your.username/.asdf/installs/java/liberica-17.0.2+9/bin/java". This is the string I add to MAT's .plist file: ... Eclipse -keyring ~/.eclipse_keyring -vm /Users/your.username/.asdf/installs/java/liberica-17.0.2+9/bin/java CFBundleDisplayName MemoryAnalyzer </dict> </plist> For contrast, these were the original contents of the file: ... Eclipse -keyring ~/.eclipse_keyring CFBundleDisplayName MemoryAnalyzer </dict> </plist> Just for information, I am using a Mac with M1 architecture.

http://stackoverflow.com/a/25843913
score: 0
has body: The neweast javacpp presets javacpp-presets-0.9 already hava whole opencv javacv version implementation. Check if the functions you need is available. https://github.com/bytedeco/javacpp-presets/tree/master/opencv If not, I think you need to see the definition(implemetaion) of the two c++ function roi() and maskroi() to convert very line code into javacv counterpart by yourself. And, google group of javacpp is also a best place to ask if you hava javacpp related questions. http://groups.google.com/group/javacpp-project Note: for c++ output parameter type(call by pointer or call by reference), you need to understand java function parameter has no output type, so you need to use array instead as workaround, for example: C++ code: void detectBothEars(Mat input, Rect* left, Rect* right); The javacv counterpat should be: void detectBothEarsRect(Mat input, Rect[] left， Rect[] right); And the client code is: Rect[] leftRect = new Rect[1]; Rect[] rightRect = new Rect[1]; detectBothEars(face, leftRect , rightRect);
type: Answer
answers question: http://stackoverflow.com/q/25826018

http://stackoverflow.com/comment/40361189
score: 0
comment on: http://stackoverflow.com/q/25803182
type: Comment
type: QuestionComment
has text: I don't know if it's related to your problem but in your `Runnable` you're catching an exception and not doing anything with it.

http://stackoverflow.com/comment/40416318
type: Comment
has text: @user2860954 : You are welcome, but ifLoop's solution is more elegant. Forget about the Java 8 version if you don't understand it, his single loop is fine.
comment on: http://stackoverflow.com/a/25833363
score: 1
type: AnswerComment

http://stackoverflow.com/q/25735788
has comment: http://stackoverflow.com/comment/40239974
has answer: http://stackoverflow.com/a/25736566
possible better answer: http://stackoverflow.com/a/25735851
tagged with: android
has comment: http://stackoverflow.com/comment/40238074
has answer: http://stackoverflow.com/a/25736831
tagged with: android-activity
answer count: 4
type: AnsweredQuestion
tagged with: java
has body: I'm a self learner for android app developer, then this problem came up and I'm not sure if people have this problem before but it says my app has stopped in the emulator. So these are the codes I have : MainActivity.java public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button imageButton13 = (Button) findViewById(R.id.imageButton13); imageButton13.setOnClickListener(new OnClickListener() { public void onClick(View v) { Intent Intent = new Intent(v.getContext(), EXOActivity.class); v.getContext().startActivity(Intent); } }); } } EXOActivity.java: package com.mhyuktown.exowallpaper; import android.app.Activity; import android.os.Bundle; public class EXOActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_exo); } } Lastly here is my manifest <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="21" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> logcat: 09-09 00:40:02.006: D/dalvikvm(1564): GC_FOR_ALLOC freed 49K, 4% free 3304K/3436K, paused 79ms, total 86ms 09-09 00:40:02.256: D/dalvikvm(1564): GC_FOR_ALLOC freed 7K, 3% free 3770K/3876K, paused 35ms, total 37ms 09-09 00:40:02.326: D/AndroidRuntime(1564): Shutting down VM 09-09 00:40:02.326: W/dalvikvm(1564): threadid=1: thread exiting with uncaught exception (group=0xb1aa7ba8) 09-09 00:40:02.376: E/AndroidRuntime(1564): FATAL EXCEPTION: main 09-09 00:40:02.376: E/AndroidRuntime(1564): Process: com.mhyuktown.exowallpaper, PID: 1564 09-09 00:40:02.376: E/AndroidRuntime(1564): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mhyuktown.exowallpaper/com.mhyuktown.exowallpaper.MainActivity}: java.lang.ClassCastException: android.widget.ImageButton cannot be cast to android.widget.Button 09-09 …
has answer: http://stackoverflow.com/a/45746961
type: Question
has title: Android: Switching between two activities Error - Unfortunately "App Name" has stopped
has answer: http://stackoverflow.com/a/25735851
has comment: http://stackoverflow.com/comment/40238047
has comment: http://stackoverflow.com/comment/40238026
tagged with: eclipse
accepted answer: http://stackoverflow.com/a/25736566
score: 0

http://stackoverflow.com/comment/40506080
comment on: http://stackoverflow.com/q/25866464
type: QuestionComment
type: Comment
has text: i'm very new to java. Can some one provide me sample code to call an sql script and execute it.
score: 0

http://stackoverflow.com/a/25846854
answers question: http://stackoverflow.com/q/25846722
has comment: http://stackoverflow.com/comment/40440493
has comment: http://stackoverflow.com/comment/40440446
score: 0
has body: String allchar = "PJGOGROG fnkmslkjsfsdmnsgdnklnsgklsgknlgrf jkghijgdlkjkgjdfkjgf kjlgdfkjlfdgfjklkljkljfdkjlfkjldfdkjslkljdfskjlfsjkldfsjklkljsfdsjklsdfkljsfdkljkhgfhhgdfsgkhdfskghfdskghfdsghsfdghafevbhfsvgydcgubcdmgycdgfehkhfeghjgh68Alias12345"; String number = ""; String reqtext = allchar.replaceAll("\\s+",""); number = reqtext.substring(reqtext.length()-10, reqtext.length()); System.out.println(number); This code works fine for me in android.
has comment: http://stackoverflow.com/comment/40440557
type: Answer

http://stackoverflow.com/comment/40259714
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25747769
has text: @Andrey it is not duplicate, as string is not in JSON format
score: 0

http://stackoverflow.com/comment/40400550
type: Comment
comment on: http://stackoverflow.com/a/25824874
score: 0
type: AnswerComment
has text: care to share the error?

http://stackoverflow.com/comment/40235925
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25734678
has text: Thank you Hovercraft, it is helpfull and I will use it if I will not found any other method to do that. Actually I don't think it will be good to use JDialog in the place of JFrame. But your answer is helpfull.

http://stackoverflow.com/comment/40366412
comment on: http://stackoverflow.com/q/25806403
has text: *afaik*, not possible. Perhaps a switch case in comparator and passing related value to swith helps.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/25749881
tagged with: swing
has comment: http://stackoverflow.com/comment/40263753
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/25750104
accepted answer: http://stackoverflow.com/a/25750104
type: Question
upvote count: 2
answer count: 2
has comment: http://stackoverflow.com/comment/40263581
tagged with: arrays
possible better answer: http://stackoverflow.com/a/25750506
has title: Paint program not using parallel arrays to store size and color properly
has answer: http://stackoverflow.com/a/25750506
tagged with: arraylist
has body: It's a simple Paint-style program based on the use of arrays and arraylists to save the coordinates, sizes, and colors of different points draw on the screen using a JFrame, paintComponent, and various mouse listeners. I recently fixed a problem where it would spit out an ArrayOutOfBounds error and point to line 34 with the colors array exceeding its limit of 10000. However I need the program to run and the size and color of each point parallel to each other, so each time the program repaints the points, each retains its own size and color variables. Thank you for your input! import java.util.ArrayList; import javax.swing.JPanel; import java.awt.*; import java.awt.event.*; public class Proj1Panel extends JPanel{ public int SIZE = 5, c = 0, s = 0; private ArrayList&lt;Point&gt; pointList; public int[] sizes; public Color[] colors; public Proj1Panel(){ pointList = new ArrayList&lt;Point&gt;(); sizes = new int[10000]; colors = new Color[10000]; addMouseListener (new Proj1Listener()); addMouseMotionListener (new Proj1Listener()); addMouseWheelListener (new Proj1Listener()); setBackground(Color.black); setPreferredSize(new Dimension(300, 200)); } public void paintComponent(Graphics page){ super.paintComponent(page); for(Point spot : pointList){ page.setColor(colors[c]); page.fillRect(spot.x-sizes[pointList.size()], spot.y-sizes[pointList.size()], sizes[pointList.size()]*2, sizes[pointList.size()]*2); c = 0; } repaint(); page.setColor(Color.RED); page.fillRect(5, 40, 30, 30); page.setColor(Color.BLUE); page.fillRect(5, 75, 30, 30); page.setColor(Color.GREEN); page.fillRect(5, 110, 30, 30); page.setColor(Color.WHITE); page.fillRect(5, 145, 30, 30); page.setColor(Color.WHITE); page.drawString("Count: " + pointList.size() + "/10000", 5, 15); page.drawString("Size: " + SIZE, 5, 30); } private class Proj1Listener implements MouseListener, MouseMotionListener, MouseWheelListener{ public void mousePressed(MouseEvent event){ pointList.add(event.getPoint()); sizes[pointList.size()…
tagged with: paintcomponent
favorite count: 0
has comment: http://stackoverflow.com/comment/40263860

http://stackoverflow.com/q/25792197
type: AnsweredQuestion
has title: How to stop JBoss EAP 6.0.1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25792311
accepted answer: http://stackoverflow.com/a/25792311
tagged with: jboss
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/40340858
has body: I start JBoss using the standalone.bat file but I can't seem to find the file to shut it down. I Googled some options and they said run the shutdown file but there is none in my folder.

http://stackoverflow.com/q/25807695
tagged with: java
type: Question
has title: Radio button and Hashmap
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/25807848
has body: This is code segment i want to put the values in a Hashmap through radio button but for first time the e value inserted is null and on next click of radio button last selected option is displayed. Here is my code Segment,Thanks .. for (int i = 0; i &lt; rgroup.getChildCount(); i++) { RadioButton btn = (RadioButton) rgroup.getChildAt(i); if (btn.getId() == checkedId) { String text = btn.getText().toString(); //if ((text.compareTo("") != 0) &amp;&amp; (text != null) ){ String text1 = user_answer.put(position+"", text); Toast.makeText(context, text1, Toast.LENGTH_SHORT).show(); } }
type: UnansweredQuestion
tagged with: android

http://stackoverflow.com/q/25858085
score: 2
downvote count: 0
tagged with: java
has title: Can't instantiate class -android programming
has answer: http://stackoverflow.com/a/25858302
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/25859530
favorite count: 0
answer count: 3
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: I was following the tutorial videos here: http://www.youtube.com/watch?v=pZaRNVwKAy4&list=PLB03EA9545DD188C3&index=7 and came across a few errors while following the tutorials. Everything works fine until i started to work on the Tutorial: onCheckedChanged method. Can someone explain what I am doing wrong? Thanks a lot. LogCat Code 09-15 18:38:22.444: E/MediaPlayer(1764): Should have subtitle controller already set 09-15 18:38:27.984: E/MediaPlayer(1764): Should have subtitle controller already set 09-15 18:38:31.374: E/AndroidRuntime(1764): FATAL EXCEPTION: main 09-15 18:38:31.374: E/AndroidRuntime(1764): Process: com.example.myfirstapp, PID: 1764 09-15 18:38:31.374: E/AndroidRuntime(1764): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.myfirstapp/com.example.myfirstapp.TutorialOne}: java.lang.InstantiationException: can't instantiate class com.example.myfirstapp.TutorialOne 09-15 18:38:31.374: E/AndroidRuntime(1764): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2121) 09-15 18:38:31.374: E/AndroidRuntime(1764): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 09-15 18:38:31.374: E/AndroidRuntime(1764): at android.app.ActivityThread.access$800(ActivityThread.java:135) 09-15 18:38:31.374: E/AndroidRuntime(1764): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 09-15 18:38:31.374: E/AndroidRuntime(1764): at android.os.Handler.dispatchMessage(Handler.java:102) 09-15 18:38:31.374: E/AndroidRuntime(1764): at android.os.Looper.loop(Looper.java:136) 09-15 18:38:31.374: E/AndroidRuntime(1764): at android.app.ActivityThread.main(ActivityThread.java:5017) 09-15 18:38:31.374: E/AndroidRuntime(1764): at java.lang.reflect.Method.invokeNative(Native Method) 09-15 18:38:31.374: E/AndroidRuntime(1764): at java.lang.reflect.Method.invoke(Method.java:515) 09-15 18:38:31.374: E/AndroidRuntime(1764): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25858142
has comment: http://stackoverflow.com/comment/40461414

http://stackoverflow.com/comment/40200331
type: QuestionComment
score: 1
has text: @jww Knowing a class or method name helps in picking search terms. To post my answer, I had to google the exact method name, but I knew it was in the `Double` class.
type: Comment
comment on: http://stackoverflow.com/q/25714197

http://stackoverflow.com/comment/41240457
type: Comment
has text: Perfect .. but one major issue is there .. After converting to java file from WADL ... I am getting the following :- `DataResponse insertDataOperation(String string);` .. where as it should be actually `DataResponse insertDataOperation(String message);` ... I am getting for both **insert** and **update**
comment on: http://stackoverflow.com/a/26264816
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40319110
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25779990
has text: Then what happens if the user decides to move the program after it's installed?

http://stackoverflow.com/q/25728367
answer count: 1
has answer: http://stackoverflow.com/a/25728530
has comment: http://stackoverflow.com/comment/40223590
tagged with: javascript
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40223574
has comment: http://stackoverflow.com/comment/40223558
has title: Strip Javascript Comments in Java/Scala Program
has comment: http://stackoverflow.com/comment/40223707
type: Question
tagged with: scala
tagged with: regex
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/40223631
has body: I'm trying to reliably strip out Javascript multi-line and single-line comments in Java or Scala. Even if it requires running an external program, that would be OK (but not ideal). There must be some library or tool to do this. I've looked at this post: http://james.padolsey.com/javascript/removing-comments-in-javascript/ and converted it to Scala. But his logic is broken in a few different ways. One problem is that it doesn't properly tell the difference between division and the start of a regex. It also doesn't handle escape sequences in all situations. I've been trying to fix this code, but its tricky - especially telling the difference between regex and division. I don't want to re-invent the wheel here, and I don't want to build a freaking Javascript parser. Any ideas?
has comment: http://stackoverflow.com/comment/40224091

http://stackoverflow.com/comment/40275653
type: Comment
type: QuestionComment
has text: compabiliby issue: find a version that is compatible.
comment on: http://stackoverflow.com/q/25755760
score: 0

http://stackoverflow.com/comment/40395543
type: Comment
comment on: http://stackoverflow.com/a/25816238
has text: Thanks for that. I tried it and you're right. `foo(Set<List<?>> set)` won't accept a `Set<List<String>>`. I should probably just give up trying to understand generics! Is there any point in the signature `void foo(Set<List<?>> set)`? Will it accept any concrete types at all?
type: AnswerComment
score: 0

http://stackoverflow.com/q/25765028
has answer: http://stackoverflow.com/a/25765836
has title: How to make a process monitor your program to restart it if it exits
has comment: http://stackoverflow.com/comment/40292209
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/696839
tagged with: java
has comment: http://stackoverflow.com/comment/40290852
has comment: http://stackoverflow.com/comment/40290877
linked to: http://stackoverflow.com/q/25760269
linked to: http://stackoverflow.com/q/2541597
has answer: http://stackoverflow.com/a/25765814
accepted answer: http://stackoverflow.com/a/25765814
linked to: http://stackoverflow.com/q/35842
answer count: 2
linked to: http://stackoverflow.com/q/54686
linked to: http://stackoverflow.com/q/9072879
possible better answer: http://stackoverflow.com/a/25765836
downvote count: 0
has body: So i have my program, but i don't want it to be able to be closed. I know its not possible to make it 100% unclosable but this method seems like it would work the best. I realize that you can addShutdownHook, but this will not work if the process is killed in from the operating system, using Task Manager (Windows) or kill -9 (Unix). Obviously, if I have a second process running and the main one is killed it can just re-run the main one again, which makes it much more reliable. So, I want to know how to create a watchdog process in Java that monitors my actual Java application to detect if it has been closed, then if it has been closed it re-executes the program.
favorite count: 0
linked to: http://stackoverflow.com/q/2213340
score: 2
tagged with: watchdog
has comment: http://stackoverflow.com/comment/40291230
upvote count: 2

http://stackoverflow.com/comment/45280245
type: Comment
has text: @Ferenjito what was your solution?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25912795

http://stackoverflow.com/comment/40267847
comment on: http://stackoverflow.com/a/25751915
type: AnswerComment
score: 0
type: Comment
has text: @KickButtowski I am not saying that I am sure I am right, it is only my suspicion. OP would need to tell us more about desired result and explain if `21` should be in result. If so then why `2013` shouldn't.

http://stackoverflow.com/a/25853771
score: -1
has body: Not sure, looks like you are running a new version of Java, on an older version of eclipse. Please make sure , u are using latest versions, also update the JAVA_HOME and PATH. And try again.
answers question: http://stackoverflow.com/q/25853529
type: Answer
upvote count: 0
downvote count: 1

http://stackoverflow.com/a/25787298
has comment: http://stackoverflow.com/comment/40333916
has body: Its the String literals that are stored in pool. Rest for all other questions that you have, its just a reference. So String[] holds reference to String Objects which include pooled objects as well. Similarly ArrayList will hold the reference. Changing [] to ArrayList wont make a difference. Rather changing these String to StringBuffer/builder will, as basic operations like +(concat) doesnot create a new object all together.
type: Answer
downvote count: 0
has comment: http://stackoverflow.com/comment/40333260
answers question: http://stackoverflow.com/q/25787087
score: 1
upvote count: 1

http://stackoverflow.com/a/25808657
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/40390061
score: 4
upvote count: 4
has body: You you are using wrong Excel formula. See the section "Using SUM and INT function to count the number of workdays" of the site that you have provided. It is stating the formula as: =SUM(INT((WEEKDAY(A2-{2,3,4,5,6})+B2-A2)/7)) In Excel, Sunday is 1 and Saturday is 7. The numbers inside the curly braces indicates the day-of-weeks to be included. So for your case the formula will be: =SUM(INT((WEEKDAY(A2-{2,3,5,7})+B2-A2)/7)) Please see the attached screenshot: It is returning 2247 as the following code returns: import java.time.DayOfWeek; import java.time.LocalDate; import java.time.Month; import java.time.Year; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; public class SO25798876 { public static void main(String[] args) { String strStartDate = "09/07/2014"; String strEndDate = "06/13/2025"; String pattern = "MM/dd/yyyy"; DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern); LocalDate startDate = LocalDate.parse(strStartDate, formatter); LocalDate endDate = LocalDate.parse(strEndDate, formatter); int count = 0; while(startDate.isBefore(endDate) || startDate.isEqual(endDate)) { // you may want to not to use the isEqual method DayOfWeek dayOfWeek = startDate.getDayOfWeek(); if(!(dayOfWeek == DayOfWeek.SUNDAY || dayOfWeek == DayOfWeek.WEDNESDAY || dayOfWeek == DayOfWeek.FRIDAY)) { count++; } startDate = startDate.plusDays(1); } System.out.println(count); } } You also have mentioned your doubt that the java.time may be not considering leap year, which is wrong, if you add the following piece of code long year = startDate.getYear(); if(Year.isLeap(year)) { Month month = startDate.getMonth(); if(month == Month.FEBRUARY &amp;&amp; startDate.getDayOfMonth() == 29) { System.out.println("Calculated 29th Feb for the year: " + year); } } You will see that it is printing: Calculated 29th Feb for the year: 2016 Calculated 29th Feb for the year: 2020 Calculated 29th Feb for the year: 2024 Lastly the count will be 2247 which matches t…
answers question: http://stackoverflow.com/q/25798876

http://stackoverflow.com/comment/40263470
has text: @JoopEggen That's a good class to know about, but here, it introduces the per-node space overhead of an object reference, an object, array metadata, and a length field, as well as the time overhead of two additional indirections (node -> BitSet -> backing array, unless JVMs have gotten a lot cleverer while I wasn't looking) and probably more than a few arithmetic instructions to compute indexes into the backing array and loop over them.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25749383
type: Comment

http://stackoverflow.com/comment/40333644
type: AnswerComment
comment on: http://stackoverflow.com/a/25786814
has text: There are too many problems solved by SymmetricDS, I'm not sure I would suggest you to go through unless you're in the business of data synchronization. What's the problem with using a standalone server?
score: 0
type: Comment

http://stackoverflow.com/a/25795022
score: 2
downvote count: 0
has body: Use overloaded version of indexOf(), which takes the starting indes as 2nd parameter: str.indexOf("string", str.indexOf("string") + 1); To get the index of 2 string ... and then replace it with this offset ... Hopefully this helps.
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/25794908

http://stackoverflow.com/comment/44958360
type: AnswerComment
type: Comment
has text: @Rule - Weird. Perhaps it's something to do with the Mac version of Eclipse (something about which I know very little). I'm surprised that the linking is with CMD-click instead of CTRL-click.
comment on: http://stackoverflow.com/a/25873342
score: 0

http://stackoverflow.com/comment/40287779
type: Comment
comment on: http://stackoverflow.com/a/25762820
has text: Thank you. ArrayList does the job.!!
type: AnswerComment
score: 0

http://stackoverflow.com/q/25736574
has body: I would like to Know What if once the search button in clicked and the ID does not exist, where do i imput the Command to display a error.. else if(e.getSource() == btnSearch) { ResultSet rs = null; rs = sD.getSummonID(txtSummonID.getText()); Summon s = null; try { while(rs.next()) { s = new Summon(rs.getInt("id"), rs.getString("plateNum"), rs.getDouble("amount"), rs.getString("recDate"), rs.getString("location"), rs.getString("officer")); } txtcarLicenceNo.setText(s.getCarLicenceNo()); txtAmount.setText(Double.toString(s.getAmount())); txtLocation.setText(s.getLocation()); txtOfficer.setText(s.getOfficerInCharge()); } catch (SQLException ex) { System.err.println("SQL Exception: " + ex); } } the other class looks like this public ResultSet getSummonID(String summonID) { getConnection(); try { stmt = conn.createStatement(); rs = stmt.executeQuery("SELECT * FROM record WHERE id = " + summonID); return rs; } catch (SQLException e) { System.err.println("SQL Exception: " + e); return rs; } }
has answer: http://stackoverflow.com/a/25736618
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: database
has title: What if ResultSet that is to be retrieved from database does not exist. how can i make the command issue a JOptionPane message in JDBC
answer count: 2
possible better answer: http://stackoverflow.com/a/25736618
score: 0
tagged with: sql
tagged with: jdbc
has answer: http://stackoverflow.com/a/25736594
accepted answer: http://stackoverflow.com/a/25736594
tagged with: netbeans

http://stackoverflow.com/comment/40518455
type: Comment
score: 1
has text: I tested with exactly that version with the same results. But, as said, you didn’t use the standard `jstack` tool from that jdk. The output look different. Say what you used to get that output. Or try to use the standard `jstack` command for comparison.
type: AnswerComment
comment on: http://stackoverflow.com/a/25873920

http://stackoverflow.com/q/25738544
has answer: http://stackoverflow.com/a/25738647
accepted answer: http://stackoverflow.com/a/25749295
has title: Does java web application contains only one hibernate session and how to clear this hibernate session?
tagged with: spring
type: AnsweredQuestion
has body: I am having an issue in saving and retrieving objects in database in just one request. I want to clear the cache of our hibernate session to get the updated entity in our database. My code looks like this: public class SampleController{ protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception { myServiceOne.doAllotsOfSaving(parameters); //some code enhancements to remove cache in hibernate session //without affecting the session of other user logged in. //some fields in MyEntity class contains the old values but the actual data in database is already updated MyEntity entity = myServiceTwo.getMyEntityByOrderNo(orderNo); } } --configurations --configurations
score: 0
tagged with: java
tagged with: hibernate
has answer: http://stackoverflow.com/a/25749295
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/25738647

http://stackoverflow.com/comment/40308077
type: Comment
has text: Thank you. You help me realize how works setContentView and addView. You solved my problem and teach me some new things.
comment on: http://stackoverflow.com/a/25773941
score: 0
type: AnswerComment

http://stackoverflow.com/comment/40394564
comment on: http://stackoverflow.com/q/25821075
score: 0
type: Comment
type: QuestionComment
has text: So how do you import a custom made font file?

http://stackoverflow.com/a/33797856
type: Answer
score: 0
has body: I have the following exception: java.text.ParseException: Unparseable date System.out.println("inside the XMLGregorianCalendar"); sb = (String) map.get(fieldname); System.out.println("THis is XMLGReogoriaaaaan calendar"+ sb); DateFormat df = new SimpleDateFormat("yyyy-MM-dd", Locale.US); Date journeyDate = new java.sql.Date(df.parse(sb).getTime()); System.out.println("this"+journeyDate);
answers question: http://stackoverflow.com/q/25872702
has comment: http://stackoverflow.com/comment/55403024

http://stackoverflow.com/q/25835890
has title: Receive user name and password from user using jbutton
duplicate of: http://stackoverflow.com/q/513832
has body: I'm having trouble with using jbuttonactionperformed to receive a username and password in java. What is wrong with this code. I searched in google and saw that a character array is used to store getPassword return.Is it wrong? private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { char[] input = {'r','o','o','t'}; if (jTextField1.getText() == "admin" &amp;&amp; jPasswordField1.getPassword() == input) { srchnm.main(null); } }
score: 0
linked to: http://stackoverflow.com/q/513832
answer count: 1
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25835895
tagged with: jbutton
tagged with: jpasswordfield
tagged with: java
type: Question

http://stackoverflow.com/comment/40341238
score: 1
has text: String.intern() will not allow the garbage collector to throw away memory when you stop using it. It is permanently in memory and can't be reclaimed. I'd highly suggest to avoid it if you want to build a stable and robust application.
type: AnswerComment
comment on: http://stackoverflow.com/a/25790160
type: Comment

http://stackoverflow.com/a/25864366
has body: Answers do cover your question regarding the use of Strings for locking (See String interning for more details) so I will just mention a few other considerations: Although you have defined the List as final (Cannot assign another list instance) and initialized with .asList(..) (Cannot change size) this doesn't make read-only or thread-safe, so if someone changes elements in that list you might get into an unstable state. Consider using a read-only list. You also need to clarify the scope of locking. What are you trying to lock against? If goToToilet changes the object attributes, then the point of synchronization would be better placed in the method that changes the state of the Object. (This is a design recommendation; The code would work but would also be prone to errors when changing the code in the future) Finally, I would also have a look in java concurrent structures as you might find concurrent collections and locking mechanisms useful.
type: Answer
score: 1
answers question: http://stackoverflow.com/q/25863255
upvote count: 1
downvote count: 0

http://stackoverflow.com/a/25806034
type: Answer
answers question: http://stackoverflow.com/q/25805526
score: 0
has body: It sounds like you have an unknown number of strings to add to an array. The typical way to do this is to add them to a list, then convert this to an array. For example, assuming your method returns null when out of strings: String s; List&lt;String&gt; list = new ArrayList&lt;&gt;(); while ((s = entry.getKey()) != null) { list.add(s); } String[] array = list.toArray(new String[0]);

http://stackoverflow.com/comment/82652396
comment on: http://stackoverflow.com/a/47844026
score: 0
type: AnswerComment
has text: Add some description to your answer.
type: Comment

http://stackoverflow.com/a/25722608
has body: Yes it is a good idea and yes the threads will be used for udp and tcp.
downvote count: 0
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/25718246
accepted answer of: http://stackoverflow.com/q/25718246
upvote count: 1
type: Answer

eclipse-indigo
tags question: http://stackoverflow.com/q/25790414
tag name: eclipse-indigo
type: Tag
tags question: http://stackoverflow.com/q/25742573

http://stackoverflow.com/a/25956079
downvote count: 0
answers question: http://stackoverflow.com/q/25867417
accepted answer of: http://stackoverflow.com/q/25867417
type: Answer
upvote count: 1
has body: Issue was with Tomcat version installed through eclipse. Downloaded other tomcat version from apache site, now it's working ok.
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/25725085
has answer: http://stackoverflow.com/a/25725573
has comment: http://stackoverflow.com/comment/40218202
upvote count: 1
has comment: http://stackoverflow.com/comment/40218106
favorite count: 0
tagged with: jlabel
has comment: http://stackoverflow.com/comment/40217564
downvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/21142686
has comment: http://stackoverflow.com/comment/40218265
tagged with: swing
has title: How Do I Make These JLabels of JButtons invisible
has comment: http://stackoverflow.com/comment/40217352
has comment: http://stackoverflow.com/comment/40218482
has body: I have a class called BoardSquare that is an inherited class of JButton. Each of the BoardSquare objects is stored in an array BoardSquare[][] boardsquares. I have used the following code BoardSquare.boardSquares[j][i].add(new JLabel((j+1)+":"+(i+1))); to add labels to each of the squares in the array according to their coordinates. I need them to have these labels(I think) so that I can identify them and addActionListeners, etc. How do I make the JLabels invisible so they don't show up in my JFrame? Alternatively, how can I make the JLabel of each button an instance variable so that I can call JLabel.setVisible(false) but still use them when I add action listeners? EDIT: If anyone's interested, it's for a Checkers Game. Here are my classes: GameWindow BoardSquare Checker MyListener
tagged with: jbutton
has answer: http://stackoverflow.com/a/25725232
has comment: http://stackoverflow.com/comment/40218162
score: 1
tagged with: java
type: Question
answer count: 2

http://stackoverflow.com/q/25726829
upvote count: 2
type: UnansweredQuestion
score: 2
has comment: http://stackoverflow.com/comment/40220767
tagged with: java
has comment: http://stackoverflow.com/comment/40220554
type: Question
has comment: http://stackoverflow.com/comment/40220521
downvote count: 0
has body: I have a foreground service which download some data from a server, the problem is sometimes OS killed my foreground service but the notification of the service won't be removed! Any ideas on how to remove the notification when the service is no longer exist!?
tagged with: android
favorite count: 0
has title: Foreground service killed by OS
has comment: http://stackoverflow.com/comment/40220665
answer count: 0

http://stackoverflow.com/q/25831784
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/25831940
type: Question
answer count: 2
score: 5
has body: Similar Questions: Here and Here I guess the situation is pretty uncommon to begin with, and so I admit it is probably too localized for SO. The Problem public class bqf implements azj { ... public static float b = 0.0F; ... public void b(...) { ... /* b, in both references below, * is meant to be a class (in the * default package) * * It is being obscured by field * b on the right side of the * expression. */ b var13 = b.a(var9, var2, new br()); ... } } The error is: cannot invoke a(aji, String, br) on primitive type float. Compromisable limitations: Field b cannot be renamed. Class b cannot be renamed or refactored. Why I am modifying an obfuscated program. For irrelevant[?], unknown (to me), and uncompromisable reasons the modification must be done via patching the original jar with .class files. Hence, renaming the public field b or class b would require modifying much of the program. Because all of the classes are in the default package, refactoring class b would require me to modify every class which references b (much of the program). Nevertheless there is a substantial amount of modification I do intend on doing, and it is a pain to do it at the bytecode level; just not enough to warrant renaming/refactoring. Possible Solutions The most obvious one is to rename/refactor. There are thousands of classes, and every single one is in the default package. It seems like every java program I want to modify has that sort of obfuscation. : ( Anyways sometimes I do take the time to just go about manually renaming/refactoring the program. But when when there's too many errors (I once did 18,000), this is not a viable option. The second obvious option is to do it in bytecode (via ASM). Sometimes this is ok, when the modifications are small or simple enough. Unfortunately doing bytecode modifications on only the files which I can't compile through java (which is most of them, but this is what I usually try to do) is painfully slow by comparison. Sometimes I can extend cla…
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/4547740
has answer: http://stackoverflow.com/a/25831933
has title: Java Obscured Obfuscation
tagged with: obfuscation
type: UnansweredQuestion

http://stackoverflow.com/a/25784001
type: Answer
answers question: http://stackoverflow.com/q/25780239
has body: Try to get layout inflater as LayoutInflater inflater = (LayoutInflater)context.getSystemService (Context.LAYOUT_INFLATER_SERVICE); This may work
score: 0

weblogic-10.x
tag name: weblogic-10.x
type: Tag
tags question: http://stackoverflow.com/q/25717234

android-library
type: Tag
tag name: android-library
tags question: http://stackoverflow.com/q/25738939

http://stackoverflow.com/comment/40332787
type: Comment
score: 1
type: AnswerComment
has text: Not similar, just `ContextLoaderListener`. I think this solutiion is better than `@PostConstruct` because in this case you are guaranteed that the context is indeed created and ready. `@PostConstruct` just guarantees that the specific bean is created and all its dependencies are injected.
comment on: http://stackoverflow.com/a/25767811

http://stackoverflow.com/q/25815358
has answer: http://stackoverflow.com/a/25815685
has title: How invoke a Store Procedure using Hibernate con Sql Server 2000?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25815575
linked to: http://stackoverflow.com/q/4524841
tagged with: sql-server
has body: I have a problem calling store procedure using hibernate session: Code Java: @SuppressWarnings("unchecked") @Transactional(readOnly = true) @Override public List&lt;Map&lt;String, Object&gt;&gt; buscarCierre(String vanio) throws Exception { try { List&lt;Map&lt;String, Object&gt;&gt; mapa = new ArrayList&lt;&gt;(); String queryString = "usp_Cierre_Dia_Obtener_CierrePorAnio :anio, :pagActual, :tamanio"; Query query = super.getSession().createSQLQuery(queryString); query.setString("anio", vanio); query.setInteger("pagActual", 1); query.setInteger("tamanio", 1); List&lt;Object[]&gt; result = query.list(); // requires casting for generics for(Object[] obj : result) { System.out.println("--- "+obj[0]); System.out.println("*** "+obj[1]); } return mapa; } catch (Exception e) { e.printStackTrace(); throw new Exception( getGenerarError(Thread.currentThread().getStackTrace()[1].getMethodName(), Constantes.NIVEL_APP_DAO, this.getClass().getName(), e.getMessage()) ); } } It invoking from SQL Server 2000, is this: usp_Cierre_Dia_Obtener_CierrePorAnio '2014',1,1 Please could help me, and finally also to check if I'm getting the data correctly through a List &lt;Object []&gt; Error: Hibernate: usp_Cierre_Dia_Obtener_CierrePorAnio ?, ?, ? WARN : org.hibernate.engine.jdbc.spi.SqlExceptionHelper - SQL Error: 170, SQLState: 37000 ERROR: org.hibernate.engine.jdbc.spi.SqlExceptionHelper - Line 1: Incorrect syntax near 'usp_Cierre_Dia_Obtener_CierrePorAnio'. org.hibernate.exception.SQLGrammarException: could not extract ResultSet at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:122) at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:125) at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:110) at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(R…
type: Question
tagged with: spring
has comment: http://stackoverflow.com/comment/40383473
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/25815575
tagged with: java
tagged with: hibernate
linked to: http://stackoverflow.com/q/2515690
possible better answer: http://stackoverflow.com/a/25815685

http://stackoverflow.com/q/25866974
answer count: 1
has title: Splitting up a List into smaller parts (with possible use of wicket)
score: 0
tagged with: nested
has answer: http://stackoverflow.com/a/25867549
type: UnansweredQuestion
tagged with: wicket
tagged with: list
tagged with: java
has body: I've made an application that loads a query in from a property file, such as SELECT * FROM DATA. All this data is then loaded in each row at a time. The first time, we take the row which is id, name, phone, bday and division and put into a list called headlines. And then we put the data it self into a list called records. After that, we look past the headlines and just load our data continuesly into our records list. When we use wicket to show the data in a table for us, the outcome is this: https://i.sstatic.net/z37hQ.png As you can see, it just prints out an entire row with all the data. We want the all the data to have seperate columns, according to the headlines. So it should be something similar to: ID - NAME - PHONE - BDAY - DIVISION 123 - JOE - 10351053 - 20-12-2012 - EAST. How do we manage to do this? Our code is as follows: public class DataHandlerImpl implements DataHandler { private final DataService dataService = new DataService(); private final List<Object> records = new ArrayList<>(); @Override public String getPropertyValue() { Properties prop = new Properties(); String propFileName = "sqlQuery.properties"; InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName); loadInputStreamCatchIOException(prop, inputStream); fileNotFoundException(inputStream, propFileName); String result = prop.getProperty("sqlQuery"); return result; } @Override public Data getKeysAndValues() { String queryFromPropertyFile = getPropertyValue(); List<HashMap<String, Object>> sqlQuery = dataService.getSqlQuery(queryFromPropertyFile); List<String> headlines = new ArrayList<>(sqlQuery.get(0).keySet()); Collections.reverse(headlines); createListOfRecords(sqlQuery, headlines); return new DataImpl(headlines, records); } @Override public int numberOfRecords() { return getKeysAndValues().getRecords().size(); } private void loadInputStreamCatchIOException(Properties prop, InputStream inputStream) { try { prop.load(inputStream); } catch (IOException ex) { Lo…
type: Question
tagged with: hashmap

button
tags question: http://stackoverflow.com/q/25838047
tags question: http://stackoverflow.com/q/25860318
tags question: http://stackoverflow.com/q/25832701
tags question: http://stackoverflow.com/q/25836423
tags question: http://stackoverflow.com/q/25784438
tags question: http://stackoverflow.com/q/25800303
tags question: http://stackoverflow.com/q/25862139
type: Tag
tags question: http://stackoverflow.com/q/25780721
tags question: http://stackoverflow.com/q/25758782
tags question: http://stackoverflow.com/q/25766991
tags question: http://stackoverflow.com/q/25786904
tags question: http://stackoverflow.com/q/25858714
tags question: http://stackoverflow.com/q/25767640
tag name: button

http://stackoverflow.com/q/25822783
has answer: http://stackoverflow.com/a/25843834
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/40397016
type: Question
has comment: http://stackoverflow.com/comment/40396918
tagged with: security
has title: AES CS2Padding for java
has body: I'm trying to establish encrypted connection between my MCU device which running on (Cortex m3 STM32f102 controller) and my java application server. When i'm using plain text without encryption all works fine. The problem is that when i using encryption (AES/CBC/PKCS5PADDING on my server) i have BadPaddingException error when i receive message. When i looked into datasheets for MCU's crypto library i saw mention, that In CBC mode and in case of a call where P_inputSize is greater than 16 and not multiple of 16, Ciphertext Stealing will be activated. See CBC-CS2 of &lt;"SP 800-38 A - Addendum"> NIST SP 800-38A Addendum I think that problem is in different padding algorithms for controller and server. Is there some implementation of AES/CBC with CS2 padding for java? Or how would you recommend me to solve this problem? As recommended in posts below, i changed my encryption to AES\CTR\NoPadding and now it works.
accepted answer: http://stackoverflow.com/a/25843834
tagged with: jce
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/40399057
favorite count: 0
tagged with: encryption
upvote count: 1
has comment: http://stackoverflow.com/comment/40431136
tagged with: aes
type: AnsweredQuestion

http://stackoverflow.com/comment/40420662
comment on: http://stackoverflow.com/q/25835325
has text: @Constantinos A is ascending order and we can't sort C , if we sort it we will getting the wrong answwer , and answer is 4 because we use 4 element from C(includng non used because we have to go by order) to cover all elements from A
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/25822541
tagged with: epub3
has comment: http://stackoverflow.com/comment/40397770
has comment: http://stackoverflow.com/comment/40398680
answer count: 0
score: 1
tagged with: java
upvote count: 1
tagged with: epub
type: Question
tagged with: epublib
has comment: http://stackoverflow.com/comment/40397074
downvote count: 0
has title: how to show right-to-left language in FBReaderJ in android?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40396936
has comment: http://stackoverflow.com/comment/40398723
tagged with: android
has body: I want to use FBReaderJ for reading Persian book that is an rtl language. In FBReaderJ all words are shown correctly but words are reversed like this: سلام بر شما (correct) شما بر سلام (wrong) in FBReaderJ I downloaded FBReaderJ source to see if I can do any thing to fix this problem but FBReaderJ is a huge project and I can not do it. I found an edited version of FBReaderJ for supporting Arabic but I failed to import it or recognize what they did. Do you have any idea ? (sorry for bad english)

http://stackoverflow.com/comment/40386769
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/25816866
has text: @NareshVavilala What do you gain by doing that? You now have to do `CustomLogger.customlog.debug(..)` to log your message.

http://stackoverflow.com/comment/40275127
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/25755821
has text: Possible [duplicate](http://stackoverflow.com/q/8115722/230513).
type: Comment

http://stackoverflow.com/comment/40412025
score: 0
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/61195/discussion-between-kick-buttowski-and-marc-baumbach).
comment on: http://stackoverflow.com/a/25831083
type: AnswerComment

http://stackoverflow.com/comment/40343309
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25722397
has text: "I want to make screenshot of a website", it's clear that it's not only my website. Anyway I achieved what I wanted. Thanks for your help.

http://stackoverflow.com/q/25774027
has title: Error: variable digitMonth might not have been initialized
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/40307841
tagged with: initialization
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25774166
tagged with: if-statement
has comment: http://stackoverflow.com/comment/40307805
tagged with: java
has answer: http://stackoverflow.com/a/25774273
has body: I'm trying to write a program that takes a birth year, month, and day and calculates what day said birthday that lies on. Thing is, I get this error message: error: variable digitMonth might not have been initialized total = inputYear + test2 + digitMonth + inputDay; ^ I don't know how to fix it. Setting digitMonth to a number (e.g. 1)makes the program work, but for the formula, each month requires a different number (1 for January, 4, for February, 4 for March, 0 for April, etc) I've looked at the other questions for errors like this and I haven't found anything useful yet. Help? import java.util.Scanner; public class Birth{ public static void main(String[] args) { Scanner scan = new Scanner(System.in); int inputYear, inputMonth, inputDay, digitMonth, test2, total, dayNum; System.out.println("Enter the last two digits of the year that you were born in"); inputYear = scan.nextInt(); System.out.println("Enter the month number that your were born in"); inputMonth = scan.nextInt(); System.out.println("Enter your birth day"); inputDay = scan.nextInt(); test2 = inputYear / 4; if (inputMonth &gt; 0 &amp;&amp; inputMonth &lt; 2) { digitMonth = 1; } else if (inputMonth &gt; 1 &amp;&amp; inputMonth &lt; 3) { digitMonth = 4; } else if (inputMonth &gt; 2 &amp;&amp; inputMonth &lt; 4) { digitMonth = 4; } else if (inputMonth &gt; 3 &amp;&amp; inputMonth &lt; 5) { digitMonth = 0; } else if (inputMonth &gt; 4 &amp;&amp; inputMonth &lt; 6) { digitMonth = 2; } else if (inputMonth &gt; 5 &amp;&amp; inputMonth &lt; 7) { digitMonth = 5; } else if (inputMonth &gt; 6 &amp;&amp; inputMonth &lt; 8) { digitMonth = 0; } else if (inputMonth &gt; 7 &amp;&amp; inputMonth &lt; 9) { digitMonth = 3; } else if (inputMonth &gt; 8 &amp;&amp; inputMonth &lt; 10) { digitMonth = 6; } else if (inputMonth &gt; 9 &amp;&amp; inputMonth &lt; 11) { digitMonth = 1; } else if (inputMonth &gt; 10 &amp;&amp; inputMonth &lt; 12) { digitMonth = 4; } else if (inputMonth &gt; 11 &amp;&amp; inputMonth &lt; 13) { digit…
type: Question
has answer: http://stackoverflow.com/a/25774191

http://stackoverflow.com/comment/40237490
score: 1
comment on: http://stackoverflow.com/q/25735510
has text: What do you expect the argument values `myCourse.n` and others to be?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/85689393
has text: @Brick Color class also have `getAlpha()` method which will give you alpha value. And I mentioned it in my answer.
score: 7
type: AnswerComment
comment on: http://stackoverflow.com/a/25761567
type: Comment

http://stackoverflow.com/q/25769454
answer count: 2
has comment: http://stackoverflow.com/comment/40320826
tagged with: jar
has answer: http://stackoverflow.com/a/25778688
linked to: http://stackoverflow.com/q/25180142
score: 0
has title: Hadoop program runs well with "java -jar" but not with "hadoop jar"
tagged with: hbase
has body: I have coded a MapReduce program that connects to two HBase databases. I have written it on Eclipse and I have exported it with the "Runnable Jar" option (with all the libraries). It runs well with the java -jar command. The output is the next: $ java -jar mr.jar log4j:WARN No appenders could be found for logger (org.apache.hadoop.metrics2.lib.MutableMetricsFactory). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. And then the expected output. However, if I run the same program with the hadoop jar command I don't know exactly what happens but I guess nothing. The expected output doesn't show up. $ hadoop jar mr.jar 14/09/10 17:22:07 INFO Configuration.deprecation: mapred.jar is deprecated. Instead, use mapreduce.job.jar 14/09/10 17:22:07 INFO Configuration.deprecation: mapred.mapoutput.value.class is deprecated. Instead, use mapreduce.map.output.value.class 14/09/10 17:22:07 INFO Configuration.deprecation: mapreduce.map.class is deprecated. Instead, use mapreduce.job.map.class 14/09/10 17:22:07 INFO Configuration.deprecation: mapred.job.name is deprecated. Instead, use mapreduce.job.name 14/09/10 17:22:07 INFO Configuration.deprecation: mapreduce.inputformat.class is deprecated. Instead, use mapreduce.job.inputformat.class 14/09/10 17:22:07 INFO Configuration.deprecation: mapred.mapoutput.key.class is deprecated. Instead, use mapreduce.map.output.key.class 14/09/10 17:22:07 INFO Configuration.deprecation: dfs.df.interval is deprecated. Instead, use fs.df.interval 14/09/10 17:22:07 INFO Configuration.deprecation: mapred.task.tracker.http.address is deprecated. Instead, use mapreduce.tasktracker.http.address 14/09/10 17:22:07 INFO Configuration.deprecation: mapred.userlog.retain.hours is deprecated. Instead, use mapreduce.job.userlog.retain.hours 14/09/10 17:22:07 INFO Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available 14/09/10 17:2…
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: eclipse
tagged with: hadoop
has answer: http://stackoverflow.com/a/25805839

http://stackoverflow.com/comment/40355399
score: 0
has text: Show the server log...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25799671

http://stackoverflow.com/q/25853710
favorite count: 0
tagged with: time
has comment: http://stackoverflow.com/comment/40453255
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/25853857
score: 1
accepted answer: http://stackoverflow.com/a/25853857
tagged with: java
has comment: http://stackoverflow.com/comment/40453225
has comment: http://stackoverflow.com/comment/40453138
type: Question
has comment: http://stackoverflow.com/comment/40453696
has title: Java code - compile time optimisation
tagged with: optimization
upvote count: 2
answer count: 1
downvote count: 1
has body: I am new to programming and have programmed a java program that calculates the voronoi diagram for random points and draws it on a picture - 1080 x 1920 pixels. Here you can see the result The problem is that it takes nearly four minutes to compile the code. Please help me with code optimization. Below you can find the code: class Voronoi { private static Random r; private static KDTree&lt;Integer&gt; kd; private static double[][] keys; private static int counter; private static int x; public static void main(String[] args) throws IOException, KeySizeException, KeyDuplicateException { BufferedImage img = null; Scanner sc = new Scanner(System.in); x = sc.nextInt(); // input an image img = ImageIO.read(new File("input.jpg")); // get image Height and Width int w = img.getWidth(); int h = img.getHeight(); // make array with equal size like the image and populate it with the 0 // make an empty array and populate it int[][] empty = new int[h][w]; for (int row = 0; row &lt; h; row++) { for (int col = 0; col &lt; w; col++) { empty[row][col] = 0; } } // make a D-dimensional KD-tree keys = new double[x][2]; kd = new KDTree&lt;Integer&gt;(2); ArrayList&lt;Color&gt; b = new ArrayList&lt;Color&gt;(); int[] totalBlue = new int[x]; int[] totalGreen = new int[x]; int[] totalRed = new int[x]; int[] counter_sec = new int[x]; // Generate random centers and populate them with 1 for (int i = 0; i &lt; x; i++) { generateCentre(empty, h, w); // b.add(new Color(r.nextInt(256),r.nextInt(256),r.nextInt(256))); } for (int i = 0; i &lt; h; i++) { for (int j = 0; j &lt; w; j++) { double[] array = new double[2]; array[0] = i; array[1] = j; Color c = new Color(img.getRGB(j, i)); totalBlue[kd.nearest(array)] = totalBlue[kd.nearest(array)] + c.getBlue(); totalRed[kd.nearest(array)] = totalRed[kd.nearest(array)] + c.getRed(); totalGreen[kd.nearest(array)] = totalGreen[kd.nearest(array)] + c.getGreen(); // img.setRGB(j, i, b.get(kd.nearest(array)).getRGB()); counter_sec[kd.nearest(array)] = counter_s…

http://stackoverflow.com/comment/40212788
type: Comment
has text: I tried your suggestion, but now it is not able to find the other artifacts (namely junit,elasticsearch-hadoop,hadoop-core) which are avaiable on Maven repository. below is the error I get even after adding the following to pom.xml file:- spring-milestones http://repo.springsource.org/libs-milestone/ central http://repo.maven.apache.org/maven2/
type: AnswerComment
comment on: http://stackoverflow.com/a/25718890
score: 0

http://stackoverflow.com/q/25756687
score: 3
tagged with: amazon-s3
upvote count: 3
tagged with: java
has title: Can I pause and resume the multipart upload using Amazon High or Low Level API?
type: Question
has answer: http://stackoverflow.com/a/54942485
tagged with: amazon-web-services
has body: I'm trying to develop an Upload Manager (installable on your PC and will not be a web app) that will upload the selected image files to AmazonS3 using Java. Now, I have done coding to the level that it will initialize the upload and pause it using TransferManager (high level API) from AmazonS3. The problem is, everytime I resume the upload, it starts from the beginning. I have looked at several aws blogs and aws docs but there is no straight forward answer to the question. I have also written code with low level API (using their sample code) but there, I don't know how to pause the upload. So, my question is: How to resume the upload from the point it was paused ? I have two buttons (Using JFrames and Swing Worker) named Pause and Resume. What should I do so that I can Pause and Resume repeatedly ? How do I implement the code ? public class UploadObjectMultipartUploadUsingHighLevelAPI { public void pauseUploading(TransferManager tm, Upload upload) throws Exception{ long MB = 1024 * 1024 ; TransferProgress progress = upload.getProgress(); System.out.println("The pause will occur once 5 MB of data is uploaded"); while( progress.getBytesTransferred() &lt; 5*MB ) Thread.sleep(2000); boolean forceCancel = true; float dataTransfered = (float) upload.getProgress().getBytesTransferred(); System.out.println("Data Transfered until now: " + dataTransfered); PauseResult&lt;PersistableUpload&gt; pauseResult = ((Upload) upload).tryPause(forceCancel); System.out.println("The upload has been paused. The code that we've got is " + pauseResult.getPauseStatus()); pauseResult = ((Upload) upload).tryPause(forceCancel); PersistableUpload persistableUpload = (PersistableUpload) pauseResult.getInfoToResume(); System.out.println("Storing information into file"); File f = new File("D:\\Example\\resume-upload"); if( !f.exists() ) f.createNewFile(); FileOutputStream fos = new FileOutputStream(f); persistableUpload.serialize(fos); fos.close(); } public void resumeUploading(TransferManager tm) t…
answer count: 3
downvote count: 0
tagged with: file-upload
has answer: http://stackoverflow.com/a/25757200
favorite count: 0
tagged with: image-uploading
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/25771444

http://stackoverflow.com/q/25870737
answer count: 0
has comment: http://stackoverflow.com/comment/40483947
tagged with: java
has comment: http://stackoverflow.com/comment/40508885
type: Question
has body: I am having trouble generating tables from entities. The thing is I am with NetWeaver IDE and dont have an option which entities i would like to make table from and which to skip. Is there a way to make the generator skip ceratin WHOLE entities? EX: some dummy entities
tagged with: persistence
score: 0
has comment: http://stackoverflow.com/comment/40510215
has comment: http://stackoverflow.com/comment/40490668
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/40503060
has comment: http://stackoverflow.com/comment/40509488
has title: Java Persistence API skip entity

http://stackoverflow.com/comment/40371189
score: 0
type: Comment
type: QuestionComment
has text: @hwnd Yes, [A-Z](?:\s*/\*[^*]*\*/\s*[A-Z])* works, thanks. But in real application I have much more complex regex where I need to reference a repeating subexpression in multiple places. It is not easy to embed a part of the expression (like, [A-Z] into comment subexpression.
comment on: http://stackoverflow.com/q/25808920

http://stackoverflow.com/q/25767932
has comment: http://stackoverflow.com/comment/40296370
tagged with: onitemclicklistener
answer count: 1
accepted answer: http://stackoverflow.com/a/25773266
has comment: http://stackoverflow.com/comment/40297319
score: 0
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/40296438
tagged with: android
type: AnsweredQuestion
has title: Can't get access to the Activity item in onItemClick method
type: Question
has answer: http://stackoverflow.com/a/25773266
tagged with: java
has body: I have a Fragment where I get access to the m_items-layout: public class MoviesListFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.m_items, container, false); I created a custom adapter (extending the BaseAdapter class) that uses another layout as each list item belonging to the m_items-layout: listView = (ListView) view.findViewById(R.id.listView); MovieAdapter adapter = new MovieAdapter(getActivity(), initData()); listView.setAdapter(adapter); On the layout, which uses the adapter, there is the textView with the identifier @+id/textID. I'm trying to set text to it in onItemClick-method: listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { TextView movie_id = (TextView) view.findViewById(R.id.textID); movie_id.setText("577"); } }); but get an exception java.lang.NullPointerException here: movie_id.setText("577"); As I understand it, view.findViewById(R.id.textID); returns null. Why is this happening? Thanks.

http://stackoverflow.com/a/35419967
upvote count: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/121486428
accepted answer of: http://stackoverflow.com/q/25763533
type: Answer
has body: I have solved my problem with using mimeType = URLConnection.guessContentTypeFromStream(inputstream); { //Decode the Base64 encoded string into byte array // tokenize the data since the 64 encoded data look like this "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAKAC" String delims="[,]"; String[] parts = base64ImageString.split(delims); String imageString = parts[1]; byte[] imageByteArray = Base64.decode(imageString ); InputStream is = new ByteArrayInputStream(imageByteArray); //Find out image type String mimeType = null; String fileExtension = null; try { mimeType = URLConnection.guessContentTypeFromStream(is); //mimeType is something like "image/jpeg" String delimiter="[/]"; String[] tokens = mimeType.split(delimiter); fileExtension = tokens[1]; } catch (IOException ioException){ } }
answers question: http://stackoverflow.com/q/25763533
downvote count: 1
score: 3

primary-key
tag name: primary-key
type: Tag
tags question: http://stackoverflow.com/q/25716485

http://stackoverflow.com/a/25745307
has comment: http://stackoverflow.com/comment/133096437
type: Answer
score: 11
answers question: http://stackoverflow.com/q/25745094
has body: When using a SQL statement such as INSERT, UPDATE or DELETE with a PreparedStatement, you must use executeUpdate, which will return the number of affeted rows. In this case there is simply no ResultSet produced by the sql operation and thus calling executeQuery will throw a SQLException. If you actually need a ResultSet you must make another statement with a SELECT SQL operation. See the javadoc for PreparedStatement#executeQuery and PreparedStatement#executeUpdate
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25745094
upvote count: 11

http://stackoverflow.com/comment/40280310
type: QuestionComment
score: 0
has text: post your build.gradle
comment on: http://stackoverflow.com/q/25758917
type: Comment

http://stackoverflow.com/q/25750368
answer count: 1
has answer: http://stackoverflow.com/a/25755300
favorite count: 0
tagged with: jframe
type: UnansweredQuestion
score: -3
tagged with: swing
has comment: http://stackoverflow.com/comment/40264700
tagged with: java
has body: We are using JFrame in our Application to communicate with Signature Pad. We are done with the implementation of it. When we are trying to test ,after deploying to QA Server, we came to know that, the frame pop up which is used to capture signature always opens up in the server machine. Could anyone help us how to make it open on that particular client browser.
has title: JFrame opens in Server Machine instead of Client
type: Question
downvote count: 4
has comment: http://stackoverflow.com/comment/40264561
has comment: http://stackoverflow.com/comment/40267682
tagged with: applet
upvote count: 1

spnego
tag name: spnego
tags question: http://stackoverflow.com/q/25745228
tags question: http://stackoverflow.com/q/25864001
type: Tag

http://stackoverflow.com/comment/40232531
has text: @DPM You should post your comment as the answer.
comment on: http://stackoverflow.com/q/25732534
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/40244149
type: Comment
comment on: http://stackoverflow.com/a/25738513
has text: thanks sir vignesh for the quick response, i will try this and post my results.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/40260558
type: Comment
has text: I think you want `List<? extends myclass> test_list`
score: 7
type: QuestionComment
comment on: http://stackoverflow.com/q/25748195

http://stackoverflow.com/a/25721454
downvote count: 0
answers question: http://stackoverflow.com/q/25721266
has body: Do this : 1. Read you color column value 2. Split your string values with , or any other separator you have used 3. Parse each value to Integer value 4. Passed this value into java.awt.color constructors. Sample Example : int red,green,blue; String colorStr = "225,225,0"; //Value from DB String[] ar_color = colorStr.split(","); red = Integer.parseInt(ar_color[0]); green = Integer.parseInt(ar_color[1]); blue = Integer.parseInt(ar_color[2]); Color myColor = new Color(red, green, blue);
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/40208996
type: AnswerComment
score: 0
type: Comment
has text: @Cedy Lee, I suppose you want to remove everything that's not a digit? There's a way for that, see my updated answer
comment on: http://stackoverflow.com/a/25720464

android-framelayout
tag name: android-framelayout
tags question: http://stackoverflow.com/q/25863585
type: Tag
tags question: http://stackoverflow.com/q/25808175

http://stackoverflow.com/a/25814567
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/40382360
score: 1
has comment: http://stackoverflow.com/comment/40382169
has comment: http://stackoverflow.com/comment/40382540
has comment: http://stackoverflow.com/comment/40382413
has body: The typical usage of instanceof in the type of scenario you're describing would be if (foo instanceof FooSubclass) { FooSubclass fooSub = (FooSubclass) foo; //foo and fooSub now are references to the same object, and you can use fooSub to call methods on the subclass } else if (foo instanceof OtherSubclass) { OtherSubclass otherSub = (OtherSubclass) foo; //you can now use otherSub to call subclass-specific methods on foo } This is called "casting" or "explicitly casting" foo to FooSubclass.
downvote count: 0
has comment: http://stackoverflow.com/comment/40382678
has comment: http://stackoverflow.com/comment/40382434
answers question: http://stackoverflow.com/q/25813921
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40382603
accepted answer of: http://stackoverflow.com/q/25813921
has comment: http://stackoverflow.com/comment/40382235

http://stackoverflow.com/a/25867724
answers question: http://stackoverflow.com/q/25867169
type: Answer
has body: While using a base class for entities has a lot of uses, for mapping common fields I'd rather do it by embedding: Define a class with your common fields and mark it as @Embeddable. In the containing Entity, add a reference to the "embeddable" class, and mark the reference as @Embedded or @EmbeddedId, whatever applies. When applicable, mark the reference with additional @AttributeOverrides or @AssociationOverrides to customize the mapping. The main problem I see with @MappedSuperclass (the approach used in your linked post) is that you can only have a superclass per entity. This might be fine in many use cases, but it is too inflexible for the most complex ones. Embedding gives you the flexibility to combine as many @Embeddables as you want. The tradeoff is that it is not transparent. If you had: select u.streetname from User u And move streetname to an embedded address, now you will have to do: select u.address.streetname from User u In the end, if you know your model is simple, @MappedSuperclass will do the trick. If you have a complex model you can benefit from @Embeddable and @Embedded.
downvote count: 0
score: 3
upvote count: 3

http://stackoverflow.com/q/25815222
possible better answer: http://stackoverflow.com/a/25815815
has answer: http://stackoverflow.com/a/25815815
tagged with: google-drive-api
tagged with: google-api
tagged with: android
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25815502
score: 0
tagged with: java
type: Question
answer count: 2
has title: Orientation changes and connection to Drive
has answer: http://stackoverflow.com/a/25815502
has body: I'm trying to develop an application for Android that fetches all the data from Google Drive. I've been struggling quite long with the device orientation changes and having to reconnect to Drive. I thought I could save the connection/Drive object in onSaveInstanceState, but I couldn't find a method that would qualify a Drive object. So how should I ideally proceed with this? Is there a way to store it or should I just reconnect on device layout changes, for example in onRestoreInstanceState? Thank you for your time.

http://stackoverflow.com/comment/40354307
type: QuestionComment
has text: See http://www.drmaciver.com/2008/07/javalangstringhashcode/ - *lots* of collisions from Scrabble words. Some statistics: "There are 3844 alphanumeric strings of size 2. Of these 3570 collide with at least one other string. That is, [only] 274 of these strings (or about 7% of them) *don’t* collide with something else. Oh well. *It’s a good thing no one would be stupid enough to rely on hashCode to distinguish the contents of two objects.*"
score: 0
comment on: http://stackoverflow.com/q/25799212
type: Comment

http://stackoverflow.com/a/25822251
has comment: http://stackoverflow.com/comment/40396286
has comment: http://stackoverflow.com/comment/40396299
has body: you can put a check for null pointer like this LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); String provider = locationManager.getBestProvider(criteria, false); Log.d("FlagLocation", "true"); if (provider != null &amp;&amp; !provider.equals("")) { Location location = locationManager.getLastKnownLocation(provider); locationManager.requestLocationUpdates(provider, 20000, 1, this); if (location != null) { double lng = location.getLongitude(); double lat = location.getLatitude(); double kmInLongitudeDegree = 111.320 * Math.cos(lat / 180.0 * Math.PI); double deltaLat = RADIUS / 111.1; double deltaLong = RADIUS / kmInLongitudeDegree; double minLat = lat - deltaLat; double maxLat = lat + deltaLat; double minLong = lng - deltaLong; double maxLong = lng + deltaLong; }
score: 0
answers question: http://stackoverflow.com/q/25822202
has comment: http://stackoverflow.com/comment/40396061
type: Answer

http://stackoverflow.com/q/25839461
tagged with: intellij-13
has comment: http://stackoverflow.com/comment/40427793
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/25839500
tagged with: java
has comment: http://stackoverflow.com/comment/40428841
upvote count: 1
downvote count: 1
type: Question
has title: Intellij: What's the difference between 'Run' and 'Run...'
score: 0
has answer: http://stackoverflow.com/a/25839500
answer count: 1
tagged with: keyboard-shortcuts
favorite count: 0
has comment: http://stackoverflow.com/comment/40428185
has body: I'm trying to change the default Run keyboard shortcut to ⌘R. - Because I dont want to reach for the trackpad everytime and my fingers are not long enough to do ⌥⇧F10 at once. What's the difference between 'Run' and 'Run...'?

http://stackoverflow.com/comment/40258517
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25744908
has text: Actually there is a chance. Actually I'm rewriting the handle method to be more defensive and more verbose. Let me get back with test results.

http://stackoverflow.com/a/25828583
type: Answer
answers question: http://stackoverflow.com/q/25828078
accepted answer of: http://stackoverflow.com/q/25828078
upvote count: 1
score: 1
has body: The problem is that a single regex can't easily return a list of values. (Even if you put * or + after a capture group, this does not cause more capture groups to be added; the number of capture groups is a fixed value based on the pattern only, not on the source string.) So while you did well to write a loop to find each portion beginning with s, you still have the problem that the portions beginning with s may themselves contain lists of episode numbers. While you may be able to find a tricky way to do this with a single loop, I'd recommend using a nested find loop, or split. Your first pattern should look like this: final Matcher m = Pattern.compile("s[0-9]{1,2}e([0-9]{1,2}(?:\\.[0-9]{1,2})*)").matcher(fileName); Note that the part that matches multiple occurrences of things like .02, .03, etc., has been moved inside the first capture group. (I put ?: in the second set of parentheses to emphasize the fact that this is not a capture group that you will be extracting with group().) After you do that, the result of group(1) could be "01" or "01.02" or "03.04.05" or whatever. Now you can split on the period character: while (m.find()) { for (String episode : m.group(1).split("\\.")) { System.out.println("myEpisode = " + episode); } } P.S. This is an approach that will work generally on similar kinds of problems. Your particular problem is simple enough to solve with a single loop (because the combination .\d\d doesn't occur anywhere else except inside one of the s\d\de....... patterns), but there will be situations where that approach won't work.
type: AcceptedAnswer
downvote count: 0

bit
tags question: http://stackoverflow.com/q/25830800
tags question: http://stackoverflow.com/q/25718799
tag name: bit
type: Tag
tags question: http://stackoverflow.com/q/25818488

http://stackoverflow.com/q/25732394
has body: I've been wondering about this for a while. How do some jar files work without their required libraries compressed inside them or in the same directory as them? For example, bukkit plugins. Every time i make one, i include the bukkit library. But whe nthe jar file is made, there is no trace of the bukkit library inside the jar file.
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/25732640
tagged with: jar
has title: Java jar files without libraries
score: 0
has answer: http://stackoverflow.com/a/25732597
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/2198257
has comment: http://stackoverflow.com/comment/40231371
tagged with: java

http://stackoverflow.com/a/25802869
score: 0
has body: So you defined an Interface and an abstract class but no concrete class. Your implementation can't be used on it's own but requires a further 'implementation' class or you could remove the abstract keyword from your class definition. This keyword isn't needed as you don't have any abstract methods in your class. Well and as others have pointed out, your main method (which you don't need) misses it's closing bracket.
type: Answer
answers question: http://stackoverflow.com/q/25802788

http://stackoverflow.com/a/25825557
has comment: http://stackoverflow.com/comment/40402820
answers question: http://stackoverflow.com/q/25825496
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/40402631
has body: try it this way SimpleDateFormat df = new SimpleDateFormat("hh:mm:ss a",Locale.ENGLISH); System.out.println(df.format(new Date())); Or this way DateFormat ddf = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.ENGLISH); System.out.println(ddf.format(new Date())); Specify Locale it keeps you safe and Be carefull with the case of the letters for Example H means Hour of the day in 24-hour clock and h means hour of day in 12-hour clock. refer
has comment: http://stackoverflow.com/comment/40402548
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25825496

http://stackoverflow.com/comment/40257470
has text: You should avoid blocking the UI thread at all! Have a look at http://docs.oracle.com/javase/8/javafx/interoperability-tutorial/concurrency.htm
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/25746142

http://stackoverflow.com/a/25837656
score: 60
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/25837449
has body: There are two main classes for color handling in Java/Android. This first one is from "plain" Java and can be found in java.awt.Color. This class supports converting a String into a color with the method decode. Example: Color red = Color.decode("#FF0000"); The second class is for Android and can be found in android.graphics.Color. The conversion can be done with the method parseColor. int red = Color.parseColor("#FF0000"); So you should check which kind of Color class you've imported to your project. I recommend using the Android version of Color for your case. If you've done that the statement targetView.setBackgroundColor(Color.parseColor("#FFFFFF")); should work.
type: Answer
answers question: http://stackoverflow.com/q/25837449
upvote count: 60

http://stackoverflow.com/q/25845015
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/25849960
has title: Java FTP Transfer disconnect detect
score: 0
answer count: 1
type: UnansweredQuestion
has body: I am working on a simple piece of java code for transferring a file from an HTTP site to the local machine. All works well and I can download without any problem. The code below updates my progress bar status during the download also without any problem. My Question: How do I detect that the FTP site is no longer available/connected wile downloading? A separate thread monitoring the ftp isAvailible () and isConnected () methods always returns true even with the network switched off? Please see code below: // Disable the download button BTNdownload.setText("Downloading..."); BTNdownload.setEnabled (false); // Create a instance of the FTP client ftpClient = new FTPClient(); // Setup the FTP client ftpClient.connect(server, port); ftpClient.login(user, pass); ftpClient.enterLocalPassiveMode(); ftpClient.setFileType(FTP.BINARY_FILE_TYPE); // Create a file in destination folder output = new File(destination); // Request the download file size ftpClient.sendCommand("SIZE", origin); // Get the size of the file String size = ftpClient.getReplyString().split(" ") [1].trim(); total = Long.parseLong(size); // Set the JProgressBar limits JPBprogress.setMinimum(0); JPBprogress.setMaximum((int) total/1024); // Enable the progress bar JPBprogress.setEnabled(true); // Create a input stream from the remote file stO = ftpClient.retrieveFileStream(origin); // Create a output stream to the output file OutputStream stD = new BufferedOutputStream(new FileOutputStream(output)); // Add a progress listener to the copy process org.apache.commons.net.io.Util.copyStream(stO, stD, ftpClient.getBufferSize(), org.apache.commons.net.io.CopyStreamEvent.UNKNOWN_STREAM_SIZE, new org.apache.commons.net.io.CopyStreamAdapter() { public void bytesTransferred(long totalBytesTransferred, int bytesTransferred, long streamSize) { // Update the progress bar JPBprogress.setValue((int) totalBytesTransferred/1024); } }); // Close the input &amp; output stream stO.close(); stD.close (); // Send the FTP completed …
tagged with: ftp
tagged with: apache-commons

http://stackoverflow.com/a/25743534
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I guess the Maven scope provided would solve your problem : org.apache.lucene lucene-core 4.10.0 provided From the maven documentation : compile This is the default scope, used if none is specified. Compile dependencies are available in all classpaths of a project. Furthermore, those dependencies are propagated to dependent projects. provided This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. This scope is only available on the compilation and test classpath, and is not transitive. In your case you do not expect a container to provide the dependency but the user of your framework to include it (if he needs to).
accepted answer of: http://stackoverflow.com/q/25742852
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/25742852

http://stackoverflow.com/comment/106743593
has text: I don't know why either, I've tried to add '@Transactional' to all different methods, no luck, but once moved it to class level, the magic happens...
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/39571114

http://stackoverflow.com/comment/40259219
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/25744749
has text: @cmbaxter I disagree slightly. ZK is a good solution for the initial service discovery of an Akka cluster, assuming you don't have static network locations. Somehow your nodes have to discover your seed nodes and ZK (or other service discovery solutions) are necessary you don't know a priori where your seeds are located.
score: 0

http://stackoverflow.com/q/25782824
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/25784368
type: Question
has title: eclipselink: generate entities without joins
score: 0
has body: Two entities: Customer &lt;--- Account id id name customerId (FK to Customer) balance eclipselink 'generate entities from tables' generates the two entity classes. Customer has reference to Account and vice versa. public class Customer { Integer id; String name; Account account; } public class Account { Integer id; Customer customer; Double balance; } Required: Generate entities with relationship attribute as basic type instead of Entity name: public class Customer { Integer id; String name; Integer accountId; // &lt;-- this is id instead of Account } public class Account { Integer id; Integer customerId; // &lt;-- this is id instead of Customer Double balance; } Why we need this: Customer and Account are managed by separate applications and hence packaged in separate wars. Each war may potentially be deployed on a separate app server. If the Customer application needs Account details, it will use the public API provided by Account application and does not read from DB directly. This is to avoid Customer application from modifying the Account entity by itself without the knowledge of Account application. Eclipselink generation has an option to turn off relationship generation altogether. Is there a way to generate only the ids instead of entity class names? Or is there a better way to manage this?
tagged with: eclipselink
answer count: 1

bliki
type: Tag
tags question: http://stackoverflow.com/q/25742422
tag name: bliki

http://stackoverflow.com/a/25805249
upvote count: 2
has body: As an alternative to matching the lastname, firstname middlename directly, you could use String.split and provide a regexp that matches the separators, instead. For instance: static String[] lastFirstMiddle(String input){ String[] result=input.split("[,\\s]+"); System.out.println(Arrays.asList(result)); return result; } I tested this with inputs "Müller, firstname middlename" "Müller,firstname middlename" "O'Gara, Ronan Ramón" Note: this approach fails with surnames that contain spaces, for instance "van der Heuvel", "de Valera", "mac Piarais" or "bin Laden" but then again, OP's original specification does not seem to admit of spaces in the surname (or the other names. I work with a "Mary Kate". That's her first name, not first and middle). There's an interesting page about personal names at http://www.w3.org/International/questions/qa-personal-names
downvote count: 0
answers question: http://stackoverflow.com/q/25801247
type: Answer
score: 2

http://stackoverflow.com/a/25766316
type: Answer
has comment: http://stackoverflow.com/comment/40300278
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/40296182
has body: Final Edit: The correct syntax for Jasper Reports is this. Evidently Jasper does not like using the property .length in this context. Arrays.asList($F{OBSERVATII}.split(" ")).size() ? blah... Don't you want the length property for an array of strings, rather than the size method which does not work with an array? .length &gt;= 2 ? blah Edited to say: You said Jasper does not like the above syntax, but it's what you should use. You could try: (String[] $F{OBSERVATII}.split(" ")).length&gt;=2 ? blah... Or Arrays.asList($F{OBSERVATII}.split(" ")).size() ? blah... That will convert your array to a list and use the size method. I don't know if Jasper will like that or not, if not, I suppose their expression editor sucks.
upvote count: 2
answers question: http://stackoverflow.com/q/25765263
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/40320273
accepted answer of: http://stackoverflow.com/q/25765263

http://stackoverflow.com/comment/40267751
comment on: http://stackoverflow.com/q/25751917
score: 0
has text: Well, then these are invalid dates and you should handle them separately.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/25755130
answer count: 2
tagged with: jersey
downvote count: 0
has answer: http://stackoverflow.com/a/48092585
has title: Nested resources in Jersey/JAX-RS -how to implement Restangular example
tagged with: rest
tagged with: jax-rs
has body: Thus may not actually be called nested resources from a Rest perspective, but I am interested in how to structure a Jersey class as a rest provider, so it can respond to chained requests. i.e I am ok with the basic /users, I am ok with /users/123 to get a specific user, but how to then branch down to properties of the user.... /users/123/cars, /users/123/cars/23 etc. Sorry for the lack of information, but saw this as an example in the Restangular documentation for Angular. https://github.com/mgonto/restangular#production-apps-using- restangular // Restangular returns promises Restangular.all('users').getList() // GET: /users .then(function(users) { // returns a list of users $scope.user = users[0]; // first Restangular obj in list: { id: 123 } }) // Later in the code... // Restangular objects are self-aware and know how to make their own RESTful requests $scope.user.getList('cars'); // GET: /users/123/cars // You can also use your own custom methods on Restangular objects $scope.user.sendMessage(); // POST: /users/123/sendMessage // Chain methods together to easily build complex requests $scope.user.one('messages', 123).one('from', 123).getList('unread'); // GET: /user/123/messages/123/from/123/unread
favorite count: 0
upvote count: 9
has answer: http://stackoverflow.com/a/25775371
type: UnansweredQuestion
tagged with: java
type: Question
score: 9

http://stackoverflow.com/comment/40361406
has text: @rajarshi369 and we only need to care about player 0, so only add into the result the value when player == 0, that's it!
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25803132
type: Comment

http://stackoverflow.com/a/25789809
type: Answer
has body: android:keepScreenOn doesn't work in this specific case because the view hierarchy being drawn by the Compass sample isn't actually attached to a window; it's only used to perform some minor layout and then gets drawn directly onto a surface. For LiveCards, you'll need to hold a wake lock in order to keep the screen on while the card is being viewed by the user. Be careful with this approach though and make sure that you properly manage the lifetime of this wake lock so that you don't hold it excessively. The renderingPaused callback can help you detect when the user has navigated to or from the card.
upvote count: 1
has comment: http://stackoverflow.com/comment/41123985
score: 1
answers question: http://stackoverflow.com/q/25789059
downvote count: 0
has comment: http://stackoverflow.com/comment/41171495
has comment: http://stackoverflow.com/comment/40371089

http://stackoverflow.com/comment/40299929
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/25769889
type: Comment
has text: real programmers do not need brackets to hold their teeth ;)

http://stackoverflow.com/q/25791004
score: 2
answer count: 0
tagged with: java
tagged with: selenium
type: Question
tagged with: gwt
tagged with: javascript
downvote count: 0
favorite count: 0
has body: I have a GWT QueryEditor widget that generates the below HTML on typing "select 1" in a text-area look-alike sub-widget. : select 1 On every keyPress, a GWT event is fired that validates the query. I have to test the above scenario using WebDrivers. I tried to use sendKeys on the tag but it didn't work. ( tag cannot get focus). So I used the JavaScriptExecutor to set the innerHTML of the tag and I can see the text in the test - browser. However, the query doesn't get validated as the keyUp/onChange events are not fired by javaScriptExecutor. This causes my test to fail. How can I fire these backend GWT events via web-drivers? Any help would be really appreciated... And please let me know if I need to make my question more clear... Thanks.
upvote count: 2
type: UnansweredQuestion
has title: Fire GWT event in webdriver?? Possible or not?

http://stackoverflow.com/comment/40318905
score: 0
type: AnswerComment
has text: Ok. Anyway, I will keep this in mind. Maybe if my script reaches its limits I will use your approach. Thanks anyway !
type: Comment
comment on: http://stackoverflow.com/a/25725157

http://stackoverflow.com/q/25815253
has answer: http://stackoverflow.com/a/26644623
score: 7
has answer: http://stackoverflow.com/a/26743557
favorite count: 0
type: UnansweredQuestion
tagged with: google-cloud-messaging
has answer: http://stackoverflow.com/a/27643111
answer count: 4
tagged with: playframework-2.0
has body: I am having the same problem as this. I will try and provide more information. I am using Play Framework, writing in Java. I wrote a plugin called PushNotificationQueue. PushNotificationQueue runs both an iOS and an Android Push Message Queue. Below, for reference, is my GCM implementation. public class AndroidPushNotificationQueue { // (constructors and fields not included for brevity) // constructor starts a daemon thread /** * Sends a notification. * @param notifyKeys - device tokens * @param data - data to send **/ public void sendNotification(List<String> notifyKeys, Map<String, String> data) { if (notifyKeys.size() == 0) { return; } Builder b = new Message.Builder(); if (data != null) { for (String key : data.keySet()) { b.addData(key, data.get(key)); } } if (testMode) { b.dryRun(true); } Message message = b.build(); queue.add(new Notification(notifyKeys, message)); } public void stop() { stopped = true; sendingThread.interrupt(); } private class SendNotificationRunner implements Runnable { @Override public void run() { while (true) { try { sendNotifications(); //TODO: handle errors } catch (InterruptedException e) { if (stopped) break; Logger.error("Error processing android notification", e); } catch (InvalidRequestException e) { if (stopped) break; Logger.error("Error processing android notification", e); } catch (IOException e) { if (stopped) break; Logger.error("Error processing android notification", e); } catch (Exception e) { if (stopped) break; Logger.error("Unexpected Exception in Android Notification thread", e); } } Logger.info("Stopping Android push queue"); } private void sendNotifications() throws IOException, InterruptedException, InvalidRequestException { Notification n = queue.take(); // will wait until an element becomes available MulticastResult result = sender.send(n.message, n.notifyKeys, NUM_RETRIES); List<Result> results = result.getResults(); for (int i = 0; i < results.size(); ++i) { Result r = results.get(i); String mId = r.getMessage…
tagged with: java
upvote count: 7
type: Question
has title: GCM - Could not post JSON requests to GCM after 6 attempts
has comment: http://stackoverflow.com/comment/41841271
has comment: http://stackoverflow.com/comment/78663115
linked to: http://stackoverflow.com/q/16956356
has answer: http://stackoverflow.com/a/57659124
downvote count: 0

http://stackoverflow.com/comment/40513464
score: 0
type: Comment
comment on: http://stackoverflow.com/a/25868877
has text: Check this also http://www.oracle.com/technetwork/java/javamail/faq/index.html#gmail
type: AnswerComment

http://stackoverflow.com/comment/40317945
comment on: http://stackoverflow.com/a/25779235
type: AnswerComment
score: 0
type: Comment
has text: Could you provide some of the test input?

http://stackoverflow.com/comment/40608420
comment on: http://stackoverflow.com/a/25830441
has text: You don't have two open two sessions. The first session already enlists a database connection, so the typical flow is one Session per thread. Use the first Session only, or even the entityManager. It should use the same connection for all queries executing in the same unit of work.
score: 0
type: AnswerComment
type: Comment